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(); }
public void TestDeleteProvisionningRules() { ProvisioningRuleManager provisioningRuleManager = (ProvisioningRuleManager)container["ProvisioningRuleManager"]; SqlTransaction transaction = provisioningRuleManager.GetConnection().BeginTransaction(); provisioningRuleManager.DeleteAllProvisioningRules(transaction); transaction.Commit(); List <ProvisioningRate> list = provisioningRuleManager.SelectAllProvisioningRates(); Assert.AreEqual(0, list.Count); }
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; } } }