Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WeiXinPF.Model.wx_xjhongbao_lqinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_xjhongbao_lqinfo(");
            strSql.Append("wid,actionId,openid,userNick,total_amount,Send_time,mch_billno,mch_id,detail_id,hbstatus,send_type,hb_type,reason,Refund_time,createDate,remark)");
            strSql.Append(" values (");
            strSql.Append("@wid,@actionId,@openid,@userNick,@total_amount,@Send_time,@mch_billno,@mch_id,@detail_id,@hbstatus,@send_type,@hb_type,@reason,@Refund_time,@createDate,@remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",          SqlDbType.Int,          4),
                new SqlParameter("@actionId",     SqlDbType.Int,          4),
                new SqlParameter("@openid",       SqlDbType.VarChar,    300),
                new SqlParameter("@userNick",     SqlDbType.VarChar,    400),
                new SqlParameter("@total_amount", SqlDbType.Int,          4),
                new SqlParameter("@Send_time",    SqlDbType.DateTime),
                new SqlParameter("@mch_billno",   SqlDbType.VarChar,     28),
                new SqlParameter("@mch_id",       SqlDbType.VarChar,     32),
                new SqlParameter("@detail_id",    SqlDbType.VarChar,     32),
                new SqlParameter("@hbstatus",     SqlDbType.VarChar,     16),
                new SqlParameter("@send_type",    SqlDbType.VarChar,     32),
                new SqlParameter("@hb_type",      SqlDbType.VarChar,     32),
                new SqlParameter("@reason",       SqlDbType.VarChar,   2000),
                new SqlParameter("@Refund_time",  SqlDbType.DateTime),
                new SqlParameter("@createDate",   SqlDbType.DateTime),
                new SqlParameter("@remark",       SqlDbType.VarChar, 2000)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.actionId;
            parameters[2].Value  = model.openid;
            parameters[3].Value  = model.userNick;
            parameters[4].Value  = model.total_amount;
            parameters[5].Value  = model.Send_time;
            parameters[6].Value  = model.mch_billno;
            parameters[7].Value  = model.mch_id;
            parameters[8].Value  = model.detail_id;
            parameters[9].Value  = model.hbstatus;
            parameters[10].Value = model.send_type;
            parameters[11].Value = model.hb_type;
            parameters[12].Value = model.reason;
            parameters[13].Value = model.Refund_time;
            parameters[14].Value = model.createDate;
            parameters[15].Value = model.remark;

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

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

            strSql.Append("select  top 1 id,wid,actionId,openid,userNick,total_amount,Send_time,mch_billno,mch_id,detail_id,hbstatus,send_type,hb_type,reason,Refund_time,createDate,remark from wx_xjhongbao_lqinfo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WeiXinPF.Model.wx_xjhongbao_lqinfo DataRowToModel(DataRow row)
 {
     WeiXinPF.Model.wx_xjhongbao_lqinfo model = new WeiXinPF.Model.wx_xjhongbao_lqinfo();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["actionId"] != null && row["actionId"].ToString() != "")
         {
             model.actionId = int.Parse(row["actionId"].ToString());
         }
         if (row["openid"] != null)
         {
             model.openid = row["openid"].ToString();
         }
         if (row["userNick"] != null)
         {
             model.userNick = row["userNick"].ToString();
         }
         if (row["total_amount"] != null && row["total_amount"].ToString() != "")
         {
             model.total_amount = int.Parse(row["total_amount"].ToString());
         }
         if (row["Send_time"] != null && row["Send_time"].ToString() != "")
         {
             model.Send_time = DateTime.Parse(row["Send_time"].ToString());
         }
         if (row["mch_billno"] != null)
         {
             model.mch_billno = row["mch_billno"].ToString();
         }
         if (row["mch_id"] != null)
         {
             model.mch_id = row["mch_id"].ToString();
         }
         if (row["detail_id"] != null)
         {
             model.detail_id = row["detail_id"].ToString();
         }
         if (row["hbstatus"] != null)
         {
             model.hbstatus = row["hbstatus"].ToString();
         }
         if (row["send_type"] != null)
         {
             model.send_type = row["send_type"].ToString();
         }
         if (row["hb_type"] != null)
         {
             model.hb_type = row["hb_type"].ToString();
         }
         if (row["reason"] != null)
         {
             model.reason = row["reason"].ToString();
         }
         if (row["Refund_time"] != null && row["Refund_time"].ToString() != "")
         {
             model.Refund_time = DateTime.Parse(row["Refund_time"].ToString());
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WeiXinPF.Model.wx_xjhongbao_lqinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_xjhongbao_lqinfo set ");
            strSql.Append("wid=@wid,");
            strSql.Append("actionId=@actionId,");
            strSql.Append("openid=@openid,");
            strSql.Append("userNick=@userNick,");
            strSql.Append("total_amount=@total_amount,");
            strSql.Append("Send_time=@Send_time,");
            strSql.Append("mch_billno=@mch_billno,");
            strSql.Append("mch_id=@mch_id,");
            strSql.Append("detail_id=@detail_id,");
            strSql.Append("hbstatus=@hbstatus,");
            strSql.Append("send_type=@send_type,");
            strSql.Append("hb_type=@hb_type,");
            strSql.Append("reason=@reason,");
            strSql.Append("Refund_time=@Refund_time,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("remark=@remark");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",          SqlDbType.Int,          4),
                new SqlParameter("@actionId",     SqlDbType.Int,          4),
                new SqlParameter("@openid",       SqlDbType.VarChar,    300),
                new SqlParameter("@userNick",     SqlDbType.VarChar,    400),
                new SqlParameter("@total_amount", SqlDbType.Int,          4),
                new SqlParameter("@Send_time",    SqlDbType.DateTime),
                new SqlParameter("@mch_billno",   SqlDbType.VarChar,     28),
                new SqlParameter("@mch_id",       SqlDbType.VarChar,     32),
                new SqlParameter("@detail_id",    SqlDbType.VarChar,     32),
                new SqlParameter("@hbstatus",     SqlDbType.VarChar,     16),
                new SqlParameter("@send_type",    SqlDbType.VarChar,     32),
                new SqlParameter("@hb_type",      SqlDbType.VarChar,     32),
                new SqlParameter("@reason",       SqlDbType.VarChar,   2000),
                new SqlParameter("@Refund_time",  SqlDbType.DateTime),
                new SqlParameter("@createDate",   SqlDbType.DateTime),
                new SqlParameter("@remark",       SqlDbType.VarChar,   2000),
                new SqlParameter("@id",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.actionId;
            parameters[2].Value  = model.openid;
            parameters[3].Value  = model.userNick;
            parameters[4].Value  = model.total_amount;
            parameters[5].Value  = model.Send_time;
            parameters[6].Value  = model.mch_billno;
            parameters[7].Value  = model.mch_id;
            parameters[8].Value  = model.detail_id;
            parameters[9].Value  = model.hbstatus;
            parameters[10].Value = model.send_type;
            parameters[11].Value = model.hb_type;
            parameters[12].Value = model.reason;
            parameters[13].Value = model.Refund_time;
            parameters[14].Value = model.createDate;
            parameters[15].Value = model.remark;
            parameters[16].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }