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

            strSql.Append("update wx_wq_sygj set ");
            strSql.Append("Id=@Id,");
            strSql.Append("url=@url,");
            strSql.Append("Name=@Name,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("createdate=@createdate,");
            strSql.Append("gjstatus=@gjstatus,");
            strSql.Append("wid=@wid");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",         SqlDbType.Int,         4),
                new SqlParameter("@url",        SqlDbType.VarChar,   800),
                new SqlParameter("@Name",       SqlDbType.VarChar,   300),
                new SqlParameter("@sort_id",    SqlDbType.Int,         4),
                new SqlParameter("@createdate", SqlDbType.DateTime),
                new SqlParameter("@gjstatus",   SqlDbType.Int,         4),
                new SqlParameter("@wid",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.url;
            parameters[2].Value = model.Name;
            parameters[3].Value = model.sort_id;
            parameters[4].Value = model.createdate;
            parameters[5].Value = model.gjstatus;
            parameters[6].Value = model.wid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_wq_sygj GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,url,Name,sort_id,createdate,gjstatus,wid from wx_wq_sygj ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MxWeiXinPF.Model.wx_wq_sygj model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_wq_sygj(");
            strSql.Append("Id,url,Name,sort_id,createdate,gjstatus,wid)");
            strSql.Append(" values (");
            strSql.Append("@Id,@url,@Name,@sort_id,@createdate,@gjstatus,@wid)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",         SqlDbType.Int,         4),
                new SqlParameter("@url",        SqlDbType.VarChar,   800),
                new SqlParameter("@Name",       SqlDbType.VarChar,   300),
                new SqlParameter("@sort_id",    SqlDbType.Int,         4),
                new SqlParameter("@createdate", SqlDbType.DateTime),
                new SqlParameter("@gjstatus",   SqlDbType.Int,         4),
                new SqlParameter("@wid",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Id;
            parameters[1].Value = model.url;
            parameters[2].Value = model.Name;
            parameters[3].Value = model.sort_id;
            parameters[4].Value = model.createdate;
            parameters[5].Value = model.gjstatus;
            parameters[6].Value = model.wid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_wq_sygj DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_wq_sygj model = new MxWeiXinPF.Model.wx_wq_sygj();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["url"] != null)
         {
             model.url = row["url"].ToString();
         }
         if (row["Name"] != null)
         {
             model.Name = row["Name"].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["gjstatus"] != null && row["gjstatus"].ToString() != "")
         {
             model.gjstatus = int.Parse(row["gjstatus"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
     }
     return(model);
 }