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(); }
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_ItemDeleting(object sender, ListViewDeleteEventArgs e) { String ids = ""; Label lbl = (lvLoanInterestedRate.Items[e.ItemIndex].FindControl("lbID")) as Label; if (lbl != null) ids = lbl.Text; if (!String.IsNullOrEmpty(ids)) { StoreProRepository storeFacade = new StoreProRepository(); NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); var itm = facade.GetById(Int16.Parse(ids)); if (itm != null) { storeFacade.StoreProcessor().B_LoanInterested_Key_history_process(itm.MonthLoanRateNo, itm.VND_InterestRate, itm.USD_InterestRate, this.UserId, 3); facade.Delete(itm); facade.Commit(); LoadDataTolvLoanInterestedRate(); } } }
private void LoadDataTolvLoanInterestedRate() { NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); var db = facade.GetAll(); lvLoanInterestedRate.DataSource = db.ToList(); lvLoanInterestedRate.DataBind(); }
/// <summary> /// Vi du: ///- 2 Thang dau Lai suat 5% ///- Tu thang thu 3 Lai suat Tiet Kiem 13T + Bien do 2% /// </summary> /// <param name="ds"></param> /// <param name="normalLoanEntryM"></param> /// <param name="startDrawdownDate"></param> /// <param name="replaymentTimes"></param> /// <param name="newInterestKey"></param> private void PeriodicProcess(ref LoanContractScheduleDS ds, BNEWNORMALLOAN normalLoanEntryM, DateTime startDrawdownDate, int replaymentTimes, ref decimal newInterestKey) { if (normalLoanEntryM == null || String.IsNullOrEmpty(normalLoanEntryM.Code)) { return; } int rateType = 1; //default is Fix A/ Periodic --> Du no giam dan. (fix B is du no ban dau) rateType = String.IsNullOrEmpty(normalLoanEntryM.RateType) ? 1 : int.Parse(normalLoanEntryM.RateType); if (rateType != 3) //peridodic case { return; } NewLoanControlRepository facadeL = new NewLoanControlRepository(); BNewLoanControl it = facadeL.FindLoanControl(normalLoanEntryM.Code, replaymentTimes, "AC").FirstOrDefault(); NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); BLOANINTEREST_KEY interestKey = null; //Only process if user define AC if (it == null || it.Date == null) { return; } //if (it != null && !String.IsNullOrEmpty(it.Freq)) //{ // interestKey = facade.GetInterestKey(int.Parse(it.Freq)).FirstOrDefault(); //} //else //{ if (String.IsNullOrEmpty(normalLoanEntryM.InterestKey)) { return; } interestKey = facade.GetInterestKey(int.Parse(normalLoanEntryM.InterestKey)).FirstOrDefault(); //} if (interestKey != null) { if (normalLoanEntryM.Currency.Equals("VND")) { newInterestKey = (interestKey.VND_InterestRate == null ? 0 : (decimal)interestKey.VND_InterestRate) + (String.IsNullOrEmpty(normalLoanEntryM.IntSpread) ? 0 : Decimal.Parse(normalLoanEntryM.IntSpread)); } else if (normalLoanEntryM.Currency.Equals("USD")) { newInterestKey = (interestKey.USD_InterestRate == null ? 0 : (decimal)interestKey.USD_InterestRate) + (String.IsNullOrEmpty(normalLoanEntryM.IntSpread) ? 0 : Decimal.Parse(normalLoanEntryM.IntSpread)); } else { newInterestKey = (normalLoanEntryM.InterestRate == null ? 0 : (decimal)normalLoanEntryM.InterestRate) + (String.IsNullOrEmpty(normalLoanEntryM.IntSpread) ? 0 : Decimal.Parse(normalLoanEntryM.IntSpread)); } //DateTime newrateDate = startDrawdownDate.AddMonths((int)(interestKey.MonthLoanRateNo)); //Start date is defined date in AC DateTime newrateDate = (DateTime)it.Date; DataRow dr = findInstallmantRow(newrateDate, ds); if (dr == null) { dr = ds.DtItems.NewRow(); dr[ds.Cl_dueDate.ColumnName] = newrateDate; dr[ds.Cl_isDisbursalRow.ColumnName] = false; dr[ds.Cl_isPaymentRow.ColumnName] = false; dr[ds.Cl_isPeriodicAutomaticRow.ColumnName] = true; dr[ds.Cl_isInterestedRow.ColumnName] = false; dr[ds.Cl_principle.ColumnName] = 0; dr[ds.Cl_PrintOs.ColumnName] = 0; ds.DtItems.Rows.Add(dr); } else { dr[ds.Cl_isPeriodicAutomaticRow.ColumnName] = true; } } }
private void LoadInterestKey(string selectedid) { NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository(); var src = facade.GetAll().ToList(); Util.LoadData2RadCombo(rcbDepositeRate, src, "Id", "LoanInterest_Key", "-Select Interest Key-", true); if (!String.IsNullOrEmpty(selectedid)) { rcbDepositeRate.SelectedValue = selectedid; } }