Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(LPWeb.Model.Company_LoanProgramDetails model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Company_LoanProgramDetails(");
            strSql.Append("LoanProgramID,InvestorID,IndexType,Margin,FirstAdj,SubAdj,LifetimeCap,Enabled,Term,Due)");
            strSql.Append(" values (");
            strSql.Append("@LoanProgramID,@InvestorID,@IndexType,@Margin,@FirstAdj,@SubAdj,@LifetimeCap,@Enabled,@Term,@Due)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoanProgramID", SqlDbType.Int,        4),
                new SqlParameter("@InvestorID",    SqlDbType.Int,        4),
                new SqlParameter("@IndexType",     SqlDbType.NVarChar, 255),
                new SqlParameter("@Margin",        SqlDbType.Money,      8),
                new SqlParameter("@FirstAdj",      SqlDbType.Money,      8),
                new SqlParameter("@SubAdj",        SqlDbType.Money,      8),
                new SqlParameter("@LifetimeCap",   SqlDbType.Money,      8),
                new SqlParameter("@Enabled",       SqlDbType.Bit),
                new SqlParameter("@Term",          SqlDbType.Int),
                new SqlParameter("@Due",           SqlDbType.Int)
            };
            parameters[0].Value = model.LoanProgramID;
            parameters[1].Value = model.InvestorID;
            parameters[2].Value = model.IndexType;
            parameters[3].Value = model.Margin;
            parameters[4].Value = model.FirstAdj;
            parameters[5].Value = model.SubAdj;
            parameters[6].Value = model.LifetimeCap;
            parameters[7].Value = model.Enabled;
            parameters[8].Value = model.Term;
            parameters[9].Value = model.Due;
            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.Company_LoanProgramDetails GetModel(int LoanProgramID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 LoanProgramID,IndexType,Margin,FirstAdj,SubAdj,LifetimeCap,InvestorID,Enabled from Company_LoanProgramDetails ");
            strSql.Append(" where LoanProgramID=@LoanProgramID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoanProgramID", SqlDbType.Int, 4)
            };
            parameters[0].Value = LoanProgramID;

            LPWeb.Model.Company_LoanProgramDetails model = new LPWeb.Model.Company_LoanProgramDetails();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["LoanProgramID"].ToString() != "")
                {
                    model.LoanProgramID = int.Parse(ds.Tables[0].Rows[0]["LoanProgramID"].ToString());
                }
                //if (ds.Tables[0].Rows[0]["LenderCompanyId"].ToString() != "")
                //{
                //    model.LenderCompanyId = int.Parse(ds.Tables[0].Rows[0]["LenderCompanyId"].ToString());
                //}
                model.IndexType = ds.Tables[0].Rows[0]["IndexType"].ToString();
                if (ds.Tables[0].Rows[0]["Margin"].ToString() != "")
                {
                    model.Margin = decimal.Parse(ds.Tables[0].Rows[0]["Margin"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FirstAdj"].ToString() != "")
                {
                    model.FirstAdj = decimal.Parse(ds.Tables[0].Rows[0]["FirstAdj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SubAdj"].ToString() != "")
                {
                    model.SubAdj = decimal.Parse(ds.Tables[0].Rows[0]["SubAdj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LifetimeCap"].ToString() != "")
                {
                    model.LifetimeCap = decimal.Parse(ds.Tables[0].Rows[0]["LifetimeCap"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvestorID"].ToString() != "")
                {
                    model.InvestorID = int.Parse(ds.Tables[0].Rows[0]["InvestorID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Enabled"].ToString() != "")
                {
                    model.Enabled = bool.Parse(ds.Tables[0].Rows[0]["Enabled"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LPWeb.Model.Company_LoanProgramDetails model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Company_LoanProgramDetails set ");
            //strSql.Append("LenderCompanyId=@LenderCompanyId,");
            strSql.Append("IndexType=@IndexType,");
            strSql.Append("Margin=@Margin,");
            strSql.Append("FirstAdj=@FirstAdj,");
            strSql.Append("SubAdj=@SubAdj,");
            strSql.Append("LifetimeCap=@LifetimeCap,");
            strSql.Append("InvestorID =@InvestorID,");
            strSql.Append("Term =@Term,");
            strSql.Append("Due =@Due,");
            strSql.Append("Enabled=@Enabled");
            strSql.Append(" where LoanProgramID=@LoanProgramID AND InvestorID=@InvestorID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoanProgramID", SqlDbType.Int,        4),
                new SqlParameter("@IndexType",     SqlDbType.NVarChar, 255),
                new SqlParameter("@Margin",        SqlDbType.Money,      8),
                new SqlParameter("@FirstAdj",      SqlDbType.Money,      8),
                new SqlParameter("@SubAdj",        SqlDbType.Money,      8),
                new SqlParameter("@LifetimeCap",   SqlDbType.Money,      8),
                new SqlParameter("@InvestorID",    SqlDbType.Int,        4),
                new SqlParameter("@Term",          SqlDbType.Int,        4),
                new SqlParameter("@Due",           SqlDbType.Int,        4),
                new SqlParameter("@Enabled",       SqlDbType.Bit)
            };
            parameters[0].Value = model.LoanProgramID;
            parameters[1].Value = model.IndexType;
            parameters[2].Value = model.Margin;
            parameters[3].Value = model.FirstAdj;
            parameters[4].Value = model.SubAdj;
            parameters[5].Value = model.LifetimeCap;
            parameters[6].Value = model.InvestorID;
            parameters[7].Value = model.Term;
            parameters[8].Value = model.Due;
            parameters[9].Value = model.Enabled;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LPWeb.Model.Company_LoanProgramDetails GetModel(int LoanProgramID, int InvestorID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 * from Company_LoanProgramDetails ");
            strSql.Append(" where LoanProgramID=@LoanProgramID and InvestorID=@InvestorID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoanProgramID", SqlDbType.Int, 4),
                new SqlParameter("@InvestorID",    SqlDbType.Int, 4)
            };

            parameters[0].Value = LoanProgramID;
            parameters[1].Value = InvestorID;

            LPWeb.Model.Company_LoanProgramDetails model = new LPWeb.Model.Company_LoanProgramDetails();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["LoanProgramID"] != DBNull.Value)
                {
                    model.LoanProgramID = int.Parse(ds.Tables[0].Rows[0]["LoanProgramID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IndexType"] != DBNull.Value)
                {
                    model.IndexType = ds.Tables[0].Rows[0]["IndexType"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Margin"] != DBNull.Value)
                {
                    model.Margin = decimal.Parse(ds.Tables[0].Rows[0]["Margin"].ToString());
                }
                if (ds.Tables[0].Rows[0]["FirstAdj"] != DBNull.Value)
                {
                    model.FirstAdj = decimal.Parse(ds.Tables[0].Rows[0]["FirstAdj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SubAdj"] != DBNull.Value)
                {
                    model.SubAdj = decimal.Parse(ds.Tables[0].Rows[0]["SubAdj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LifetimeCap"] != DBNull.Value)
                {
                    model.LifetimeCap = decimal.Parse(ds.Tables[0].Rows[0]["LifetimeCap"].ToString());
                }
                if (ds.Tables[0].Rows[0]["InvestorID"] != DBNull.Value)
                {
                    model.InvestorID = int.Parse(ds.Tables[0].Rows[0]["InvestorID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Enabled"] != DBNull.Value)
                {
                    model.Enabled = bool.Parse(ds.Tables[0].Rows[0]["Enabled"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Term"] != DBNull.Value)
                {
                    model.Term = int.Parse(ds.Tables[0].Rows[0]["Term"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Due"] != DBNull.Value)
                {
                    model.Due = int.Parse(ds.Tables[0].Rows[0]["Due"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }