You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

148 lines
6.2 KiB

using Newtonsoft.Json;
using Swift.DAL.AccountReport;
using Swift.DAL.Model;
using Swift.DAL.Remittance.CustomerDeposits;
using Swift.DAL.SwiftDAL;
using Swift.web.Library;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Swift.web.Remit.Transaction.SystemDiagnosis
{
public partial class Manage : System.Web.UI.Page
{
private AccountStatementDAO st = new AccountStatementDAO();
private const string ViewFunctionId = "20610000";
private SwiftLibrary _sl = new SwiftLibrary();
private readonly CustomerDepositDao _dao = new CustomerDepositDao();
protected void Page_Load(object sender, EventArgs e)
{
Authenticate();
if (!IsPostBack)
{
string methodName = Request.Form["MethodName"];
switch (methodName)
{
case "getListData":
PopulateData();
break;
case "MapData":
ProceedMapData();
break;
default:
break;
}
}
}
private void Authenticate()
{
_sl.CheckAuthentication(ViewFunctionId);
}
private void PopulateData()
{
try
{
string trnDate = Request.Form["tranDate"];
string particulars = Request.Form["particulars"];
string customerId = Request.Form["customerId"];
string amount = Request.Form["amount"];
DataSet dt = _dao.GetDataForSendMapping(GetStatic.GetUser(), trnDate, particulars, customerId, amount);
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
if (null == dt)
{
Response.ContentType = "application/text";
Response.Write("<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>[[<<>>]]<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>");
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.SuppressContent = true;
HttpContext.Current.ApplicationInstance.CompleteRequest();
return;
}
if (dt.Tables[0].Rows.Count == 0)
{
sb.AppendLine("<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>");
}
if (dt.Tables[1].Rows.Count == 0)
{
sb1.AppendLine("<tr><td colspan = \"7\" align=\"center\">No Data To Display</td></tr>");
}
int sNo = 1;
int sNo1 = 1;
foreach (DataRow item in dt.Tables[0].Rows)
{
sb.AppendLine("<tr>");
sb.AppendLine("<td><input type='checkbox' class='unmapped' name='chkDepositMapping' id='chkDepositMapping" + item["tranId"].ToString() + "' value='" + item["tranId"].ToString() + "' /></td>");
sb.AppendLine("<td>" + item["particulars"].ToString() + "</td>");
sb.AppendLine("<td>" + item["tranDate"].ToString() + "</td>");
sb.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["depositAmount"].ToString()) + "</td>");
sb.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["paymentAmount"].ToString()) + "</td>");
sb.AppendLine("</tr>");
sb.AppendLine("<tr id=\"addModel" + item["tranId"].ToString() + "\"></tr>");
sNo++;
}
foreach (DataRow item in dt.Tables[1].Rows)
{
sb1.AppendLine("<tr>");
sb1.AppendLine("<td><input type='checkbox' class='unapproved' name='chkDepositMappingUnmap' id='chkDepositMappingUnmap" + item["tranId"].ToString() + "' value='" + item["tranId"].ToString() + "'/></td>");
sb1.AppendLine("<td>" + item["particulars"].ToString() + "</td>");
sb1.AppendLine("<td>" + item["tranDate"].ToString() + "</td>");
sb1.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["depositAmount"].ToString()) + "</td>");
sb1.AppendLine("<td align='right'>" + GetStatic.ShowDecimal(item["paymentAmount"].ToString()) + "</td>");
sb1.AppendLine("</tr>");
sb1.AppendLine("<tr id=\"addModel" + item["tranId"].ToString() + "\"></tr>");
sNo1++;
}
string data = sb + "[[<<>>]]" + sb1;
Response.ContentType = "application/text";
Response.Write(data);
HttpContext.Current.Response.Flush(); // Sends all currently buffered output to the client.
HttpContext.Current.Response.SuppressContent = true; // Gets or sets a value indicating whether to send HTTP content to the client.
HttpContext.Current.ApplicationInstance.CompleteRequest(); // Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.
}
catch (ThreadAbortException ex)
{
string msg = ex.Message;
}
}
protected void ProceedMapData()
{
var Ids = Request.Form["tranIds[]"];
var controlNo = Request.Form["controlNo"];
DbResult _res = new DbResult();
if (!string.IsNullOrEmpty(Ids))
{
_res = _dao.ChangeCollMode(GetStatic.GetUser(), Ids, controlNo);
}
else
{
GetStatic.AlertMessage(this, "Please choose at least on record!");
}
Response.ContentType = "text/plain";
Response.Write(JsonConvert.SerializeObject(_res));
Response.End();
}
}
}