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.
 
 
 
 
 

188 lines
8.4 KiB

using Newtonsoft.Json;
using Swift.DAL.BL.Remit.Transaction;
using Swift.DAL.Remittance.APIPartner;
using Swift.DAL.Remittance.CustomerDeposits;
using Swift.DAL.SwiftDAL;
using Swift.web.Library;
using System;
using System.Data;
using System.Text;
using System.Threading;
using System.Web;
namespace Swift.web.Remit.ChangeCollMode
{
public partial class ChangeMode : System.Web.UI.Page
{
private string ViewFunctionId = "20114000";
private readonly RemittanceLibrary _sl = new RemittanceLibrary();
private readonly APIPartnerDao _dao = new APIPartnerDao();
private readonly StaticDataDdl _sdd = new StaticDataDdl();
private ApproveTransactionDao at = new ApproveTransactionDao();
private readonly CustomerDepositDao _dao1 = new CustomerDepositDao();
protected void Page_Load(object sender, EventArgs e)
{
_sl.CheckAuthentication(ViewFunctionId);
_sl.CheckSession();
var MethodName = Request.Form["MethodName"];
if (MethodName == "getListData")
PopulateData();
if (MethodName == "CheckAvialableBalance")
CheckAvialableBalance();
if (MethodName == "UnMapData")
UnMapData();
if (MethodName == "MapData")
ProceedMapData();
if (MethodName == "SaveCollMode")
SaveCollMode();
}
private void SaveCollMode()
{
var controlno = Request.Form["controlno"];
DbResult _res = new DbResult();
if (!string.IsNullOrEmpty(controlno))
{
_res = _dao1.SaveCollModeChange(GetStatic.GetUser(), controlno);
}
else
{
GetStatic.AlertMessage(this, "Please choose at least on record!");
}
Response.ContentType = "text/plain";
Response.Write(JsonConvert.SerializeObject(_res));
Response.End();
}
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 = _dao1.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;
}
}
private void CheckAvialableBalance()
{
string customerId = Request.Form["customerId"];
StringBuilder sb = new StringBuilder();
var result = _dao1.CheckAvailableBanalce(GetStatic.GetUser(), customerId);
if (result != null)
{
sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpan'> Available Bal: <label id=\"availableBal\" style=\"font-size: 14px;font-weight: 800;\">" + GetStatic.ShowDecimal(result.Rows[0]["avilableBalance"].ToString()) + " </label>&nbsp;JPY</span>");
}
else
{
sb.AppendLine("<span style='background-color: yellow; font-weight: 600;padding: 4px;' id='availableBalSpan'> Available Bal: <label id=\"availableBal\" style=\"font-size: 14px;font-weight: 800;\">Balance Not Available</label>&nbsp;JPY</span>");
}
Response.Write(sb);
Response.End();
}
protected void ProceedMapData()
{
var Ids = Request.Form["tranIds[]"];
var customerId = Request.Form["customerId"];
var mapDate = Request.Form["mapDate"];
DbResult _res = new DbResult();
if (!string.IsNullOrEmpty(Ids))
{
_res = _dao1.SaveCustomerDepositNew(GetStatic.GetUser(), Ids, customerId, mapDate);
}
else
{
GetStatic.AlertMessage(this, "Please choose at least on record!");
}
Response.ContentType = "text/plain";
Response.Write(JsonConvert.SerializeObject(_res));
Response.End();
}
protected void UnMapData()
{
var Ids = Request.Form["tranIds[]"];
var customerId = Request.Form["customerId"];
DbResult _res = new DbResult();
if (!string.IsNullOrEmpty(Ids))
{
_res = _dao1.UnMapCustomerDeposit(GetStatic.GetUser(), Ids, customerId);
}
else
{
GetStatic.AlertMessage(this, "Please choose at least on record!");
}
Response.ContentType = "text/plain";
Response.Write(JsonConvert.SerializeObject(_res));
Response.End();
}
}
}