using System; using Newtonsoft.Json; using Swift.DAL.BL.Remit.Transaction; using Swift.DAL.SwiftDAL; using Swift.web.Library; namespace Swift.web.Remit.Transaction.Modify { public partial class ModifyLocation : System.Web.UI.Page { private const string ViewFunctionId = "20121520"; private readonly StaticDataDdl sd = new StaticDataDdl(); private readonly ModifyTransactionDao mtd = new ModifyTransactionDao(); private readonly RemittanceLibrary _sl = new RemittanceLibrary(); protected void Page_Load(object sender, EventArgs e) { Authenticate(); if (!IsPostBack) { DisplayLabel(); lblOldValue.Text = getOldValue(); var countryId = GetStatic.ReadQueryString("pCountryId",""); if(countryId == "151") { bankBranch.Visible = false; } else { bankBranch.Visible = true; } } } private void Authenticate() { _sl.CheckAuthentication(ViewFunctionId); } private void DisplayLabel() { var countryId = GetStatic.ReadQueryString("pCountryId", ""); var user = GetStatic.GetUser(); lblFieldName.Text = GetLabel(); if (getFieldName() == "pAgentLocation")//paying agent location { sd.SetDDL(ref ddlNewValue, "EXEC proc_apiLocation @flag='l'", "districtCode", "districtName", "", "Select"); } if (getFieldName() == "accountNo")// bank account number { rptShowOther.Visible = false; rptAccountNo.Visible = true; } if (getFieldName() == "BankName")// bank & branch { showBranch.Visible = true; rptShowOther.Visible = false; sd.SetDDL(ref ddlBank, "EXEC proc_agentMaster @flag = 'bankList' ,@pCountryId = " + countryId + "", "agentId", "agentName", "", "Select"); } if (getFieldName() == "BranchName")//bank branch { string BankId = mtd.SelectBankName(GetStatic.GetUser(), GetTranId().ToString()); sd.SetDDL(ref ddlNewValue, "EXEC PROC_API_BANK_BRANCH_SETUP @flag = 'getBranch-new', @CountryId = " + countryId + " ,@PaymentMethod = '2' ,@user = " + user + " ,@bankId = " + BankId + "", "agentId", "agentName", "", "Select"); } if (getFieldName() == "pBranchName")//paying Branch { rptShowOther.Visible = false; rptAccountNo.Visible = false; rptBranch.Visible = true; } } private string GetLabel() { return GetStatic.ReadQueryString("label", ""); } private string getFieldName() { return GetStatic.ReadQueryString("fieldName", ""); } private string getOldValue() { return GetStatic.ReadQueryString("oldValue", ""); } protected long GetTranId() { return GetStatic.ReadNumericDataFromQueryString("tranId"); } private void PopulateDll() { } protected void btnUpdate_Click(object sender, EventArgs e) { OnUpdate(); } private void OnUpdate() { string newValue = ""; string pCountryId = GetStatic.ReadQueryString("pCountryId", ""); if (getFieldName() == "accountNo") newValue = txtNewValue.Text; else if (getFieldName() == "pBranchName") newValue = hdnBranchId.Value; else newValue = ddlNewValue.Text; /* if (GetStatic.GetIsApiFlag() == "Y") { if (getFieldName() == "pAgentLocation") { var ds = mtd.UpdatePayoutLocationApi(GetStatic.GetUser(), GetTranId().ToString(), newValue); if (ds == null) return; if(ds.Tables.Count > 1) { } } } * */ DbResult dbResult = mtd.UpdateTransactionPayoutLocation(GetStatic.GetUser() , GetTranId().ToString() , getFieldName() , getOldValue() , newValue , ddlBank.Text , ddlBranch.Text , GetStatic.GetIsApiFlag() , GetStatic.GetSessionId() , pCountryId ); ManageMessage(dbResult); } private void ManageMessage(DbResult dbResult) { var mes = JsonConvert.SerializeObject(dbResult); //mes = mes.Replace("
", ""); //mes = mes.Replace("
", ""); var scriptName = "CallBack"; var functionName = "CallBack('" + mes + "');"; GetStatic.CallBackJs1(Page, scriptName, functionName); } protected void ddlBank_SelectedIndexChanged(object sender, EventArgs e) { var countryId = GetStatic.ReadQueryString("pCountryId", ""); var user = GetStatic.GetUser(); if (ddlBank.Text != "") { sd.SetDDL(ref ddlBranch, "EXEC PROC_API_BANK_BRANCH_SETUP @flag = 'getBranch-new', @CountryId = " + countryId + " ,@PaymentMethod = '2' ,@user = " + user + " ,@bankId = " + ddlBank.Text + "", "agentId", "agentName", "", "Select"); //sd.SetDDL(ref ddlBranch, "EXEC proc_agentMaster @flag = 'bbl', @parentId = " + ddlBank.Text + "", "agentId", "agentName", "", "Select"); } } } }