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.
228 lines
8.5 KiB
228 lines
8.5 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.Remit.Transaction.ModifyRequest
|
|
{
|
|
public partial class TransactionDetail : System.Web.UI.Page
|
|
{
|
|
private const string ViewFunctionId = "90300000";
|
|
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;
|
|
if (ucTran.PSuperAgent == "394428")
|
|
{
|
|
txnmodifyField.Visible = false;
|
|
txnReceiver.Visible = true;
|
|
nameTable.Visible = true;
|
|
btnAdd.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
txnmodifyField.Visible = true;
|
|
txnReceiver.Visible = false;
|
|
btnAdd.Visible = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
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)
|
|
{
|
|
AmendDataNew();
|
|
}
|
|
|
|
private void ManageMessage(DbResult dbResult)
|
|
{
|
|
if (dbResult.ErrorCode != "0")
|
|
{
|
|
GetStatic.SetMessage(dbResult);
|
|
GetStatic.AlertMessage(Page);
|
|
return;
|
|
}
|
|
Response.Redirect("search.aspx?controlNo=" + ucTran.CtrlNo );
|
|
}
|
|
|
|
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)
|
|
{
|
|
|
|
}
|
|
|
|
private void PrintMessage(string msg)
|
|
{
|
|
GetStatic.CallBackJs1(Page, "Result", "alert('" + msg + "')");
|
|
}
|
|
protected void AmendDataNew()
|
|
{
|
|
|
|
TxnAmendReceiver AmendedReceiverData = new TxnAmendReceiver() { RFirstName = txtFirstName.Text.Trim(), RMiddleName= txtMiddleName.Text.Trim(), RLastName = txtFirstLastName.Text.Trim() };
|
|
TxnAmendSender AmendedSenderData = new TxnAmendSender();
|
|
|
|
DataTable dt = new DataTable(); ;
|
|
DbResult _dbRes = dao.GetTxnForAmendmentApi(GetStatic.GetUser(), ucTran.CtrlNo);
|
|
|
|
if (_dbRes.Msg.Equals("394428")) //cebauna
|
|
{
|
|
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":" + _dbRes.Msg + ":AmendApi";
|
|
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(),
|
|
Reason= ModifyReason.Text.Trim()
|
|
|
|
});
|
|
UcTranDao _obj = new UcTranDao();
|
|
_obj.AddComment(GetStatic.GetUser(), ucTran.CtrlNo, ucTran.TranNo, $"{_dbRes.Extra2} - {_resp.Msg}");
|
|
|
|
if (_resp.ResponseCode == "0")
|
|
{
|
|
//dt = dao.TXNReqUpdate(GetStatic.GetUser(), ucTran.CtrlNo, modifyField, newValue, fieldName, fieldValue);
|
|
DbResult dbResult = dao.UpdateTransaction(GetStatic.GetUser()
|
|
, ucTran.TranNo
|
|
, "receiverName"
|
|
, _dbRes.Extra1
|
|
, null
|
|
, null
|
|
, txtFirstName.Text
|
|
, txtMiddleName.Text
|
|
, txtFirstLastName.Text
|
|
, null
|
|
, null
|
|
, ""
|
|
, GetStatic.GetSessionId()
|
|
);
|
|
|
|
if (dbResult.ErrorCode == "0")
|
|
{
|
|
|
|
string mes = GetStatic.ParseResultJsPrint(dbResult);
|
|
|
|
string scriptName = "CallBack";
|
|
string functionName = "CallBack('" + mes + "','" + "Search.aspx" + "')";
|
|
GetStatic.CallBackJs1(Page, scriptName, functionName);
|
|
}
|
|
else
|
|
{
|
|
PrintMessage($"{_dbRes.Extra2} error - {dbResult.Msg}");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
PrintMessage($"{_dbRes.Extra2} amend api error - {_resp.Msg}");
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|