From f529514a873192eedbc043124e7f8d10a237010f Mon Sep 17 00:00:00 2001 From: Dinesh Date: Thu, 21 Mar 2024 11:32:42 +0545 Subject: [PATCH] #26613 delete function --- .../Remittance/Transaction/UpdateBranchDao.cs | 42 +++++++++++++++++-- .../BankAndBranchSetup/BankList.aspx.cs | 23 ++++++++++ .../BankAndBranchSetup/ListBranch.aspx.cs | 24 ++++++++++- .../BankAndBranchSetup/NewBankList.aspx.cs | 23 ++++++++++ 4 files changed, 107 insertions(+), 5 deletions(-) diff --git a/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs b/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs index baa7322..a827de7 100644 --- a/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs +++ b/Swift.DAL/Remittance/Transaction/UpdateBranchDao.cs @@ -253,11 +253,45 @@ namespace Swift.DAL.Remittance.Transaction return ParseDbResult(sql); } - public DbResult Delete(string user, string rowId) + //public DbResult Delete(string user, string rowId) + //{ + // var sql = "EXEC PROC_REFERALSETUP @flag = 'delete'"; + // sql += ", @user = " + FilterString(user); + // sql += ", @rowId = " + FilterString(rowId); + // return ParseDbResult(sql); + //} + + //public DbResult Delete(string acct_id, string user) + //{ + // string sql = "EXEC PROC_API_BANK_BRANCH_SETUP"; + // sql += " @flag ='delete'"; + // sql += ", @bankId" + FilterString(acct_id); + // sql += ", @user=" + FilterString(user); + // return ParseDbResult(ExecuteDataset(sql).Tables[0]); + //} + + public DbResult DeleteBankMapping(string bankId, string user) { - var sql = "EXEC PROC_REFERALSETUP @flag = 'delete'"; - sql += ", @user = " + FilterString(user); - sql += ", @rowId = " + FilterString(rowId); + string sql = "EXEC Proc_UpdateBranchCode"; + sql += " @flag ='deleteBankMapping'"; + sql += ",@bankId =" + FilterString(bankId); + sql += ",@user =" + FilterString(user); + return ParseDbResult(sql); + } + public DbResult DeleteBank(string bankId, string user) + { + string sql = "EXEC Proc_UpdateBranchCode"; + sql += " @flag ='deleteBank'"; + sql += ",@bankId =" + FilterString(bankId); + sql += ",@user =" + FilterString(user); + return ParseDbResult(sql); + } + public DbResult DeleteBranch(string branchId, string user) + { + string sql = "EXEC Proc_UpdateBranchCode"; + sql += " @flag ='deleteBranch'"; + sql += ",@bankId =" + FilterString(branchId); + sql += ",@user =" + FilterString(user); return ParseDbResult(sql); } diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx.cs b/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx.cs index da639d6..69078a8 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx.cs +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/BankList.aspx.cs @@ -1,9 +1,11 @@ using Swift.DAL.Remittance.SyncDao; +using Swift.DAL.Remittance.Transaction; using Swift.web.Component.Grid; using Swift.web.Component.Grid.gridHelper; using Swift.web.Library; using System; using System.Collections.Generic; +using System.Web; using System.Web.UI; namespace Swift.web.Remit.TPSetup.BankAndBranchSetup @@ -15,6 +17,7 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup private const string AddEditFunctionId = "20300010"; private readonly SwiftGrid _grid = new SwiftGrid(); private readonly RemittanceLibrary swiftLibrary = new RemittanceLibrary(); + private readonly UpdateBranchDao _branchDoa = new UpdateBranchDao(); protected void Page_Load(object sender, EventArgs e) { @@ -24,6 +27,7 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup GetStatic.PrintMessage(Page); } LoadGrid(); + DeleteRow(); } private void Authenticate() @@ -87,6 +91,25 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup rpt_grid.InnerHtml = _grid.CreateGrid(sql); } + private void DeleteRow() + { + string id = _grid.GetCurrentRowId(GridName); + + if (id == "") + return; + var user = GetStatic.GetUser(); + var dbResult = _branchDoa.DeleteBankMapping(id, user); + if (dbResult.ErrorCode == "0") + { + LoadGrid(); + GetStatic.AlertMessage(this, dbResult.Msg); + } + else + { + HttpContext.Current.Session["message"] = dbResult; + GetStatic.AlertMessage(this, dbResult.Msg); + } + } protected void btnUpdate_Click(object sender, EventArgs e) { BankBranchDao _dao = new BankBranchDao(); diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx.cs b/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx.cs index 6bbbb2e..6fdcbfc 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx.cs +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/ListBranch.aspx.cs @@ -31,6 +31,7 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup } LoadGrid(); + DeleteRow(); } private void Authenticate() { @@ -89,12 +90,33 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup rpt_grid.InnerHtml = _grid.CreateGrid(sql); } - + + private void DeleteRow() + { + string id = _grid.GetCurrentRowId(GridName); + + if (id == "") + return; + var user = GetStatic.GetUser(); + var dbResult = _branchDoa.DeleteBranch(id, user); + if (dbResult.ErrorCode == "0") + { + LoadGrid(); + GetStatic.AlertMessage(this, dbResult.Msg); + } + else + { + HttpContext.Current.Session["message"] = dbResult; + GetStatic.AlertMessage(this, dbResult.Msg); + } + } private string GetBankId() { return GetStatic.ReadQueryString("bankId", ""); } + + protected void btnUpdate_Click(object sender, EventArgs e) { diff --git a/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx.cs b/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx.cs index eb97cb2..aab8a60 100644 --- a/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx.cs +++ b/Swift.web/Remit/TPSetup/BankAndBranchSetup/NewBankList.aspx.cs @@ -18,6 +18,7 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup private const string AddEditFunctionId = "20300010"; private readonly SwiftGrid _grid = new SwiftGrid(); private readonly RemittanceLibrary swiftLibrary = new RemittanceLibrary(); + private readonly UpdateBranchDao _branchDoa = new UpdateBranchDao(); protected void Page_Load(object sender, EventArgs e) { Authenticate(); @@ -26,6 +27,7 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup GetStatic.PrintMessage(Page); } LoadGrid(); + DeleteRow(); } private void Authenticate() @@ -84,6 +86,27 @@ namespace Swift.web.Remit.TPSetup.BankAndBranchSetup rpt_grid.InnerHtml = _grid.CreateGrid(sql); } + + + private void DeleteRow() + { + string id = _grid.GetCurrentRowId(GridName); + + if (id == "") + return; + var user = GetStatic.GetUser(); + var dbResult = _branchDoa.DeleteBank(id, user); + if (dbResult.ErrorCode == "0") + { + LoadGrid(); + GetStatic.AlertMessage(this, dbResult.Msg); + } + else + { + HttpContext.Current.Session["message"] = dbResult; + GetStatic.AlertMessage(this, dbResult.Msg); + } + } protected void btnUpdate_Click(object sender, EventArgs e) { UpdateBranchDao _dao = new UpdateBranchDao();