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);
 }
예제 #4
0
        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();
            }
        }
예제 #5
0
 public void TestProvisioningRatePenalty()
 {
     ProvisioningRate pR = new ProvisioningRate();
     pR.ProvisioningPenalty = 10.5;
     Assert.AreEqual(10.5, pR.ProvisioningPenalty);
 }
예제 #6
0
 public void TestProvisioningRateOlb()
 {
     ProvisioningRate pR = new ProvisioningRate();
     pR.ProvisioningValue= 10.5;
     Assert.AreEqual(10.5,pR.ProvisioningValue);
 }
예제 #7
0
 public void TestProvisioningRateNbOfDaysMin()
 {
     ProvisioningRate pR = new ProvisioningRate();
     pR.NbOfDaysMin = 10;
     Assert.AreEqual(10,pR.NbOfDaysMin);
 }
예제 #8
0
 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);
 }
예제 #10
0
 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.");
     }
 }
예제 #11
0
 public void Add(ProvisioningRate pR)
 {
     _provisioningRates.Add(pR);
 }
예제 #12
0
 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);
 }
예제 #13
0
 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;
 }
예제 #14
0
        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;
                }
            }
        }
예제 #15
0
        /// <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);
                }
            }
        }
예제 #16
0
        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();
        }
예제 #17
0
 public void TestProvisioningRateInterest()
 {
     ProvisioningRate pR = new ProvisioningRate();
     pR.ProvisioningInterest = 10.5;
     Assert.AreEqual(10.5, pR.ProvisioningInterest);
 }
예제 #18
0
 public FrmGeneralSettings()
 {
     pR = new ProvisioningRate();
     lR = new LoanScaleRate();
     InitializeComponent();
     InitializeListViewProvisioningTables();
     InitializeListViewGeneralParameters();
     InitializeListViewPublicHolidays();
     InitializeListViewLoanScaleTables();
     InitializeListBoxPendingSavings();
 }
예제 #19
0
 public void Add(ProvisioningRate pR)
 {
     _provisioningRates.Add(pR);
 }
예제 #20
0
 public void TestProvisioningRateRate()
 {
     ProvisioningRate pR = new ProvisioningRate();
     pR.Rate= 10.5;
     Assert.AreEqual(10.5,pR.Rate);
 }