/// <summary> /// to get the BankDetails() /// </summary> private void GetBankDetails() { PAP_BankBO objPAPBank = new PAP_BankBO(); objPAPBank = (new PAP_BankBLL()).GetPAPBankByID(Convert.ToInt32(Session["HH_ID"])); if (objPAPBank != null) { chkHasBankAccount.Checked = true; btnSaveBank.ValidationGroup = "Bank"; txtAccountNo.Text = objPAPBank.AccountNo; txtAccountName.Text = objPAPBank.AccountHolderName; ddlBank.ClearSelection(); if (ddlBank.Items.FindByValue(objPAPBank.BankID.ToString()) != null) { ddlBank.Items.FindByValue(objPAPBank.BankID.ToString()).Selected = true; } BindBankBranches(Convert.ToInt32(ddlBank.SelectedItem.Value)); ddlBranch.ClearSelection(); if (ddlBranch.Items.FindByValue(objPAPBank.BranchID.ToString()) != null) { ddlBranch.Items.FindByValue(objPAPBank.BranchID.ToString()).Selected = true; } EnableBankDetails(true); } else { chkHasBankAccount.Checked = false; btnSaveBank.ValidationGroup = ""; EnableBankDetails(false); } }
/// <summary> /// to save the Bank Details to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveBank_Click(object sender, EventArgs e) { if (chkHasBankAccount.Checked) { PAP_BankBO objPAPBank = new PAP_BankBO(); objPAPBank.HouseHoldID = Convert.ToInt32(Session["HH_ID"]); objPAPBank.BankID = Convert.ToInt32(ddlBank.SelectedItem.Value); objPAPBank.BranchID = Convert.ToInt32(ddlBranch.SelectedItem.Value); objPAPBank.AccountNo = txtAccountNo.Text.Trim(); objPAPBank.AccountHolderName = txtAccountName.Text.Trim(); objPAPBank.CreatedBy = Convert.ToInt32(Session["USER_ID"]); objPAPBank.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); (new PAP_BankBLL()).UpdatePAPBank(objPAPBank); } else { (new PAP_BankBLL()).DeletePAPBank(Convert.ToInt32(Session["HH_ID"])); } ChangeRequestStatusBank(); projectFrozen(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "UpdatedBank", "alert('Data saved successfully');", true); }
/// <summary> /// To Get PAP Bank By ID /// </summary> /// <param name="householdID"></param> /// <returns></returns> public PAP_BankBO GetPAPBankByID(int householdID) { proc = "USP_TRN_GET_PAPBANKBYID"; cnn = new OracleConnection(con); PAP_BankBO objPAPBank = null; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("HOUSEHOLDID_", householdID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; try { cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { objPAPBank = new PAP_BankBO(); if (!dr.IsDBNull(dr.GetOrdinal("BANKDETAILID"))) { objPAPBank.BankDetailID = dr.GetInt32(dr.GetOrdinal("BANKDETAILID")); } if (!dr.IsDBNull(dr.GetOrdinal("HHID"))) { objPAPBank.HouseHoldID = dr.GetInt32(dr.GetOrdinal("HHID")); } if (!dr.IsDBNull(dr.GetOrdinal("BANKID"))) { objPAPBank.BankID = dr.GetInt32(dr.GetOrdinal("BANKID")); } if (!dr.IsDBNull(dr.GetOrdinal("BRANCHID"))) { objPAPBank.BranchID = dr.GetInt32(dr.GetOrdinal("BRANCHID")); } if (!dr.IsDBNull(dr.GetOrdinal("ACCOUNTNO"))) { objPAPBank.AccountNo = dr.GetString(dr.GetOrdinal("ACCOUNTNO")); } if (!dr.IsDBNull(dr.GetOrdinal("ACCOUNTHOLDERNAME"))) { objPAPBank.AccountHolderName = dr.GetString(dr.GetOrdinal("ACCOUNTHOLDERNAME")); } } dr.Close(); } catch (Exception ex) { throw ex; } return(objPAPBank); }
/// <summary> /// To Update PAP Bank /// </summary> /// <param name="objPAPBank"></param> public void UpdatePAPBank(PAP_BankBO objPAPBank) { cnn = new OracleConnection(con); proc = "USP_TRN_UPD_PAPBANK"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.Parameters.Add("BANKDETAILID_", objPAPBank.BankDetailID); cmd.Parameters.Add("HOUSEHOLDID_", objPAPBank.HouseHoldID); cmd.Parameters.Add("BANKID_", objPAPBank.BankID); cmd.Parameters.Add("BRANCH_", objPAPBank.BranchID); cmd.Parameters.Add("ACCOUNTNO_", objPAPBank.AccountNo); cmd.Parameters.Add("ACCOUNTHOLDERNAME_", objPAPBank.AccountHolderName); cmd.Parameters.Add("CREATEDBY_", objPAPBank.CreatedBy); cmd.Parameters.Add("UPDATEDBY_", objPAPBank.UpdatedBy); cmd.ExecuteNonQuery(); cmd.Connection.Close(); }
/// <summary> /// To Update PAP Bank /// </summary> /// <param name="objPAPBank"></param> public void UpdatePAPBank(PAP_BankBO objPAPBank) { (new PAP_BankDAL()).UpdatePAPBank(objPAPBank); }