コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(M_repayment_plan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into hx_repayment_plan(");
            strSql.Append("borrower_registerid,targetid,current_period,repayment_period,repayment_type,repayment_amount,actual_amount_repayment,repayment_state,createtime,interestpayment,fees,O_penalty,shall_repayment,BorrUsrCustId)");
            strSql.Append(" values (");
            strSql.Append("@borrower_registerid,@targetid,@current_period,@repayment_period,@repayment_type,@repayment_amount,@actual_amount_repayment,@repayment_state,@createtime,@interestpayment,@fees,@O_penalty,@shall_repayment,@BorrUsrCustId)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@borrower_registerid",     SqlDbType.Int,        4),
                new SqlParameter("@targetid",                SqlDbType.Int,        4),
                new SqlParameter("@current_period",          SqlDbType.Int,        4),
                new SqlParameter("@repayment_period",        SqlDbType.DateTime),
                new SqlParameter("@repayment_type",          SqlDbType.Int,        4),
                new SqlParameter("@repayment_amount",        SqlDbType.Decimal,   17),
                new SqlParameter("@actual_amount_repayment", SqlDbType.Decimal,   17),
                new SqlParameter("@repayment_state",         SqlDbType.Int,        4),
                new SqlParameter("@createtime",              SqlDbType.DateTime),
                new SqlParameter("@interestpayment",         SqlDbType.Decimal),
                new SqlParameter("@fees",                    SqlDbType.Decimal),
                new SqlParameter("@O_penalty",               SqlDbType.Decimal),
                new SqlParameter("@shall_repayment",         SqlDbType.Decimal),
                new SqlParameter("@BorrUsrCustId",           SqlDbType.VarChar)
            };


            parameters[0].Value  = model.borrower_registerid;
            parameters[1].Value  = model.targetid;
            parameters[2].Value  = model.current_period;
            parameters[3].Value  = model.repayment_period;
            parameters[4].Value  = model.repayment_type;
            parameters[5].Value  = model.repayment_amount;
            parameters[6].Value  = model.actual_amount_repayment;
            parameters[7].Value  = model.repayment_state;
            parameters[8].Value  = model.createtime;
            parameters[9].Value  = model.interestpayment;
            parameters[10].Value = model.fees;
            parameters[11].Value = model.O_penalty;
            parameters[12].Value = model.shall_repayment;
            parameters[13].Value = model.BorrUsrCustId;


            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(M_repayment_plan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update hx_repayment_plan set ");
            strSql.Append("borrower_registerid=@borrower_registerid,");
            strSql.Append("targetid=@targetid,");
            strSql.Append("current_period=@current_period,");
            strSql.Append("repayment_period=@repayment_period,");
            strSql.Append("repayment_type=@repayment_type,");
            strSql.Append("repayment_amount=@repayment_amount,");
            strSql.Append("actual_amount_repayment=@actual_amount_repayment,");
            strSql.Append("repayment_state=@repayment_state,");
            strSql.Append("createtime=@createtime,");
            strSql.Append("interestpayment=@interestpayment");

            strSql.Append(" where repayment_plan_id=@repayment_plan_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@borrower_registerid",     SqlDbType.Int,        4),
                new SqlParameter("@targetid",                SqlDbType.Int,        4),
                new SqlParameter("@current_period",          SqlDbType.Int,        4),
                new SqlParameter("@repayment_period",        SqlDbType.DateTime),
                new SqlParameter("@repayment_type",          SqlDbType.Int,        4),
                new SqlParameter("@repayment_amount",        SqlDbType.Decimal,   17),
                new SqlParameter("@actual_amount_repayment", SqlDbType.Decimal,   17),
                new SqlParameter("@repayment_state",         SqlDbType.Int,        4),
                new SqlParameter("@createtime",              SqlDbType.DateTime),
                new SqlParameter("@interestpayment",         SqlDbType.Decimal),
                new SqlParameter("@repayment_plan_id",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.borrower_registerid;
            parameters[1].Value  = model.targetid;
            parameters[2].Value  = model.current_period;
            parameters[3].Value  = model.repayment_period;
            parameters[4].Value  = model.repayment_type;
            parameters[5].Value  = model.repayment_amount;
            parameters[6].Value  = model.actual_amount_repayment;
            parameters[7].Value  = model.repayment_state;
            parameters[8].Value  = model.createtime;
            parameters[9].Value  = model.interestpayment;
            parameters[10].Value = model.repayment_plan_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_repayment_plan DataRowToModel(DataRow row)
        {
            M_repayment_plan model = new M_repayment_plan();

            if (row != null)
            {
                if (row["repayment_plan_id"] != null && row["repayment_plan_id"].ToString() != "")
                {
                    model.repayment_plan_id = int.Parse(row["repayment_plan_id"].ToString());
                }
                if (row["borrower_registerid"] != null && row["borrower_registerid"].ToString() != "")
                {
                    model.borrower_registerid = int.Parse(row["borrower_registerid"].ToString());
                }
                if (row["targetid"] != null && row["targetid"].ToString() != "")
                {
                    model.targetid = int.Parse(row["targetid"].ToString());
                }
                if (row["current_period"] != null && row["current_period"].ToString() != "")
                {
                    model.current_period = int.Parse(row["current_period"].ToString());
                }
                if (row["repayment_period"] != null && row["repayment_period"].ToString() != "")
                {
                    model.repayment_period = DateTime.Parse(row["repayment_period"].ToString());
                }
                if (row["repayment_type"] != null && row["repayment_type"].ToString() != "")
                {
                    model.repayment_type = int.Parse(row["repayment_type"].ToString());
                }
                if (row["repayment_amount"] != null && row["repayment_amount"].ToString() != "")
                {
                    model.repayment_amount = decimal.Parse(row["repayment_amount"].ToString());
                }
                if (row["actual_amount_repayment"] != null && row["actual_amount_repayment"].ToString() != "")
                {
                    model.actual_amount_repayment = decimal.Parse(row["actual_amount_repayment"].ToString());
                }
                if (row["repayment_state"] != null && row["repayment_state"].ToString() != "")
                {
                    model.repayment_state = int.Parse(row["repayment_state"].ToString());
                }
                if (row["createtime"] != null && row["createtime"].ToString() != "")
                {
                    model.createtime = DateTime.Parse(row["createtime"].ToString());
                }
                if (row["interestpayment"] != null && row["interestpayment"].ToString() != "")
                {
                    model.interestpayment = decimal.Parse(row["interestpayment"].ToString());
                }
            }
            return(model);
        }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public M_repayment_plan GetModel(int repayment_plan_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 repayment_plan_id,borrower_registerid,targetid,current_period,repayment_period,repayment_type,repayment_amount,actual_amount_repayment,repayment_state,createtime,interestpayment from hx_repayment_plan ");
            strSql.Append(" where repayment_plan_id=@repayment_plan_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@repayment_plan_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = repayment_plan_id;

            M_repayment_plan model = new M_repayment_plan();
            DataSet          ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
ファイル: B_repayment_plan.cs プロジェクト: mkbiltek2019/CLT
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(M_repayment_plan model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
ファイル: B_repayment_plan.cs プロジェクト: mkbiltek2019/CLT
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(M_repayment_plan model)
 {
     return(dal.Add(model));
 }