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.
385 lines
15 KiB
385 lines
15 KiB
using Swift.API.Common;
|
|
using Swift.API.Common.Amend;
|
|
using Swift.API.ThirdPartyApiServices;
|
|
using Swift.DAL.BL.Remit.Transaction;
|
|
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.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace Swift.web.AgentNew.Utilities.ModifyRequest
|
|
{
|
|
public partial class TransactionDetail : System.Web.UI.Page
|
|
{
|
|
private const string ViewFunctionId = "40112800";
|
|
protected const string GridName = "grdPenAgntTxnModify";
|
|
private readonly ModifyTransactionDao dao = new ModifyTransactionDao();
|
|
private readonly RemittanceLibrary sl = new RemittanceLibrary();
|
|
private readonly StaticDataDdl sdd = new StaticDataDdl();
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
Authenticate();
|
|
if (!IsPostBack)
|
|
{
|
|
PopulateData();
|
|
|
|
}
|
|
GetStatic.ResizeFrame(Page);
|
|
}
|
|
|
|
private void PopulateData()
|
|
{
|
|
emailAdd.Text = sl.GetBranchEmail(GetStatic.GetBranch(), GetStatic.GetUser());
|
|
sdd.SetStaticDdl(ref txnmodifyField, "8100", "", "");
|
|
PopulateTransactionDetail();
|
|
}
|
|
|
|
private void Authenticate()
|
|
{
|
|
sl.CheckAuthentication(ViewFunctionId);
|
|
}
|
|
|
|
protected string GetControlNo()
|
|
{
|
|
return GetStatic.ReadQueryString("controlNo", "");
|
|
}
|
|
|
|
protected bool ShowCommentFlag()
|
|
{
|
|
return GetStatic.ReadQueryString("commentFlag", "Y") != "N";
|
|
}
|
|
|
|
protected bool ShowBankDetail()
|
|
{
|
|
return (GetStatic.ReadQueryString("showBankDetail", "N") == "Y");
|
|
}
|
|
|
|
private void PopulateTransactionDetail()
|
|
{
|
|
string txnId = GetStatic.ReadQueryString("tranId", "");
|
|
string cntNo = GetControlNo();
|
|
if (txnId != "" || cntNo != "")
|
|
{
|
|
ucTran.ShowCommentBlock = ShowCommentFlag();
|
|
ucTran.ShowBankDetail = ShowBankDetail();
|
|
ucTran.SearchData(txnId, cntNo, "", "", "SEARCH", "ADM: VIEW TXN (SEARCH TRANSACTION)");
|
|
|
|
if (!ucTran.TranFound)
|
|
{
|
|
GetStatic.ShowErrorMessage("Transaction Not Found");
|
|
return;
|
|
}
|
|
|
|
if (ucTran.TranStatus != "Payment")
|
|
{
|
|
GetStatic.ShowErrorMessage("Transaction not authorised for modification; Status:" + ucTran.TranStatus + "!");
|
|
return;
|
|
}
|
|
divTranDetails.Visible = ucTran.TranFound;
|
|
modtable.Visible = ucTran.TranFound;
|
|
divControlno.Visible = ucTran.TranFound;
|
|
}
|
|
}
|
|
|
|
protected void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
//AmendDataNew();
|
|
var modifyField = txnmodifyField.SelectedItem.Text;
|
|
var newValue = "";
|
|
var fieldName = "";
|
|
var fieldValue = "";
|
|
|
|
if (modifyField == "Receiver Id Type")
|
|
fieldName = "rIdType";
|
|
else if (modifyField == "Sender Id Type")
|
|
fieldName = "sIdType";
|
|
else if (modifyField == "Receiver Name")
|
|
fieldName = "receiverName";
|
|
else if (modifyField == "Sender Name")
|
|
fieldName = "senderName";
|
|
else if (modifyField == "Sender Address")
|
|
fieldName = "sAddress";
|
|
else if (modifyField == "Receiver Address")
|
|
fieldName = "rAddress";
|
|
else if (modifyField == "Receiver Contact No")
|
|
fieldName = "rContactNo";
|
|
else if (modifyField == "Sender Contact No")
|
|
fieldName = "sContactNo";
|
|
else if (modifyField == "Receiver Id No")
|
|
fieldName = "rIdNo";
|
|
else if (modifyField == "Sender Id No")
|
|
fieldName = "sIdNo";
|
|
else if (modifyField == "Payout Location")
|
|
fieldName = "pAgentLocation";
|
|
else if (modifyField == "Receiver Bank Ac No")
|
|
fieldName = "accountNo";
|
|
|
|
if (modifyField == "Sender Name" || modifyField == "Receiver Name")
|
|
{
|
|
newValue = txtFirstName.Text + " " + txtMiddleName.Text + " " + txtFirstLastName.Text + " " + txtSecondLastName.Text;
|
|
fieldValue = "'<root><row firstName = \"" + txtFirstName.Text + "\" middleName = \"" + txtMiddleName.Text + "\" firstLastName = \"" + txtFirstLastName.Text + "\" secondLastName = \"" + txtSecondLastName.Text + "\"/></root>'";
|
|
|
|
}
|
|
else if (modifyField == "Sender Id Type" || modifyField == "Receiver Id Type")
|
|
{
|
|
newValue = idType.SelectedItem.Value;
|
|
fieldValue = newValue;
|
|
}
|
|
|
|
else if (modifyField == "Payout Location")
|
|
{
|
|
newValue = idType.SelectedItem.Text;
|
|
fieldValue = idType.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
newValue = txtValue.Text;
|
|
fieldValue = newValue;
|
|
}
|
|
DataTable dt = dao.TXNReqUpdate(GetStatic.GetUser(), ucTran.CtrlNo, modifyField, newValue, fieldName, fieldValue);
|
|
if (dt.Rows[0][0].ToString() == "0")
|
|
{
|
|
var res = new DbResult();
|
|
res.Msg = dt.Rows[0][1].ToString();
|
|
GetStatic.PrintMessage(Page, res);
|
|
}
|
|
else
|
|
TXNRequestDeatil(dt);
|
|
}
|
|
|
|
private void TXNRequestDeatil(DataTable dt)
|
|
{
|
|
if (dt != null && dt.Rows.Count != 0)
|
|
{
|
|
dispRequest.Visible = true;
|
|
StringBuilder sb = new StringBuilder("");
|
|
sb.AppendLine("<table class='table' border='0' cellspacing='0' cellpadding='3'>");
|
|
sb.AppendLine("<tr><th class='frmTitle'>S.N</th><th class='frmTitle'>Comments</th><th class='frmTitle'>Delete</th></tr>");
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
sb.AppendLine("<tr><td>" + (i + 1) + "</td>");
|
|
sb.AppendLine("<td nowrap='nowrap'>" + dt.Rows[i]["message"] + "</td>");
|
|
sb.AppendLine("<td><img alt='Delete' src='../../../Images/delete.gif' onClick='Delete(" + dt.Rows[i]["rowId"] + ")' /> </td></tr>");
|
|
}
|
|
sb.AppendLine("</table>");
|
|
dispRequest.InnerHtml = sb.ToString();
|
|
return;
|
|
}
|
|
dispRequest.Visible = false;
|
|
}
|
|
|
|
protected void btnRequest_Click(object sender, EventArgs e)
|
|
{
|
|
var dbResult = dao.TXNSCchange(GetStatic.GetUser(), ucTran.CtrlNo);
|
|
ManageMessage(dbResult);
|
|
}
|
|
|
|
private void ManageMessage(DbResult dbResult)
|
|
{
|
|
if (dbResult.ErrorCode != "0")
|
|
{
|
|
GetStatic.SetMessage(dbResult);
|
|
GetStatic.AlertMessage(Page);
|
|
return;
|
|
}
|
|
Response.Redirect("Summary.aspx?controlNo=" + ucTran.CtrlNo + "&email=" + emailAdd.Text + "");
|
|
}
|
|
|
|
protected void btnDelete_Click(object sender, EventArgs e)
|
|
{
|
|
DataTable dt = dao.TXNDelete(GetStatic.GetUser(), rowid.Value, ucTran.CtrlNo);
|
|
TXNRequestDeatil(dt);
|
|
}
|
|
|
|
protected void txnmodifyField_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
ChangeTxnModifyField();
|
|
}
|
|
|
|
protected void ChangeTxnModifyField()
|
|
{
|
|
var modifyField = txnmodifyField.SelectedItem.Text;
|
|
if (modifyField == "Sender Name" || modifyField == "Receiver Name")
|
|
{
|
|
newValueLabel.Visible = false;
|
|
labelValue.Visible = false;
|
|
nameTable.Visible = true;
|
|
}
|
|
else if (modifyField == "Sender Id Type")
|
|
{
|
|
newValueLabel.Visible = true;
|
|
nameTable.Visible = false;
|
|
labelValue.Visible = false;
|
|
idType.Visible = true;
|
|
sl.SetDDL(ref idType, "EXEC proc_countryIdType @flag = 'il', @countryId='151', @spFlag = '5201'", "valueId", "detailTitle", "", "Select");
|
|
}
|
|
|
|
else if (modifyField == "Receiver Id Type")
|
|
{
|
|
newValueLabel.Visible = true;
|
|
nameTable.Visible = false;
|
|
labelValue.Visible = false;
|
|
idType.Visible = true;
|
|
sl.SetDDL(ref idType, "EXEC proc_online_dropDownList @flag='idType',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
|
|
|
|
}
|
|
else if (modifyField == "Payout Location")
|
|
{
|
|
newValueLabel.Visible = true;
|
|
nameTable.Visible = false;
|
|
labelValue.Visible = false;
|
|
idType.Visible = true;
|
|
sl.SetDDL(ref idType, "EXEC proc_apiLocation @flag='l'", "districtCode", "districtName", "", "Select");
|
|
}
|
|
else
|
|
{
|
|
newValueLabel.Visible = false;
|
|
nameTable.Visible = false;
|
|
labelValue.Visible = true;
|
|
}
|
|
txtValue.Text = "";
|
|
}
|
|
protected void AmendDataNew()
|
|
{
|
|
|
|
TxnAmendReceiver AmendedReceiverData = new TxnAmendReceiver();
|
|
TxnAmendSender AmendedSenderData = new TxnAmendSender();
|
|
var modifyField = txnmodifyField.SelectedItem.Text;
|
|
var newValue = "";
|
|
var fieldName = "";
|
|
var fieldValue = "";
|
|
|
|
if (modifyField == "Receiver Id Type")
|
|
{
|
|
fieldName = "rIdType";
|
|
AmendedReceiverData.RIdType = txtValue.Text;
|
|
}
|
|
else if (modifyField == "Sender Id Type")
|
|
{
|
|
fieldName = "sIdType";
|
|
}
|
|
else if (modifyField == "Receiver Name")
|
|
{
|
|
fieldName = "receiverName";
|
|
AmendedReceiverData.RFirstName = txtValue.Text.Split(' ')[0];
|
|
AmendedReceiverData.RLastName = txtValue.Text.Split(' ')[1];
|
|
}
|
|
else if (modifyField == "Sender Name")
|
|
{
|
|
fieldName = "senderName";
|
|
}
|
|
else if (modifyField == "Sender Address")
|
|
{
|
|
fieldName = "sAddress";
|
|
}
|
|
else if (modifyField == "Receiver Address")
|
|
{
|
|
fieldName = "rAddress";
|
|
AmendedReceiverData.RAdd1 = txtValue.Text;
|
|
}
|
|
else if (modifyField == "Receiver Contact No")
|
|
{
|
|
fieldName = "rContactNo";
|
|
AmendedReceiverData.RMobile = txtValue.Text;
|
|
}
|
|
else if (modifyField == "Sender Contact No")
|
|
{
|
|
fieldName = "sContactNo";
|
|
}
|
|
else if (modifyField == "Receiver Id No")
|
|
{
|
|
fieldName = "rIdNo";
|
|
AmendedReceiverData.RIdNo = txtValue.Text;
|
|
}
|
|
else if (modifyField == "Sender Id No")
|
|
{
|
|
fieldName = "sIdNo";
|
|
}
|
|
else if (modifyField == "Payout Location")
|
|
{
|
|
fieldName = "pAgentLocation";
|
|
}
|
|
else if (modifyField == "Receiver Bank Ac No")
|
|
{
|
|
fieldName = "accountNo";
|
|
AmendedReceiverData.RAccountNo = txtValue.Text;
|
|
}
|
|
if (modifyField == "Sender Name" || modifyField == "Receiver Name")
|
|
{
|
|
newValue = txtFirstName.Text + " " + txtMiddleName.Text + " " + txtFirstLastName.Text + " " + txtSecondLastName.Text;
|
|
fieldValue = "'<root><row firstName = \"" + txtFirstName.Text + "\" middleName = \"" + txtMiddleName.Text + "\" firstLastName = \"" + txtFirstLastName.Text + "\" secondLastName = \"" + txtSecondLastName.Text + "\"/></root>'";
|
|
|
|
}
|
|
else if (modifyField == "Sender Id Type" || modifyField == "Receiver Id Type")
|
|
{
|
|
newValue = idType.SelectedItem.Value;
|
|
fieldValue = newValue;
|
|
AmendedReceiverData.RIdType = newValue;
|
|
}
|
|
|
|
else if (modifyField == "Payout Location")
|
|
{
|
|
newValue = idType.SelectedItem.Text;
|
|
fieldValue = idType.SelectedValue;
|
|
}
|
|
else
|
|
{
|
|
newValue = txtValue.Text;
|
|
fieldValue = newValue;
|
|
}
|
|
DataTable dt = new DataTable(); ;
|
|
DbResult _dbRes = dao.GetTxnForAmendment(GetStatic.GetUser(), ucTran.CtrlNo);
|
|
if (_dbRes.Extra == "True")//isRealTime
|
|
{
|
|
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":" + _dbRes + ":statusSync";
|
|
AmendTransactionRequestService resp = new AmendTransactionRequestService();
|
|
JsonResponse _resp = resp.AmendTransactionService(new AmendTransaction()
|
|
{
|
|
ProviderId = _dbRes.Msg,
|
|
TfPinno = ucTran.CtrlNo,
|
|
ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40),
|
|
AmendReceiver = AmendedReceiverData,
|
|
AmendSender = new TxnAmendSender(),
|
|
AmendAgent = new TxnAmendAgnet(),
|
|
|
|
});
|
|
if (_resp.ResponseCode == "0")
|
|
{
|
|
dt = dao.TXNReqUpdate(GetStatic.GetUser(), ucTran.CtrlNo, modifyField, newValue, fieldName, fieldValue);
|
|
if (dt.Rows[0][0].ToString() == "0")
|
|
{
|
|
var res = new DbResult();
|
|
res.Msg = dt.Rows[0][1].ToString();
|
|
GetStatic.PrintMessage(Page, res);
|
|
}
|
|
else
|
|
TXNRequestDeatil(dt);
|
|
}
|
|
else
|
|
{
|
|
GetStatic.AlertMessage(this.Page, "error");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dt = dao.TXNReqUpdate(GetStatic.GetUser(), ucTran.CtrlNo, modifyField, newValue, fieldName, fieldValue);
|
|
if (dt.Rows[0][0].ToString() == "0")
|
|
{
|
|
var res = new DbResult();
|
|
res.Msg = dt.Rows[0][1].ToString();
|
|
GetStatic.PrintMessage(Page, res);
|
|
}
|
|
else
|
|
TXNRequestDeatil(dt);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|