<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPage.master"
CodeFile="DisplaySlipdetails.aspx.cs" Inherits="DisplaySlipdetails" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script language="javascript" type="text/javascript">
function show() {
s = '<table width="100%" cellspacing="2" cellpadding="0" border="0">';
s += '<tr><td><img src= "http://www.dotnetheaven.com/App_Themes/CSharp/Images/DNHSiteLogo.gif" border="0"/>';
s += '</td><td valign="top">DotNet Heaven</td>';
s += '</tr>';
s += '<tr><td colspan="2" class="toolTip">';
s += '<hr/>this is a test for simple tooltip. <br/>';
s += 'You can add text and images to the tooltip';
s += '</td></tr>';
s += '</table>';
}
</script>
<script type="text/javascript" language="javascript">
var message="<%=Message %>";
if (message != '') {
alert(message);
}
</script>
<script type="text/javascript" language="javascript">
var srno;
var chequeno = "";
function setchequestatus(srno) {
chequeno = chequeno + srno + ",";
document.getElementById("ctl00_ContentPlaceHolder1_hiddensrno").value = chequeno;
alert(chequeno);
}
var slipid;
var slipno="";
function setslipstatus(slipid) {
slipno = slipno + slipid + ",";
document.getElementById("ctl00_ContentPlaceHolder1_hiddenslipid").value = slipno;
alert(slipno);
}
var image;
function DisplayImage(image) {
window.open("DisplayImage.aspx?img=" + image + "", "window");
}
function setchequestatus1(srno) {
alert(srno);
srno.split(",");
var status = document.getElementById("chk" + srno + "");
alert(status);
for (var i = 1; i <= srno; i++) {
status.checked = true;
}
alert(status.value);
}
</script>
<script language="javascript" type="text/javascript">
function applyclass() {
var tdclass = document.getElementById("td5");
tdclass.className = "headingbgcolor";
tdclass.style.cursor = "auto";
}
</script>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="Tableborder" style="padding: 5px 5px 5px 5px">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<%=Str%>
</td>
</tr>
<tr>
<td colspan="6" align="center">
<asp:HiddenField ID="hiddensrno" runat="server" />
<asp:HiddenField ID="hiddenslipid" runat="server" />
<asp:Button ID="btnUpdate" CssClass="buttonbgcolor" runat="server" Text="Update"
OnClick="btnUpdate_Click" />
</td>
</tr>
</table>
</td>
</tr>
</table>
<script type="text/javascript" language="javascript"> applyclass()</script>
</asp:Content>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ServiceReference1;
public partial class DisplaySlipdetails : System.Web.UI.Page
{
public string Str, SrNo,GetSrNo,hiddenSrNo,hiddenSlipid,Message;
public DataSet ds,ds1;
Class2 c2 = new Class2();
WCFSample.ServiceClient client = new WCFSample.ServiceClient() ;
protected void Page_Load(object sender, EventArgs e)
{
string UserName = Session["UserName"] != null ? Session["UserName"].ToString() : "";
if (UserName == "")
{
Response.Redirect("Login.aspx");
}
if (!IsPostBack)
{
LoadData();
hiddenSlipid = "";
hiddenSrNo = "";
}
//Response.Write(Str);
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
hiddenSrNo = hiddensrno.Value;
hiddenSlipid = hiddenslipid.Value;
char[] schar = new char[] { ',' };
string[] srno = hiddenSrNo.Split(schar);
for (int i=0; i < srno.Length-1; i++)
{
int s1 = int.Parse(srno[i]);
client.UpdateChequeStatus(s1);
}
LoadData();
Message = "Record Updated Successfully";
}
protected void LoadData()
{
ds = new DataSet();
ds1 = new DataSet();
ds = c2.GetSlipDetals();
Str = "<table cellspacing ='0' cellpadding= '0' border ='0' >";
Str += "<tr class='headingbgcolor'><td class='headingbgcolor'>Deposit Bank </td><td class='headingbgcolor'>Details</td><td colspan='5'></td></tr>";
Str += "<tr><td style='height:10px'></td></tr>";
//Str += "SrNo, ClientName, ChequeNo, BankName, Branch, Date";
if (ds.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string slipid = ds.Tables[0].Rows[i]["slipid"].ToString();
string DepositBank = ds.Tables[0].Rows[i]["DepositBank"].ToString();
string Details = ds.Tables[0].Rows[i]["Details"].ToString();
Str += "<tr class='cellbgcolor'><td class='cellbgcolor'>" + DepositBank + "</td><td class='cellbgcolor'>" + Details + "</td><td></td><td></td><td></td><td></td><td><input id='chk" + slipid + "' type='checkbox' onclick=setslipstatus('" + slipid + "') /></td></tr>";
ds1 = c2.GetChequeDetals(slipid);
if (ds1.Tables[0].Rows.Count > 0)
{
for (int j = 0; j < ds1.Tables[0].Rows.Count; j++)
{
string SlipId = ds1.Tables[0].Rows[j]["slipid"].ToString();
SrNo = ds1.Tables[0].Rows[j]["SrNo"].ToString();
string ClientName = ds1.Tables[0].Rows[j]["ClientName"].ToString();
string ChequeNo = ds1.Tables[0].Rows[j]["ChequeNo"].ToString();
string BankName = ds1.Tables[0].Rows[j]["BankName"].ToString();
string Branch = ds1.Tables[0].Rows[j]["Branch"].ToString();
string Date = ds1.Tables[0].Rows[j]["Date"].ToString();
string ChequeImage = ds1.Tables[0].Rows[j]["ChequeImage"].ToString();
GetSrNo = GetSrNo + SrNo + ",";
Str += "<tr><td class='gridcellbgcolor'>" + ClientName + "</td><td class='gridcellbgcolor'>" + ChequeNo + "</td><td class='gridcellbgcolor'><a style='cursor:hand' title = 'Click to see Image' onclick =DisplayImage('" + ChequeImage + "')>" + BankName + "</a></td><td class='gridcellbgcolor'>" + Branch + "</td><td class='gridcellbgcolor'>" + Date + "</td>";
Str += "<td><td class='gridcellbgcolor'><input id='chk" + SrNo + "' type='checkbox' onclick=setchequestatus('" + SrNo + "') /></td></tr>";
}
}
Str += "<tr><td style='height:10px'></td></tr>";
}
}
if (GetSrNo.EndsWith(",") == true)
{
int length = GetSrNo.Length - 1;
GetSrNo.Remove(length);
}
Str += "</table>";
}
}
No comments:
Post a Comment