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

            strSql.Append("update wx_product_comment set ");
            strSql.Append("hdId=@hdId,");
            strSql.Append("openId=@openId,");
            strSql.Append("commentContent=@commentContent,");
            strSql.Append("commentType=@commentType,");
            strSql.Append("commentRemark=@commentRemark,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("replyStatus=@replyStatus,");
            strSql.Append("replyPerson=@replyPerson,");
            strSql.Append("replyContent=@replyContent,");
            strSql.Append("replyDate=@replyDate");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@hdId",           SqlDbType.Int,          4),
                new SqlParameter("@openId",         SqlDbType.VarChar,    200),
                new SqlParameter("@commentContent", SqlDbType.VarChar,    500),
                new SqlParameter("@commentType",    SqlDbType.Int,          4),
                new SqlParameter("@commentRemark",  SqlDbType.VarChar,   2000),
                new SqlParameter("@createDate",     SqlDbType.DateTime),
                new SqlParameter("@replyStatus",    SqlDbType.Int,          4),
                new SqlParameter("@replyPerson",    SqlDbType.VarChar,     50),
                new SqlParameter("@replyContent",   SqlDbType.VarChar,   1000),
                new SqlParameter("@replyDate",      SqlDbType.DateTime),
                new SqlParameter("@id",             SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.hdId;
            parameters[1].Value  = model.openId;
            parameters[2].Value  = model.commentContent;
            parameters[3].Value  = model.commentType;
            parameters[4].Value  = model.commentRemark;
            parameters[5].Value  = model.createDate;
            parameters[6].Value  = model.replyStatus;
            parameters[7].Value  = model.replyPerson;
            parameters[8].Value  = model.replyContent;
            parameters[9].Value  = model.replyDate;
            parameters[10].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_product_comment DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_product_comment model = new MxWeiXinPF.Model.wx_product_comment();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["hdId"] != null && row["hdId"].ToString() != "")
         {
             model.hdId = int.Parse(row["hdId"].ToString());
         }
         if (row["openId"] != null)
         {
             model.openId = row["openId"].ToString();
         }
         if (row["commentContent"] != null)
         {
             model.commentContent = row["commentContent"].ToString();
         }
         if (row["commentType"] != null && row["commentType"].ToString() != "")
         {
             model.commentType = int.Parse(row["commentType"].ToString());
         }
         if (row["commentRemark"] != null)
         {
             model.commentRemark = row["commentRemark"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["replyStatus"] != null && row["replyStatus"].ToString() != "")
         {
             model.replyStatus = int.Parse(row["replyStatus"].ToString());
         }
         if (row["replyPerson"] != null)
         {
             model.replyPerson = row["replyPerson"].ToString();
         }
         if (row["replyContent"] != null)
         {
             model.replyContent = row["replyContent"].ToString();
         }
         if (row["replyDate"] != null && row["replyDate"].ToString() != "")
         {
             model.replyDate = DateTime.Parse(row["replyDate"].ToString());
         }
     }
     return(model);
 }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_product_comment DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_product_comment model=new MxWeiXinPF.Model.wx_product_comment();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["hdId"]!=null && row["hdId"].ToString()!="")
         {
             model.hdId=int.Parse(row["hdId"].ToString());
         }
         if(row["openId"]!=null)
         {
             model.openId=row["openId"].ToString();
         }
         if(row["commentContent"]!=null)
         {
             model.commentContent=row["commentContent"].ToString();
         }
         if(row["commentType"]!=null && row["commentType"].ToString()!="")
         {
             model.commentType=int.Parse(row["commentType"].ToString());
         }
         if(row["commentRemark"]!=null)
         {
             model.commentRemark=row["commentRemark"].ToString();
         }
         if(row["createDate"]!=null && row["createDate"].ToString()!="")
         {
             model.createDate=DateTime.Parse(row["createDate"].ToString());
         }
         if(row["replyStatus"]!=null && row["replyStatus"].ToString()!="")
         {
             model.replyStatus=int.Parse(row["replyStatus"].ToString());
         }
         if(row["replyPerson"]!=null)
         {
             model.replyPerson=row["replyPerson"].ToString();
         }
         if(row["replyContent"]!=null)
         {
             model.replyContent=row["replyContent"].ToString();
         }
         if(row["replyDate"]!=null && row["replyDate"].ToString()!="")
         {
             model.replyDate=DateTime.Parse(row["replyDate"].ToString());
         }
     }
     return model;
 }
示例#4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MxWeiXinPF.Model.wx_product_comment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_product_comment(");
            strSql.Append("hdId,openId,commentContent,commentType,commentRemark,createDate,replyStatus,replyPerson,replyContent,replyDate)");
            strSql.Append(" values (");
            strSql.Append("@hdId,@openId,@commentContent,@commentType,@commentRemark,@createDate,@replyStatus,@replyPerson,@replyContent,@replyDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@hdId",           SqlDbType.Int,          4),
                new SqlParameter("@openId",         SqlDbType.VarChar,    200),
                new SqlParameter("@commentContent", SqlDbType.VarChar,    500),
                new SqlParameter("@commentType",    SqlDbType.Int,          4),
                new SqlParameter("@commentRemark",  SqlDbType.VarChar,   2000),
                new SqlParameter("@createDate",     SqlDbType.DateTime),
                new SqlParameter("@replyStatus",    SqlDbType.Int,          4),
                new SqlParameter("@replyPerson",    SqlDbType.VarChar,     50),
                new SqlParameter("@replyContent",   SqlDbType.VarChar,   1000),
                new SqlParameter("@replyDate",      SqlDbType.DateTime)
            };
            parameters[0].Value = model.hdId;
            parameters[1].Value = model.openId;
            parameters[2].Value = model.commentContent;
            parameters[3].Value = model.commentType;
            parameters[4].Value = model.commentRemark;
            parameters[5].Value = model.createDate;
            parameters[6].Value = model.replyStatus;
            parameters[7].Value = model.replyPerson;
            parameters[8].Value = model.replyContent;
            parameters[9].Value = model.replyDate;

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

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

            strSql.Append("select  top 1 id,hdId,openId,commentContent,commentType,commentRemark,createDate,replyStatus,replyPerson,replyContent,replyDate from wx_product_comment ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_product_comment GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,hdId,openId,commentContent,commentType,commentRemark,createDate,replyStatus,replyPerson,replyContent,replyDate from wx_product_comment ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

            MxWeiXinPF.Model.wx_product_comment model=new MxWeiXinPF.Model.wx_product_comment();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }