Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MxWeiXinPF.Model.wx_manager_bill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_manager_bill set ");
            strSql.Append("managerId=@managerId,");
            strSql.Append("moneyType=@moneyType,");
            strSql.Append("billMoney=@billMoney,");
            strSql.Append("billUsed=@billUsed,");
            strSql.Append("operPersonId=@operPersonId,");
            strSql.Append("operDate=@operDate,");
            strSql.Append("remark=@remark");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@managerId",    SqlDbType.Int,          4),
                new SqlParameter("@moneyType",    SqlDbType.VarChar,     30),
                new SqlParameter("@billMoney",    SqlDbType.Int,          4),
                new SqlParameter("@billUsed",     SqlDbType.VarChar,    500),
                new SqlParameter("@operPersonId", SqlDbType.Int,          4),
                new SqlParameter("@operDate",     SqlDbType.DateTime),
                new SqlParameter("@remark",       SqlDbType.VarChar,   1500),
                new SqlParameter("@id",           SqlDbType.Int, 4)
            };
            parameters[0].Value = model.managerId;
            parameters[1].Value = model.moneyType;
            parameters[2].Value = model.billMoney;
            parameters[3].Value = model.billUsed;
            parameters[4].Value = model.operPersonId;
            parameters[5].Value = model.operDate;
            parameters[6].Value = model.remark;
            parameters[7].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_manager_bill DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_manager_bill model = new MxWeiXinPF.Model.wx_manager_bill();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["managerId"] != null && row["managerId"].ToString() != "")
         {
             model.managerId = int.Parse(row["managerId"].ToString());
         }
         if (row["moneyType"] != null)
         {
             model.moneyType = row["moneyType"].ToString();
         }
         if (row["billMoney"] != null && row["billMoney"].ToString() != "")
         {
             model.billMoney = int.Parse(row["billMoney"].ToString());
         }
         if (row["billUsed"] != null)
         {
             model.billUsed = row["billUsed"].ToString();
         }
         if (row["operPersonId"] != null && row["operPersonId"].ToString() != "")
         {
             model.operPersonId = int.Parse(row["operPersonId"].ToString());
         }
         if (row["operDate"] != null && row["operDate"].ToString() != "")
         {
             model.operDate = DateTime.Parse(row["operDate"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
     }
     return(model);
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MxWeiXinPF.Model.wx_manager_bill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_manager_bill(");
            strSql.Append("managerId,moneyType,billMoney,billUsed,operPersonId,operDate,remark)");
            strSql.Append(" values (");
            strSql.Append("@managerId,@moneyType,@billMoney,@billUsed,@operPersonId,@operDate,@remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@managerId",    SqlDbType.Int,         4),
                new SqlParameter("@moneyType",    SqlDbType.VarChar,    30),
                new SqlParameter("@billMoney",    SqlDbType.Int,         4),
                new SqlParameter("@billUsed",     SqlDbType.VarChar,   500),
                new SqlParameter("@operPersonId", SqlDbType.Int,         4),
                new SqlParameter("@operDate",     SqlDbType.DateTime),
                new SqlParameter("@remark",       SqlDbType.VarChar, 1500)
            };
            parameters[0].Value = model.managerId;
            parameters[1].Value = model.moneyType;
            parameters[2].Value = model.billMoney;
            parameters[3].Value = model.billUsed;
            parameters[4].Value = model.operPersonId;
            parameters[5].Value = model.operDate;
            parameters[6].Value = model.remark;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_manager_bill GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,managerId,moneyType,billMoney,billUsed,operPersonId,operDate,remark from wx_manager_bill ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }