Пример #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.sf_businessapp_settlement DataRowToModel(DataRow row)
 {
     Model.sf_businessapp_settlement model = new Model.sf_businessapp_settlement();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = long.Parse(row["id"].ToString());
         }
         if (row["sf_finance_settlement_num"] != null)
         {
             model.sf_finance_settlement_num = row["sf_finance_settlement_num"].ToString();
         }
         if (row["busnieseNum"] != null)
         {
             model.busnieseNum = row["busnieseNum"].ToString();
         }
         if (row["business_name"] != null)
         {
             model.business_name = row["business_name"].ToString();
         }
         if (row["appNum"] != null)
         {
             model.appNum = row["appNum"].ToString();
         }
         if (row["appid_name"] != null)
         {
             model.appid_name = row["appid_name"].ToString();
         }
         if (row["templatesNum"] != null)
         {
             model.templatesNum = row["templatesNum"].ToString();
         }
         if (row["templates_name"] != null)
         {
             model.templates_name = row["templates_name"].ToString();
         }
         if (row["sf_contract_num"] != null)
         {
             model.sf_contract_num = row["sf_contract_num"].ToString();
         }
         if (row["settlement_times"] != null)
         {
             model.settlement_times = row["settlement_times"].ToString();
         }
         if (row["user_name"] != null)
         {
             model.user_name = row["user_name"].ToString();
         }
         if (row["total_amount"] != null && row["total_amount"].ToString() != "")
         {
             model.total_amount = decimal.Parse(row["total_amount"].ToString());
         }
         if (row["create_time"] != null && row["create_time"].ToString() != "")
         {
             model.create_time = DateTime.Parse(row["create_time"].ToString());
         }
     }
     return(model);
 }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.sf_businessapp_settlement model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update sf_businessapp_settlement set ");
            strSql.Append("sf_finance_settlement_num=@sf_finance_settlement_num,");
            strSql.Append("busnieseNum=@busnieseNum,");
            strSql.Append("business_name=@business_name,");
            strSql.Append("appNum=@appNum,");
            strSql.Append("appid_name=@appid_name,");
            strSql.Append("templatesNum=@templatesNum,");
            strSql.Append("templates_name=@templates_name,");
            strSql.Append("sf_contract_num=@sf_contract_num,");
            strSql.Append("settlement_times=@settlement_times,");
            strSql.Append("user_name=@user_name,");
            strSql.Append("total_amount=@total_amount,");
            strSql.Append("create_time=@create_time");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sf_finance_settlement_num", SqlDbType.NVarChar,  100),
                new SqlParameter("@busnieseNum",               SqlDbType.NVarChar,   50),
                new SqlParameter("@business_name",             SqlDbType.NVarChar,  100),
                new SqlParameter("@appNum",                    SqlDbType.NVarChar,   50),
                new SqlParameter("@appid_name",                SqlDbType.NVarChar,  100),
                new SqlParameter("@templatesNum",              SqlDbType.NVarChar,  100),
                new SqlParameter("@templates_name",            SqlDbType.NVarChar,  100),
                new SqlParameter("@sf_contract_num",           SqlDbType.NVarChar,   50),
                new SqlParameter("@settlement_times",          SqlDbType.NVarChar,  100),
                new SqlParameter("@user_name",                 SqlDbType.NVarChar,  100),
                new SqlParameter("@total_amount",              SqlDbType.Decimal,     9),
                new SqlParameter("@create_time",               SqlDbType.DateTime),
                new SqlParameter("@id",                        SqlDbType.BigInt, 8)
            };
            parameters[0].Value  = model.sf_finance_settlement_num;
            parameters[1].Value  = model.busnieseNum;
            parameters[2].Value  = model.business_name;
            parameters[3].Value  = model.appNum;
            parameters[4].Value  = model.appid_name;
            parameters[5].Value  = model.templatesNum;
            parameters[6].Value  = model.templates_name;
            parameters[7].Value  = model.sf_contract_num;
            parameters[8].Value  = model.settlement_times;
            parameters[9].Value  = model.user_name;
            parameters[10].Value = model.total_amount;
            parameters[11].Value = model.create_time;
            parameters[12].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(Model.sf_businessapp_settlement model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sf_businessapp_settlement(");
            strSql.Append("sf_finance_settlement_num,busnieseNum,business_name,appNum,appid_name,templatesNum,templates_name,sf_contract_num,settlement_times,user_name,total_amount,create_time)");
            strSql.Append(" values (");
            strSql.Append("@sf_finance_settlement_num,@busnieseNum,@business_name,@appNum,@appid_name,@templatesNum,@templates_name,@sf_contract_num,@settlement_times,@user_name,@total_amount,@create_time)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sf_finance_settlement_num", SqlDbType.NVarChar, 100),
                new SqlParameter("@busnieseNum",               SqlDbType.NVarChar,  50),
                new SqlParameter("@business_name",             SqlDbType.NVarChar, 100),
                new SqlParameter("@appNum",                    SqlDbType.NVarChar,  50),
                new SqlParameter("@appid_name",                SqlDbType.NVarChar, 100),
                new SqlParameter("@templatesNum",              SqlDbType.NVarChar, 100),
                new SqlParameter("@templates_name",            SqlDbType.NVarChar, 100),
                new SqlParameter("@sf_contract_num",           SqlDbType.NVarChar,  50),
                new SqlParameter("@settlement_times",          SqlDbType.NVarChar, 100),
                new SqlParameter("@user_name",                 SqlDbType.NVarChar, 100),
                new SqlParameter("@total_amount",              SqlDbType.Decimal,    9),
                new SqlParameter("@create_time",               SqlDbType.DateTime)
            };
            parameters[0].Value  = model.sf_finance_settlement_num;
            parameters[1].Value  = model.busnieseNum;
            parameters[2].Value  = model.business_name;
            parameters[3].Value  = model.appNum;
            parameters[4].Value  = model.appid_name;
            parameters[5].Value  = model.templatesNum;
            parameters[6].Value  = model.templates_name;
            parameters[7].Value  = model.sf_contract_num;
            parameters[8].Value  = model.settlement_times;
            parameters[9].Value  = model.user_name;
            parameters[10].Value = model.total_amount;
            parameters[11].Value = model.create_time;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.sf_businessapp_settlement GetModel(long id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,sf_finance_settlement_num,busnieseNum,business_name,appNum,appid_name,templatesNum,templates_name,sf_contract_num,settlement_times,user_name,total_amount,create_time from sf_businessapp_settlement ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.BigInt)
            };
            parameters[0].Value = id;

            Model.sf_businessapp_settlement model = new Model.sf_businessapp_settlement();
            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
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.sf_businessapp_settlement model)
 {
     return(dal.Update(model));
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(Model.sf_businessapp_settlement model)
 {
     return(dal.Add(model));
 }