private static void _AssertProvisioningRule(ProvisioningRate pProvisioningRate, int pNumber, int pNbOfDaysMin, int pNbOfDaysMax, double pRate) { Assert.AreEqual(pNumber, pProvisioningRate.Number); Assert.AreEqual(pNbOfDaysMin, pProvisioningRate.NbOfDaysMin); Assert.AreEqual(pNbOfDaysMax, pProvisioningRate.NbOfDaysMax); Assert.AreEqual(pRate, pProvisioningRate.Rate); }
public void AddProvisionningRateInDatabase() { ProvisioningRuleManager provisioningRuleManager = (ProvisioningRuleManager) container["ProvisioningRuleManager"]; ProvisioningRate rate = new ProvisioningRate {Number = 12, NbOfDaysMin = 1000, NbOfDaysMax = 1111, ProvisioningValue = 2, ProvisioningInterest=2, ProvisioningPenalty=2}; SqlTransaction transaction = provisioningRuleManager.GetConnection().BeginTransaction(); provisioningRuleManager.AddProvisioningRate(rate, transaction); transaction.Commit(); }
private static void _AssertProvisioningRule(ProvisioningRate pProvisioningRate, int pNumber, int pNbOfDaysMin, int pNbOfDaysMax, double pOlb, double pInterest, double pPenalty ) { Assert.AreEqual(pNumber, pProvisioningRate.Number); Assert.AreEqual(pNbOfDaysMin, pProvisioningRate.NbOfDaysMin); Assert.AreEqual(pNbOfDaysMax, pProvisioningRate.NbOfDaysMax); Assert.AreEqual(pOlb, pProvisioningRate.ProvisioningValue); Assert.AreEqual(pInterest, pProvisioningRate.ProvisioningInterest); Assert.AreEqual(pPenalty, pProvisioningRate.ProvisioningPenalty); }
public void AddProvisioningRate(ProvisioningRate pR, SqlTransaction sqlTransac) { const string sqlText = @"INSERT INTO ProvisioningRules( id, number_of_days_min, number_of_days_max, provisioning_value) VALUES( @number, @numberOfDaysMin, @numberOfDaysMax, @provisioningPercentage) SELECT SCOPE_IDENTITY()"; using (OpenCbsCommand insert = new OpenCbsCommand(sqlText, sqlTransac.Connection, sqlTransac)) { SetProvisioningRate(insert, pR); insert.ExecuteScalar(); } }
public void TestProvisioningRatePenalty() { ProvisioningRate pR = new ProvisioningRate(); pR.ProvisioningPenalty = 10.5; Assert.AreEqual(10.5, pR.ProvisioningPenalty); }
public void TestProvisioningRateOlb() { ProvisioningRate pR = new ProvisioningRate(); pR.ProvisioningValue= 10.5; Assert.AreEqual(10.5,pR.ProvisioningValue); }
public void TestProvisioningRateNbOfDaysMin() { ProvisioningRate pR = new ProvisioningRate(); pR.NbOfDaysMin = 10; Assert.AreEqual(10,pR.NbOfDaysMin); }
public void TestProvisioningRateNbOfDaysMax() { ProvisioningRate pR = new ProvisioningRate(); pR.NbOfDaysMax = 20; Assert.AreEqual(20,pR.NbOfDaysMax); }
private static void SetProvisioningRate(OpenCbsCommand octCommand, ProvisioningRate pProvisionningRate) { octCommand.AddParam("@number", pProvisionningRate.Number); octCommand.AddParam("@numberOfDaysMin", pProvisionningRate.NbOfDaysMin); octCommand.AddParam("@numberOfDaysMax", pProvisionningRate.NbOfDaysMax); octCommand.AddParam("@ProvisioningOlb", pProvisionningRate.ProvisioningValue); octCommand.AddParam("@ProvisioningInterest", pProvisionningRate.ProvisioningInterest); octCommand.AddParam("@ProvisioningPenalty", pProvisionningRate.ProvisioningPenalty); }
private void listViewProvisioningRules_Click(object sender, EventArgs e) { try { pR = (ProvisioningRate) listViewProvisioningRules.SelectedItems[0].Tag; if (pR.NbOfDaysMin == -1) { textBoxNbOfDaysMin.Enabled = false; textBoxNbOfDaysMax.Enabled = false; } else { textBoxNbOfDaysMin.Enabled = true; textBoxNbOfDaysMax.Enabled = true; } InitializeProvisioningRate(); } catch { MessageBox.Show(@"Please, select proper row from the list."); } }
public void Add(ProvisioningRate pR) { _provisioningRates.Add(pR); }
private static void SetProvisioningRate(OpenCbsCommand octCommand, ProvisioningRate pProvisionningRate) { octCommand.AddParam("@number", pProvisionningRate.Number); octCommand.AddParam("@numberOfDaysMin", pProvisionningRate.NbOfDaysMin); octCommand.AddParam("@numberOfDaysMax", pProvisionningRate.NbOfDaysMax); octCommand.AddParam("@provisioningPercentage", pProvisionningRate.Rate); }
public FrmGeneralSettings() { pR = new ProvisioningRate(); lR = new LoanScaleRate(); InitializeComponent(); InitializeListViewProvisioningTables(); InitializeListViewGeneralParameters(); InitializeListViewPublicHolidays(); InitializeListViewLoanScaleTables(); InitializeListBoxPendingSavings(); dateTimePickerPublicHoliday.Format = DateTimePickerFormat.Custom; dateTimePickerPublicHoliday.CustomFormat = ApplicationSettings.GetInstance("").SHORT_DATE_FORMAT; }
public void AddProvisioningRate(ProvisioningRate pR) { ProvisionTable pT = ProvisionTable.GetInstance(_user); pR.Number = pT.ProvisioningRates.Count + 1; pT.Add(pR); using (SqlConnection conn = _provisionningRuleManager.GetConnection()) using (SqlTransaction sqlTransac = conn.BeginTransaction()) { try { _provisionningRuleManager.AddProvisioningRate(pR, sqlTransac); sqlTransac.Commit(); } catch (Exception ex) { sqlTransac.Rollback(); throw ex; } } }
/// <summary> /// This method Fill the instance of the ProvisioningTable object accessed by singleton /// </summary> public void SelectAllProvisioningRates() { ProvisioningTable provisioningTable = ProvisioningTable.GetInstance(_user); string sqlText = "SELECT id,number_of_days_min, number_of_days_max, provisioning_value FROM ProvisioningRules"; SqlCommand select = new SqlCommand(sqlText, CurrentConnection); using (SqlDataReader reader = select.ExecuteReader()) { while(reader.Read()) { ProvisioningRate pR = new ProvisioningRate(); pR.Number = DatabaseHelper.GetInt32("id",reader); pR.NbOfDaysMin = DatabaseHelper.GetInt32("number_of_days_min",reader); pR.NbOfDaysMax = DatabaseHelper.GetInt32("number_of_days_max",reader); pR.Rate = DatabaseHelper.GetDouble("provisioning_value",reader); provisioningTable.AddProvisioningRate(pR); } } }
public void InsertProvisioningValue(ProvisioningRate pR,SqlTransaction sqlTransac) { string sqlText = "INSERT INTO ProvisioningRules(id,number_of_days_min, number_of_days_max, provisioning_value) "+ "VALUES(@number,@numberOfDaysMin, @numberOfDaysMax, @provisioningPercentage)"; SqlCommand insert = new SqlCommand(sqlText, CurrentConnection, sqlTransac); DatabaseHelper.InsertInt32Param("@number",insert,pR.Number); DatabaseHelper.InsertInt32Param("@numberOfDaysMin",insert,pR.NbOfDaysMin); DatabaseHelper.InsertInt32Param("@numberOfDaysMax",insert,pR.NbOfDaysMax); DatabaseHelper.InsertDoubleParam("@provisioningPercentage",insert,pR.Rate); insert.ExecuteNonQuery(); }
public void TestProvisioningRateInterest() { ProvisioningRate pR = new ProvisioningRate(); pR.ProvisioningInterest = 10.5; Assert.AreEqual(10.5, pR.ProvisioningInterest); }
public FrmGeneralSettings() { pR = new ProvisioningRate(); lR = new LoanScaleRate(); InitializeComponent(); InitializeListViewProvisioningTables(); InitializeListViewGeneralParameters(); InitializeListViewPublicHolidays(); InitializeListViewLoanScaleTables(); InitializeListBoxPendingSavings(); }
public void TestProvisioningRateRate() { ProvisioningRate pR = new ProvisioningRate(); pR.Rate= 10.5; Assert.AreEqual(10.5,pR.Rate); }