From 19f68bece60d8515972561394a059f432de48740 Mon Sep 17 00:00:00 2001 From: Shakun Shrestha Date: Sun, 8 Sep 2024 14:46:44 +0545 Subject: [PATCH] guava pay changes [Payer setup] --- Swift.DAL/Remittance/SyncDao/BankBranchDao.cs | 10 + .../Remittance/Transaction/UpdateBranchDao.cs | 43 ++ .../TPSetup/BankAndBranchSetup/AddBank.aspx | 2 + .../BankAndBranchSetup/AddBankMapping.aspx | 2 + .../BankAndBranchSetup/AddBankPayer.aspx | 369 ++++++++++++++++++ .../BankAndBranchSetup/AddBankPayer.aspx.cs | 242 ++++++++++++ .../AddBankPayer.aspx.designer.cs | 116 ++++++ .../TPSetup/BankAndBranchSetup/AddBranch.aspx | 2 + .../TPSetup/BankAndBranchSetup/BankList.aspx | 2 + .../BankAndBranchSetup/ListBranch.aspx | 2 + .../BankAndBranchSetup/NewBankList.aspx | 1 + .../BankAndBranchSetup/PayerMappingList.aspx | 126 ++++++ .../PayerMappingList.aspx.cs | 125 ++++++ .../PayerMappingList.aspx.designer.cs | 80 ++++ Swift.web/Swift.web.csproj | 112 +----- 15 files changed, 1138 insertions(+), 96 deletions(-) create mode 100644 Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx create mode 100644 Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.cs create mode 100644 Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.designer.cs create mode 100644 Swift.web/Remit/TPSetup/BankAndBranchSetup/PayerMappingList.aspx create mode 100644 Swift.web/Remit/TPSetup/BankAndBranchSetup/PayerMappingList.aspx.cs create mode 100644 Swift.web/Remit/TPSetup/BankAndBranchSetup/PayerMappingList.aspx.designer.cs diff --git a/Swift.DAL/Remittance/SyncDao/BankBranchDao.cs b/Swift.DAL/Remittance/SyncDao/BankBranchDao.cs index 9a4925b..6d42809 100644 --- a/Swift.DAL/Remittance/SyncDao/BankBranchDao.cs +++ b/Swift.DAL/Remittance/SyncDao/BankBranchDao.cs @@ -19,6 +19,16 @@ namespace Swift.DAL.Remittance.SyncDao return ParseDbResult(sql); } + public DbResult EnableDisablePayer(string rowId, string user, string isActive) + { + var sql = "EXEC PROC_API_BANK_BRANCH_SETUP @flag = 'enable-disable-Payer'"; + + sql += ", @user = " + FilterString(user); + sql += ", @rowId = " + FilterString(rowId); + sql += ", @IsActive = " + FilterString(isActive); + + return ParseDbResult(sql); + } public DbResult EnableDisableBankBranch(string rowId, string user, string isActive) { var sql = "EXEC PROC_API_BANK_BRANCH_SETUP @flag = 'enable-disable-bankBranch'"; diff --git a/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs b/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs index a3f9040..8df20c6 100644 --- a/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs +++ b/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs @@ -102,6 +102,29 @@ namespace Swift.DAL.Remittance.Transaction return null; return ds.Tables[0]; + } + public DataTable InsertOrUpdatePayerMapping(string user, string flag, string recordId, string countryId, string parnerId, string bankId, string pMode, string payerName, string payerCode, string PbranchName, string pBranchCode, string bAddress, string isActive) + { + string sql; + sql = "EXEC Proc_UpdateBranchCode @flag = " + FilterString(flag); + sql += ", @bankId = " + FilterString(recordId); + sql += ", @payerName = " + FilterString(payerName); + sql += ", @bankName = " + FilterString(bankId); + sql += ", @pCountryName = " + FilterString(countryId); + sql += ", @payerCode = " + FilterString(payerCode); + sql += ", @branchName = " + FilterString(PbranchName); + sql += ", @branchCode = " + FilterString(pBranchCode); + sql += ", @branchAddress = " + FilterString(bAddress); + sql += ", @pMode = " + FilterString(pMode); + sql += ", @partnerId = " + FilterString(parnerId); + sql += ", @is_Active = " + FilterString(isActive); + sql += ", @user = " + FilterString(user); + + var ds = ExecuteDataset(sql); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + return null; + return ds.Tables[0]; + } public DataTable UpdateBankMapping(string user, string flag, string countryId, string parnerId, string bankId, string pMode, string bankCode1, string bankCode2, string pCurrency, string bAddress) { @@ -133,6 +156,17 @@ namespace Swift.DAL.Remittance.Transaction return null; return ds.Tables[0].Rows[0]; } + public DataRow EditPayerMappingSelectById(string bankId, string user) + { + string sql = "EXEC Proc_UpdateBranchCode"; + sql += " @flag = 'editPayerMapping'"; + sql += ", @user = " + FilterString(user); + sql += ", @bankId = " + FilterString(bankId); + DataSet ds = ExecuteDataset(sql); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + return null; + return ds.Tables[0].Rows[0]; + } public DataRow EditBankSelectById(string bankId, string user) { string sql = "EXEC Proc_UpdateBranchCode"; @@ -273,6 +307,15 @@ namespace Swift.DAL.Remittance.Transaction sql += ",@user =" + FilterString(user); return ParseDbResult(sql); } + + public DbResult DeletePayerMapping(string bankId, string user) + { + string sql = "EXEC Proc_UpdateBranchCode"; + sql += " @flag ='deletePayerMapping'"; + sql += ",@bankId =" + FilterString(bankId); + sql += ",@user =" + FilterString(user); + return ParseDbResult(sql); + } } } diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBank.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBank.aspx index c10a37a..03691b2 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBank.aspx +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBank.aspx @@ -150,6 +150,8 @@
  • Bank Mapping Setup
  • Branch List
  • Branch Setup
  • +
  • Payer Setup
  • +
  • Payer List
  • <%-- --%> <%--
  • Partner Bank List
  • --%> <%--
  • Insert Bank
  • --%> diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankMapping.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankMapping.aspx index 846ffe1..3573f2b 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankMapping.aspx +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankMapping.aspx @@ -259,6 +259,8 @@
  • Bank Mapping Setup
  • Branch List
  • Branch Setup
  • +
  • Payer Setup
  • +
  • Payer List
  • diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx new file mode 100644 index 0000000..0cf109d --- /dev/null +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx @@ -0,0 +1,369 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddBankPayer.aspx.cs" Inherits="Swift.web.Remit.TPSetup.BankAndBranchSetup.AddBankPayer" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + +
    +

    Insert Payer +

    +
    + +
    +
    +
    + + +
    + +
    + + +
    +
    +
    + +
    + + +
    +
    + + +
    + +
    + + +
    +
    +
    + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + + + + +
    +
    + + + +
    +
    + <%-- + --%> + +
    +
    + + +
    +
    +
    + + +
    +
    +
    + + \ No newline at end of file diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.cs b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.cs new file mode 100644 index 0000000..0bfd62b --- /dev/null +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.cs @@ -0,0 +1,242 @@ +using Swift.DAL.Remittance.Transaction; +using Swift.web.Library; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Web; +using System.Web.Script.Serialization; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Swift.web.Remit.TPSetup.BankAndBranchSetup +{ + public partial class AddBankPayer : System.Web.UI.Page + { + private const string ViewFunctionId = "20317000"; + //private const string UpdateFunctionId = "20317010"; + private const string AddEditFunctionId = "20300010"; + private readonly SwiftLibrary _sl = new SwiftLibrary(); + private readonly StaticDataDdl _sdd = new StaticDataDdl(); + private readonly UpdateBranchDao _rd = new UpdateBranchDao(); + protected void Page_Load(object sender, EventArgs e) + { + + if (!IsPostBack) + { + Authenticate(); + if (!IsPostBack) + { + PopulateDDL(); + PopulateDDL1(); + //PopulateDDL1(); + if (GetId() != "") + { + //Page.AsyncMode = true; + PopulateDataById(); + //PopulateDDL(); + } + } + + string reqMethod = Request.Form["MethodName"]; + if (string.IsNullOrEmpty(reqMethod)) + { + if (GetStatic.GetUser() == "") + { + Response.ContentType = "text/plain"; + Response.Write("[{\"session_end\":\"1\"}]"); + Response.End(); + return; + } + } + switch (reqMethod) + { + case "LoadPartner": + LoadPartner(); + break; + case "LoadBank": + LoadBank(); + break; + + //case "LoadBankBranch": + // LoadBankBranch(); + // break; + case "InsertPayer": + InsertOrUpdatePayerMapping(); + break; + case "UpdatePayer": + InsertOrUpdatePayerMapping(); + break; + + + } + } + } + private void Authenticate() + { + _sl.CheckAuthentication(ViewFunctionId); + if (!_sl.HasRight(AddEditFunctionId)) + { + //btnSave.Enabled = false; + //btnSave.Visible = false; + } + } + + protected void PopulateDDL() + { + //_sdd.SetDDL(ref countryDDL, "EXEC [proc_dropDownLists] @flag='r-country-list'", "countryId", "countryName", "", "Select Country"); + _sdd.SetDDL(ref countryDDL, "EXEC [proc_dropDownLists] @flag='r-country-list'", "countryId", "countryName", "", "Select Country"); + //_sdd.SetDDL(ref BranchDDl, "EXEC [proc_dropDownLists] @flag='branch-list'", "agentId", "agentName", "", "All"); + } + protected void PopulateDDL1() + { + _sdd.SetDDL(ref paymentModeDDL1, "EXEC [proc_dropDownLists] @flag='paymentModelist'", "serviceTypeId", "typeTitle", "", "Select Pmode"); + } + private void LoadPartner() + { + var countryId = Request.Form["countryId"]; + DataTable dt = null; + + dt = _rd.LoadPartner(GetStatic.GetCountryId(), countryId, null, "getPartnerByCountry", GetStatic.GetUser()); + Response.ContentType = "text/plain"; + var json = DataTableToJson(dt); + Response.Write(json); + Response.End(); + } + + private void LoadBank() + { + var partnerId = Request.Form["partnerId"]; + var countryId = Request.Form["countryId"]; + DataTable dt = null; + + dt = _rd.LoadBank(GetStatic.GetCountryId(), countryId, null, partnerId, "getBankByPartner", GetStatic.GetUser()); + Response.ContentType = "text/plain"; + var json = DataTableToJson(dt); + Response.Write(json); + Response.End(); + } + + private void InsertOrUpdatePayerMapping() + { + var countryId = Request.Form["countryId"]; + var partnerId = Request.Form["partnerId"]; + var bankId = Request.Form["bankId"].ToUpper(); + var pMode = Request.Form["paymentMode"]; + var payerName = Request.Form["payerName"]; + var payerCode = Request.Form["payerCode"]; + var pBranchName = Request.Form["pBranchName"]; + var pBranchCode = Request.Form["pBranchCode"]; + var bAddress = Request.Form["bAddress"]; + var isActive = Request.Form["isActive"]; + + + //string methodName; + string flag; + //string recordId = GetId(); + + if (!string.IsNullOrEmpty(GetId())) + { + + //methodName = "UpdateBank"; + flag = "updatePayerMapping"; + } + else + { + + //methodName = "InsertBank"; + flag = "insertBankPayer"; + } + + DataTable dt = _rd.InsertOrUpdatePayerMapping(GetStatic.GetUser(), flag, GetId(), countryId, partnerId, bankId, pMode, payerName, payerCode, pBranchName, pBranchCode, bAddress, isActive); + Response.ContentType = "text/plain"; + var json = DataTableToJson(dt); + Response.Write(json); + Response.End(); + } + + + protected string GetId() + { + return GetStatic.ReadQueryString("PAYER_ID", ""); + } + private void PopulateDataById() + { + DataRow dr = _rd.EditPayerMappingSelectById(GetId(), GetStatic.GetUser()); + if (dr == null) + { + Response.Redirect("PayerMappingList.aspx"); + } + + + countryDDL.SelectedValue = dr["BANK_COUNTRY"].ToString(); + partnerDDL.SelectedValue = dr["PARTNER_ID"].ToString(); + bankDDL.SelectedValue = dr["BANK_ID"].ToString(); + paymentModeDDL1.SelectedValue = dr["PAYMENT_MODE"].ToString(); + payerName.Text = dr["PAYER_NAME"].ToString(); + payerCode.Text = dr["PAYER_Code"].ToString(); + pBranchName.Text = dr["PAYER_BRANCH_NAME"].ToString(); + pBranchCode.Text = dr["PAYER_BRANCH_CODE"].ToString(); + bAddress.Text = dr["BRANCH_ADDRESS"].ToString(); + isActiveDDL.SelectedValue = (dr["IS_ACTIVE"].ToString() == "True" || dr["IS_ACTIVE"].ToString() == "1") ? "1" : "0"; + + } + + + public string GetPartnerNameById(string partnerId) + { + DataTable result = _rd.GetPartnerName(partnerId); + + + if (result != null && result.Rows.Count > 0) + { + + string agentName = result.Rows[0]["AGENTNAME"].ToString(); + return agentName; + } + else + { + + return string.Empty; + } + } + + public string GetBankNameId(string bankn) + { + DataTable result = _rd.GetMasterID(bankn); + + if (result != null && result.Rows.Count > 0) + { + string bankId = result.Rows[0]["PAYER_ID"].ToString(); + + return (bankId); + } + else + { + return string.Empty; + } + } + + + public static string DataTableToJson(DataTable table) + { + if (table == null) + return ""; + var list = new List>(); + + foreach (DataRow row in table.Rows) + { + var dict = new Dictionary(); + + foreach (DataColumn col in table.Columns) + { + dict[col.ColumnName] = string.IsNullOrEmpty(row[col].ToString()) ? "" : row[col]; + } + list.Add(dict); + } + var serializer = new JavaScriptSerializer(); + string json = serializer.Serialize(list); + return json; + } + } +} \ No newline at end of file diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.designer.cs b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.designer.cs new file mode 100644 index 0000000..7ad9107 --- /dev/null +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBankPayer.aspx.designer.cs @@ -0,0 +1,116 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Swift.web.Remit.TPSetup.BankAndBranchSetup +{ + + + public partial class AddBankPayer + { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// countryDDL control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList countryDDL; + + /// + /// partnerDDL control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList partnerDDL; + + /// + /// bankDDL control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList bankDDL; + + /// + /// paymentModeDDL1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList paymentModeDDL1; + + /// + /// payerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox payerName; + + /// + /// payerCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox payerCode; + + /// + /// pBranchName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox pBranchName; + + /// + /// pBranchCode control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox pBranchCode; + + /// + /// bAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox bAddress; + + /// + /// isActiveDDL control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList isActiveDDL; + } +} diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBranch.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBranch.aspx index 72dbeb4..5ab42c1 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBranch.aspx +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/AddBranch.aspx @@ -261,6 +261,8 @@
  • Bank Mapping Setup
  • Branch List
  • Branch Setup
  • +
  • Payer Setup
  • +
  • Payer List
  • <%----%> <%--
  • Partner Bank List
  • --%> diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx index 76bca2b..c57faff 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx @@ -86,6 +86,8 @@
  • Bank Mapping Setup
  • Branch List
  • Branch Setup
  • +
  • Payer Setup
  • +
  • Payer List
  • <%-- diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx index f8d8d4a..76f1930 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx @@ -86,6 +86,8 @@
  • Bank Mapping Setup
  • Branch List
  • Branch Setup
  • +
  • Payer Setup
  • +
  • Payer List
  • <%-- diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx index 8bf877e..29759cc 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx @@ -88,6 +88,7 @@
  • Bank Mapping Setup
  • Branch List
  • Branch Setup
  • +
  • Payer Setup
  • <%-- diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/PayerMappingList.aspx b/Swift.web/Remit/TPSetup/BankAndBranchSetup/PayerMappingList.aspx new file mode 100644 index 0000000..e5ac767 --- /dev/null +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/PayerMappingList.aspx @@ -0,0 +1,126 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PayerMappingList.aspx.cs" Inherits="Swift.web.Remit.TPSetup.BankAndBranchSetup.PayerMappingList" %> + + + + + + + + + + + + + + + + + + +
    + + +