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

            strSql.Append("update wx_fc_zjComment set ");
            strSql.Append("wid=@wid,");
            strSql.Append("title=@title,");
            strSql.Append("zjname=@zjname,");
            strSql.Append("zjPosition=@zjPosition,");
            strSql.Append("zjPhoto=@zjPhoto,");
            strSql.Append("dpContent=@dpContent,");
            strSql.Append("zjJieshao=@zjJieshao,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("createdate=@createdate,");
            strSql.Append("fid=@fid");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@title",      SqlDbType.VarChar,   4000),
                new SqlParameter("@zjname",     SqlDbType.VarChar,    300),
                new SqlParameter("@zjPosition", SqlDbType.VarChar,    300),
                new SqlParameter("@zjPhoto",    SqlDbType.VarChar,    500),
                new SqlParameter("@dpContent",  SqlDbType.VarChar,    800),
                new SqlParameter("@zjJieshao",  SqlDbType.VarChar,    500),
                new SqlParameter("@sort_id",    SqlDbType.Int,          4),
                new SqlParameter("@createdate", SqlDbType.DateTime),
                new SqlParameter("@fid",        SqlDbType.Int,          4),
                new SqlParameter("@Id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.title;
            parameters[2].Value  = model.zjname;
            parameters[3].Value  = model.zjPosition;
            parameters[4].Value  = model.zjPhoto;
            parameters[5].Value  = model.dpContent;
            parameters[6].Value  = model.zjJieshao;
            parameters[7].Value  = model.sort_id;
            parameters[8].Value  = model.createdate;
            parameters[9].Value  = model.fid;
            parameters[10].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_fc_zjComment DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_fc_zjComment model = new MxWeiXinPF.Model.wx_fc_zjComment();
     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["title"] != null)
         {
             model.title = row["title"].ToString();
         }
         if (row["zjname"] != null)
         {
             model.zjname = row["zjname"].ToString();
         }
         if (row["zjPosition"] != null)
         {
             model.zjPosition = row["zjPosition"].ToString();
         }
         if (row["zjPhoto"] != null)
         {
             model.zjPhoto = row["zjPhoto"].ToString();
         }
         if (row["dpContent"] != null)
         {
             model.dpContent = row["dpContent"].ToString();
         }
         if (row["zjJieshao"] != null)
         {
             model.zjJieshao = row["zjJieshao"].ToString();
         }
         if (row["sort_id"] != null && row["sort_id"].ToString() != "")
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (row["createdate"] != null && row["createdate"].ToString() != "")
         {
             model.createdate = DateTime.Parse(row["createdate"].ToString());
         }
         if (row["fid"] != null && row["fid"].ToString() != "")
         {
             model.fid = int.Parse(row["fid"].ToString());
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MxWeiXinPF.Model.wx_fc_zjComment model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_fc_zjComment(");
            strSql.Append("wid,title,zjname,zjPosition,zjPhoto,dpContent,zjJieshao,sort_id,createdate,fid)");
            strSql.Append(" values (");
            strSql.Append("@wid,@title,@zjname,@zjPosition,@zjPhoto,@dpContent,@zjJieshao,@sort_id,@createdate,@fid)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@title",      SqlDbType.VarChar,   4000),
                new SqlParameter("@zjname",     SqlDbType.VarChar,    300),
                new SqlParameter("@zjPosition", SqlDbType.VarChar,    300),
                new SqlParameter("@zjPhoto",    SqlDbType.VarChar,    500),
                new SqlParameter("@dpContent",  SqlDbType.VarChar,    800),
                new SqlParameter("@zjJieshao",  SqlDbType.VarChar,    500),
                new SqlParameter("@sort_id",    SqlDbType.Int,          4),
                new SqlParameter("@createdate", SqlDbType.DateTime),
                new SqlParameter("@fid",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.wid;
            parameters[1].Value = model.title;
            parameters[2].Value = model.zjname;
            parameters[3].Value = model.zjPosition;
            parameters[4].Value = model.zjPhoto;
            parameters[5].Value = model.dpContent;
            parameters[6].Value = model.zjJieshao;
            parameters[7].Value = model.sort_id;
            parameters[8].Value = model.createdate;
            parameters[9].Value = model.fid;

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

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

            strSql.Append("select  top 1 Id,wid,title,zjname,zjPosition,zjPhoto,dpContent,zjJieshao,sort_id,createdate,fid from wx_fc_zjComment ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

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