protected void applybtn_Click(object sender, EventArgs e) { User usr = new User(); ApplyDeposit ad = new ApplyDeposit(); ad.AccountNumber = Constants.AccountNumber; ad.DepositAmount = DepositAmounttxt.Text; ad.Duration = Durationtxt.Text; usr.applyDeposit(ad); Response.Write(Constants.DepositAppliedAlert); ClearControl(this); }
public void applyDeposit(ApplyDeposit ad) { SqlConnection con = new SqlConnection(); try { con.ConnectionString = Constants.connectionString; con.Open(); SqlCommand cmd = new SqlCommand("applyDeposit", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@accountNumber", ad.AccountNumber); cmd.Parameters.AddWithValue("@Amount", ad.DepositAmount); cmd.Parameters.AddWithValue("@duration", ad.Duration); cmd.ExecuteNonQuery(); } finally { con.Close(); } }