示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WeiXinPF.Model.wx_wq_fuhuiSys GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,wid,newstitle,titlepic,newsurl,jscx,jscxpic,jscxurl,xsgw,xsgwpic,xsgwurl,zxyy,zxyypic,zxyyurl,czgh,czghpic,czghurl,sygj,sygjpic,sygjurl,cxxs,cxxspic,cxxsurl,createdate from wx_wq_fuhuiSys ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WeiXinPF.Model.wx_wq_fuhuiSys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_wq_fuhuiSys(");
            strSql.Append("wid,newstitle,titlepic,newsurl,jscx,jscxpic,jscxurl,xsgw,xsgwpic,xsgwurl,zxyy,zxyypic,zxyyurl,czgh,czghpic,czghurl,sygj,sygjpic,sygjurl,cxxs,cxxspic,cxxsurl,createdate)");
            strSql.Append(" values (");
            strSql.Append("@wid,@newstitle,@titlepic,@newsurl,@jscx,@jscxpic,@jscxurl,@xsgw,@xsgwpic,@xsgwurl,@zxyy,@zxyypic,@zxyyurl,@czgh,@czghpic,@czghurl,@sygj,@sygjpic,@sygjurl,@cxxs,@cxxspic,@cxxsurl,@createdate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,       4),
                new SqlParameter("@newstitle",  SqlDbType.VarChar, 800),
                new SqlParameter("@titlepic",   SqlDbType.VarChar, 800),
                new SqlParameter("@newsurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@jscx",       SqlDbType.VarChar, 300),
                new SqlParameter("@jscxpic",    SqlDbType.VarChar, 800),
                new SqlParameter("@jscxurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@xsgw",       SqlDbType.VarChar, 300),
                new SqlParameter("@xsgwpic",    SqlDbType.VarChar, 800),
                new SqlParameter("@xsgwurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@zxyy",       SqlDbType.VarChar, 300),
                new SqlParameter("@zxyypic",    SqlDbType.VarChar, 800),
                new SqlParameter("@zxyyurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@czgh",       SqlDbType.VarChar, 300),
                new SqlParameter("@czghpic",    SqlDbType.VarChar, 800),
                new SqlParameter("@czghurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@sygj",       SqlDbType.VarChar, 300),
                new SqlParameter("@sygjpic",    SqlDbType.VarChar, 800),
                new SqlParameter("@sygjurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@cxxs",       SqlDbType.VarChar, 300),
                new SqlParameter("@cxxspic",    SqlDbType.VarChar, 800),
                new SqlParameter("@cxxsurl",    SqlDbType.VarChar, 800),
                new SqlParameter("@createdate", SqlDbType.DateTime)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.newstitle;
            parameters[2].Value  = model.titlepic;
            parameters[3].Value  = model.newsurl;
            parameters[4].Value  = model.jscx;
            parameters[5].Value  = model.jscxpic;
            parameters[6].Value  = model.jscxurl;
            parameters[7].Value  = model.xsgw;
            parameters[8].Value  = model.xsgwpic;
            parameters[9].Value  = model.xsgwurl;
            parameters[10].Value = model.zxyy;
            parameters[11].Value = model.zxyypic;
            parameters[12].Value = model.zxyyurl;
            parameters[13].Value = model.czgh;
            parameters[14].Value = model.czghpic;
            parameters[15].Value = model.czghurl;
            parameters[16].Value = model.sygj;
            parameters[17].Value = model.sygjpic;
            parameters[18].Value = model.sygjurl;
            parameters[19].Value = model.cxxs;
            parameters[20].Value = model.cxxspic;
            parameters[21].Value = model.cxxsurl;
            parameters[22].Value = model.createdate;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WeiXinPF.Model.wx_wq_fuhuiSys DataRowToModel(DataRow row)
 {
     WeiXinPF.Model.wx_wq_fuhuiSys model = new WeiXinPF.Model.wx_wq_fuhuiSys();
     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["newstitle"] != null)
         {
             model.newstitle = row["newstitle"].ToString();
         }
         if (row["titlepic"] != null)
         {
             model.titlepic = row["titlepic"].ToString();
         }
         if (row["newsurl"] != null)
         {
             model.newsurl = row["newsurl"].ToString();
         }
         if (row["jscx"] != null)
         {
             model.jscx = row["jscx"].ToString();
         }
         if (row["jscxpic"] != null)
         {
             model.jscxpic = row["jscxpic"].ToString();
         }
         if (row["jscxurl"] != null)
         {
             model.jscxurl = row["jscxurl"].ToString();
         }
         if (row["xsgw"] != null)
         {
             model.xsgw = row["xsgw"].ToString();
         }
         if (row["xsgwpic"] != null)
         {
             model.xsgwpic = row["xsgwpic"].ToString();
         }
         if (row["xsgwurl"] != null)
         {
             model.xsgwurl = row["xsgwurl"].ToString();
         }
         if (row["zxyy"] != null)
         {
             model.zxyy = row["zxyy"].ToString();
         }
         if (row["zxyypic"] != null)
         {
             model.zxyypic = row["zxyypic"].ToString();
         }
         if (row["zxyyurl"] != null)
         {
             model.zxyyurl = row["zxyyurl"].ToString();
         }
         if (row["czgh"] != null)
         {
             model.czgh = row["czgh"].ToString();
         }
         if (row["czghpic"] != null)
         {
             model.czghpic = row["czghpic"].ToString();
         }
         if (row["czghurl"] != null)
         {
             model.czghurl = row["czghurl"].ToString();
         }
         if (row["sygj"] != null)
         {
             model.sygj = row["sygj"].ToString();
         }
         if (row["sygjpic"] != null)
         {
             model.sygjpic = row["sygjpic"].ToString();
         }
         if (row["sygjurl"] != null)
         {
             model.sygjurl = row["sygjurl"].ToString();
         }
         if (row["cxxs"] != null)
         {
             model.cxxs = row["cxxs"].ToString();
         }
         if (row["cxxspic"] != null)
         {
             model.cxxspic = row["cxxspic"].ToString();
         }
         if (row["cxxsurl"] != null)
         {
             model.cxxsurl = row["cxxsurl"].ToString();
         }
         if (row["createdate"] != null && row["createdate"].ToString() != "")
         {
             model.createdate = DateTime.Parse(row["createdate"].ToString());
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WeiXinPF.Model.wx_wq_fuhuiSys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_wq_fuhuiSys set ");
            strSql.Append("wid=@wid,");
            strSql.Append("newstitle=@newstitle,");
            strSql.Append("titlepic=@titlepic,");
            strSql.Append("newsurl=@newsurl,");
            strSql.Append("jscx=@jscx,");
            strSql.Append("jscxpic=@jscxpic,");
            strSql.Append("jscxurl=@jscxurl,");
            strSql.Append("xsgw=@xsgw,");
            strSql.Append("xsgwpic=@xsgwpic,");
            strSql.Append("xsgwurl=@xsgwurl,");
            strSql.Append("zxyy=@zxyy,");
            strSql.Append("zxyypic=@zxyypic,");
            strSql.Append("zxyyurl=@zxyyurl,");
            strSql.Append("czgh=@czgh,");
            strSql.Append("czghpic=@czghpic,");
            strSql.Append("czghurl=@czghurl,");
            strSql.Append("sygj=@sygj,");
            strSql.Append("sygjpic=@sygjpic,");
            strSql.Append("sygjurl=@sygjurl,");
            strSql.Append("cxxs=@cxxs,");
            strSql.Append("cxxspic=@cxxspic,");
            strSql.Append("cxxsurl=@cxxsurl,");
            strSql.Append("createdate=@createdate");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,         4),
                new SqlParameter("@newstitle",  SqlDbType.VarChar,   800),
                new SqlParameter("@titlepic",   SqlDbType.VarChar,   800),
                new SqlParameter("@newsurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@jscx",       SqlDbType.VarChar,   300),
                new SqlParameter("@jscxpic",    SqlDbType.VarChar,   800),
                new SqlParameter("@jscxurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@xsgw",       SqlDbType.VarChar,   300),
                new SqlParameter("@xsgwpic",    SqlDbType.VarChar,   800),
                new SqlParameter("@xsgwurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@zxyy",       SqlDbType.VarChar,   300),
                new SqlParameter("@zxyypic",    SqlDbType.VarChar,   800),
                new SqlParameter("@zxyyurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@czgh",       SqlDbType.VarChar,   300),
                new SqlParameter("@czghpic",    SqlDbType.VarChar,   800),
                new SqlParameter("@czghurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@sygj",       SqlDbType.VarChar,   300),
                new SqlParameter("@sygjpic",    SqlDbType.VarChar,   800),
                new SqlParameter("@sygjurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@cxxs",       SqlDbType.VarChar,   300),
                new SqlParameter("@cxxspic",    SqlDbType.VarChar,   800),
                new SqlParameter("@cxxsurl",    SqlDbType.VarChar,   800),
                new SqlParameter("@createdate", SqlDbType.DateTime),
                new SqlParameter("@Id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.wid;
            parameters[1].Value  = model.newstitle;
            parameters[2].Value  = model.titlepic;
            parameters[3].Value  = model.newsurl;
            parameters[4].Value  = model.jscx;
            parameters[5].Value  = model.jscxpic;
            parameters[6].Value  = model.jscxurl;
            parameters[7].Value  = model.xsgw;
            parameters[8].Value  = model.xsgwpic;
            parameters[9].Value  = model.xsgwurl;
            parameters[10].Value = model.zxyy;
            parameters[11].Value = model.zxyypic;
            parameters[12].Value = model.zxyyurl;
            parameters[13].Value = model.czgh;
            parameters[14].Value = model.czghpic;
            parameters[15].Value = model.czghurl;
            parameters[16].Value = model.sygj;
            parameters[17].Value = model.sygjpic;
            parameters[18].Value = model.sygjurl;
            parameters[19].Value = model.cxxs;
            parameters[20].Value = model.cxxspic;
            parameters[21].Value = model.cxxsurl;
            parameters[22].Value = model.createdate;
            parameters[23].Value = model.Id;

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

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