protected void btnUpdate_Click(object sender, EventArgs e) { ACC_BankAccount aCC_BankAccount = new ACC_BankAccount (); aCC_BankAccount.BankAcountID= int.Parse(Request.QueryString["ID"].ToString()); aCC_BankAccount.BankAccountName= txtBankAccountName.Text; aCC_BankAccount.AccountNo= txtAccountNo.Text; aCC_BankAccount.BankID= int.Parse(ddlBankID.SelectedValue); aCC_BankAccount.BranchNOtherDetails= txtBranchNOtherDetails.Text; aCC_BankAccount.ExtraField1= txtExtraField1.Text; aCC_BankAccount.ExtraField2= txtExtraField2.Text; aCC_BankAccount.ExtraField3= txtExtraField3.Text; aCC_BankAccount.ExtraField4= txtExtraField4.Text; aCC_BankAccount.ExtraField5= txtExtraField5.Text; aCC_BankAccount.AddedBy= Profile.card_id; aCC_BankAccount.AddedDate= DateTime.Now; aCC_BankAccount.UpdatedBy= Profile.card_id; aCC_BankAccount.UpdateDate= DateTime.Now; aCC_BankAccount.RowStatusID= int.Parse(ddlRowStatusID.SelectedValue); bool resutl =ACC_BankAccountManager.UpdateACC_BankAccount(aCC_BankAccount); Response.Redirect("AdminDisplayACC_BankAccount.aspx"); }
public ACC_BankAccount GetACC_BankAccountFromReader(IDataReader reader) { try { ACC_BankAccount aCC_BankAccount = new ACC_BankAccount ( DataAccessObject.IsNULL<int>(reader["BankAcountID"]), DataAccessObject.IsNULL<string>(reader["BankAccountName"]), DataAccessObject.IsNULL<string>(reader["AccountNo"]), DataAccessObject.IsNULL<int>(reader["BankID"]), DataAccessObject.IsNULL<string>(reader["BranchNOtherDetails"]), DataAccessObject.IsNULL<string>(reader["ExtraField1"]), DataAccessObject.IsNULL<string>(reader["ExtraField2"]), DataAccessObject.IsNULL<string>(reader["ExtraField3"]), DataAccessObject.IsNULL<string>(reader["ExtraField4"]), DataAccessObject.IsNULL<string>(reader["ExtraField5"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]), DataAccessObject.IsNULL<int>(reader["RowStatusID"]) ); return aCC_BankAccount; } catch(Exception ex) { return null; } }
public bool UpdateACC_BankAccount(ACC_BankAccount aCC_BankAccount) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateACC_BankAccount", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@BankAcountID", SqlDbType.Int).Value = aCC_BankAccount.BankAcountID; cmd.Parameters.Add("@BankAccountName", SqlDbType.NVarChar).Value = aCC_BankAccount.BankAccountName; cmd.Parameters.Add("@AccountNo", SqlDbType.NVarChar).Value = aCC_BankAccount.AccountNo; cmd.Parameters.Add("@BankID", SqlDbType.Int).Value = aCC_BankAccount.BankID; cmd.Parameters.Add("@BranchNOtherDetails", SqlDbType.NText).Value = aCC_BankAccount.BranchNOtherDetails; cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = aCC_BankAccount.ExtraField1; cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = aCC_BankAccount.ExtraField2; cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = aCC_BankAccount.ExtraField3; cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = aCC_BankAccount.ExtraField4; cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = aCC_BankAccount.ExtraField5; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = aCC_BankAccount.UpdatedBy; cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = aCC_BankAccount.UpdateDate; cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = aCC_BankAccount.RowStatusID; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
private void showACC_BankAccountData() { ACC_BankAccount aCC_BankAccount = new ACC_BankAccount (); aCC_BankAccount = ACC_BankAccountManager.GetACC_BankAccountByBankAcountID(Int32.Parse(Request.QueryString["ID"])); txtBankAccountName.Text =aCC_BankAccount.BankAccountName.ToString(); txtAccountNo.Text =aCC_BankAccount.AccountNo.ToString(); ddlBankID.SelectedValue =aCC_BankAccount.BankID.ToString(); txtBranchNOtherDetails.Text =aCC_BankAccount.BranchNOtherDetails.ToString(); txtExtraField1.Text =aCC_BankAccount.ExtraField1.ToString(); txtExtraField2.Text =aCC_BankAccount.ExtraField2.ToString(); txtExtraField3.Text =aCC_BankAccount.ExtraField3.ToString(); txtExtraField4.Text =aCC_BankAccount.ExtraField4.ToString(); txtExtraField5.Text =aCC_BankAccount.ExtraField5.ToString(); ddlRowStatusID.SelectedValue =aCC_BankAccount.RowStatusID.ToString(); }