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("No Data To Display[[<<>>]]No Data To Display"); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.SuppressContent = true; HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } if (dt.Tables[0].Rows.Count == 0) { sb.AppendLine("No Data To Display"); } if (dt.Tables[1].Rows.Count == 0) { sb1.AppendLine("No Data To Display"); } int sNo = 1; int sNo1 = 1; foreach (DataRow item in dt.Tables[0].Rows) { sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("" + item["particulars"].ToString() + ""); sb.AppendLine("" + item["tranDate"].ToString() + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["depositAmount"].ToString()) + ""); sb.AppendLine("" + GetStatic.ShowDecimal(item["paymentAmount"].ToString()) + ""); sb.AppendLine(""); sb.AppendLine(""); sNo++; } foreach (DataRow item in dt.Tables[1].Rows) { sb1.AppendLine(""); sb1.AppendLine(""); sb1.AppendLine("" + item["particulars"].ToString() + ""); sb1.AppendLine("" + item["tranDate"].ToString() + ""); sb1.AppendLine("" + GetStatic.ShowDecimal(item["depositAmount"].ToString()) + ""); sb1.AppendLine("" + GetStatic.ShowDecimal(item["paymentAmount"].ToString()) + ""); sb1.AppendLine(""); sb1.AppendLine(""); 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(); } } }