Ejemplo n.º 1
0
        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;
                    }
                }
        }
Ejemplo n.º 2
0
        public void InsertLoanScale(LoanScaleRate pLoanScaleRate, SqlTransaction pSqlTransaction)
        {
            const string sqlText = @"INSERT INTO LoanScale(id,ScaleMin, ScaleMax) VALUES(@number,@Min, @Max)";

            using (OpenCbsCommand insert = new OpenCbsCommand(sqlText, pSqlTransaction.Connection, pSqlTransaction))
            {
                SetLoanScale(insert, pLoanScaleRate);
                insert.ExecuteNonQuery();
            }
        }
Ejemplo n.º 3
0
        public void InsertLoanScaleValue(LoanScaleRate lR, SqlTransaction sqlTransac)
        {
            string sqlText = "INSERT INTO LoanScale(id,ScaleMin, ScaleMax) " +
                             "VALUES(@number,@Min, @Max)";

            SqlCommand insert = new SqlCommand(sqlText, CurrentConnection, sqlTransac);

            DatabaseHelper.InsertInt32Param("@number", insert, lR.Number);
            DatabaseHelper.InsertInt32Param("@Min", insert, lR.ScaleMin);
            DatabaseHelper.InsertInt32Param("@Max", insert, lR.ScaleMax);

            insert.ExecuteNonQuery();
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }
Ejemplo n.º 5
0
 public void DeleteLoanScaleRate(LoanScaleRate lt)
 {
     _loanscaleRates.Remove(lt);
     int number = 1;
     foreach (LoanScaleRate lsr in _loanscaleRates)
     {
         lsr.Number = number;
         number++;
     }
 }
Ejemplo n.º 6
0
 public void AddLoanScaleRate(LoanScaleRate lt)
 {
     _loanscaleRates.Add(lt);
 }
Ejemplo n.º 7
0
        public void DeleteLoanScale(LoanScaleRate ls)
        {
            LoanScaleTable lt = LoanScaleTable.GetInstance(_user);

            lt.DeleteLoanScaleRate(ls);
        }
Ejemplo n.º 8
0
 private static void SetLoanScale(OpenCbsCommand octCmd, LoanScaleRate pLoanScaleRate)
 {
     octCmd.AddParam("@number", pLoanScaleRate.Number);
     octCmd.AddParam("@Min", pLoanScaleRate.ScaleMin);
     octCmd.AddParam("@Max", pLoanScaleRate.ScaleMax);
 }