protected void lvLoanInterestedRate_ItemInserting(object sender, ListViewInsertEventArgs e) { NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); StoreProRepository storeFacade = new StoreProRepository(); RadNumericTextBox monthRate = (lvLoanInterestedRate.InsertItem.FindControl("radMonthRate")) as RadNumericTextBox; TextBox rateDisplay = (lvLoanInterestedRate.InsertItem.FindControl("tbRateDisplay")) as TextBox; RadNumericTextBox rnbVNDRate = (lvLoanInterestedRate.InsertItem.FindControl("rnbVNDRate")) as RadNumericTextBox; RadNumericTextBox rnbUSDRate = (lvLoanInterestedRate.InsertItem.FindControl("rnbUSDRate")) as RadNumericTextBox; if ((Int16)monthRate.Value <= 0) { RadWindowManager1.RadAlert("Deposite Rate is required!", 340, 150, "Alert", null); return; } BLOANINTEREST_KEY intKey = new BLOANINTEREST_KEY(); intKey.MonthLoanRateNo = (Int16)monthRate.Value; intKey.USD_InterestRate = (decimal)rnbUSDRate.Value; intKey.VND_InterestRate = (decimal)rnbVNDRate.Value; intKey.LoanInterest_Key = rateDisplay.Text; intKey.Id = (Int16)monthRate.Value; storeFacade.StoreProcessor().B_LoanInterested_Key_history_process(intKey.MonthLoanRateNo, intKey.VND_InterestRate, intKey.USD_InterestRate, this.UserId, 1); facade.Add(intKey); facade.Commit(); LoadDataTolvLoanInterestedRate(); }
protected void lvLoanInterestedRate_ItemUpdating(object sender, ListViewUpdateEventArgs e) { NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); StoreProRepository storeFacade = new StoreProRepository(); RadNumericTextBox monthRate = (lvLoanInterestedRate.EditItem.FindControl("radMonthRate")) as RadNumericTextBox; TextBox rateDisplay = (lvLoanInterestedRate.EditItem.FindControl("tbRateDisplay")) as TextBox; RadNumericTextBox rnbVNDRate = (lvLoanInterestedRate.EditItem.FindControl("rnbVNDRate")) as RadNumericTextBox; RadNumericTextBox rnbUSDRate = (lvLoanInterestedRate.EditItem.FindControl("rnbUSDRate")) as RadNumericTextBox; Label lbl = (lvLoanInterestedRate.Items[e.ItemIndex].FindControl("lbID")) as Label; String ids = ""; if (lbl != null) ids = lbl.Text; BLOANINTEREST_KEY intKey = new BLOANINTEREST_KEY(); intKey.MonthLoanRateNo = (Int16)monthRate.Value; intKey.USD_InterestRate = (decimal)rnbUSDRate.Value; intKey.VND_InterestRate = (decimal)rnbVNDRate.Value; intKey.LoanInterest_Key = rateDisplay.Text; intKey.Id = Int32.Parse(ids); BLOANINTEREST_KEY exits = facade.GetById(intKey.Id); if (exits != null) { storeFacade.StoreProcessor().B_LoanInterested_Key_history_process(intKey.MonthLoanRateNo, intKey.VND_InterestRate, intKey.USD_InterestRate, this.UserId, 2); facade.Update(facade.GetById(intKey.Id), intKey); facade.Commit(); } lvLoanInterestedRate.EditIndex = -1; LoadDataTolvLoanInterestedRate(); }