public void UpdateLoanScaleTableInstance() { using (SqlConnection conn = _loanScaleManager.GetConnection()) using (SqlTransaction sqlTransac = conn.BeginTransaction()) { LoanScaleTable lT = LoanScaleTable.GetInstance(_user); try { _loanScaleManager.Delete(sqlTransac); int i = 1; foreach (LoanScaleRate lR in lT.LoanScaleRates) { lR.Number = i; _loanScaleManager.InsertLoanScale(lR, sqlTransac); i++; } sqlTransac.Commit(); } catch (Exception ex) { sqlTransac.Rollback(); throw ex; } } }
public void AddLoanScale(LoanScaleRate lR) { LoanScaleTable lT = LoanScaleTable.GetInstance(_user); if (lR.ScaleMin == 0) { throw new OpenCbsAccountException(OpenCbsAccountExceptionsEnum.LoanScaleTableMin); } if (lR.ScaleMax == 0) { throw new OpenCbsAccountException(OpenCbsAccountExceptionsEnum.LoanScaleTableMax); } lR.Number = lT.LoanScaleRates.Count + 1; lT.AddLoanScaleRate(lR); using (SqlConnection conn = _loanScaleManager.GetConnection()) using (SqlTransaction sqlTransac = conn.BeginTransaction()) { try { _loanScaleManager.InsertLoanScale(lR, sqlTransac); sqlTransac.Commit(); } catch (Exception ex) { sqlTransac.Rollback(); throw ex; } } }
public void SelectLoanScale() { LoanScaleTable loanscaleTable = LoanScaleTable.GetInstance(_user); string sqlText = "Select id, ScaleMin, ScaleMax FROM LoanScale"; SqlCommand select = new SqlCommand(sqlText, CurrentConnection); using (SqlDataReader reader = select.ExecuteReader()) { while (reader.Read()) { LoanScaleRate lR = new LoanScaleRate(); lR.Number = DatabaseHelper.GetInt32("id", reader); lR.ScaleMin = DatabaseHelper.GetInt32("ScaleMin", reader); lR.ScaleMax = DatabaseHelper.GetInt32("ScaleMax", reader); loanscaleTable.AddLoanScaleRate(lR); } } }
public void SelectLoanScales() { LoanScaleTable loanscaleTable = LoanScaleTable.GetInstance(_user); const string sqlText = @"SELECT id, ScaleMin, ScaleMax FROM LoanScale"; using (SqlConnection conn = GetConnection()) { using (OpenCbsCommand select = new OpenCbsCommand(sqlText, conn)) { using (OpenCbsReader reader = select.ExecuteReader()) { if (reader.Empty) { return; } while (reader.Read()) { loanscaleTable.AddLoanScaleRate(GetLoanScale(reader)); } } } } }
public void CheckGeneralSettings() { ProvisionTable.GetInstance(_user).ProvisioningRates = _provisionningRuleManager.SelectAllProvisioningRates(); LoanScaleTable.GetInstance(_user).LoanScaleRates = new ArrayList(); _loanScaleManager.SelectLoanScales(); }
public void DeleteLoanScale(LoanScaleRate ls) { LoanScaleTable lt = LoanScaleTable.GetInstance(_user); lt.DeleteLoanScaleRate(ls); }
public LoanScaleTable GetLoanScaleTable() { return(LoanScaleTable.GetInstance(User.CurrentUser)); }