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

            strSql.Append("update wx_pano_sys set ");
            strSql.Append("wid=@wid,");
            strSql.Append("backPic=@backPic,");
            strSql.Append("seriesId=@seriesId,");
            strSql.Append("seriesName=@seriesName,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("seq=@seq");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@backPic",    SqlDbType.VarChar,   1000),
                new SqlParameter("@seriesId",   SqlDbType.Int,          4),
                new SqlParameter("@seriesName", SqlDbType.VarChar,    300),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@seq",        SqlDbType.Int,          4),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.wid;
            parameters[1].Value = model.backPic;
            parameters[2].Value = model.seriesId;
            parameters[3].Value = model.seriesName;
            parameters[4].Value = model.createDate;
            parameters[5].Value = model.seq;
            parameters[6].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WechatBuilder.Model.wx_pano_sys model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_pano_sys(");
            strSql.Append("wid,backPic,seriesId,seriesName,createDate,seq)");
            strSql.Append(" values (");
            strSql.Append("@wid,@backPic,@seriesId,@seriesName,@createDate,@seq)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@backPic",    SqlDbType.VarChar,   1000),
                new SqlParameter("@seriesId",   SqlDbType.Int,          4),
                new SqlParameter("@seriesName", SqlDbType.VarChar,    300),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@seq",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.wid;
            parameters[1].Value = model.backPic;
            parameters[2].Value = model.seriesId;
            parameters[3].Value = model.seriesName;
            parameters[4].Value = model.createDate;
            parameters[5].Value = model.seq;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WechatBuilder.Model.wx_pano_sys DataRowToModel(DataRow row)
 {
     WechatBuilder.Model.wx_pano_sys model = new WechatBuilder.Model.wx_pano_sys();
     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["backPic"] != null)
         {
             model.backPic = row["backPic"].ToString();
         }
         if (row["seriesId"] != null && row["seriesId"].ToString() != "")
         {
             model.seriesId = int.Parse(row["seriesId"].ToString());
         }
         if (row["seriesName"] != null)
         {
             model.seriesName = row["seriesName"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["seq"] != null && row["seq"].ToString() != "")
         {
             model.seq = int.Parse(row["seq"].ToString());
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WechatBuilder.Model.wx_pano_sys GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,wid,backPic,seriesId,seriesName,createDate,seq from wx_pano_sys ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_pano_sys DataRowToModel(DataRow row)
		{
			WechatBuilder.Model.wx_pano_sys model=new WechatBuilder.Model.wx_pano_sys();
			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["backPic"]!=null)
				{
					model.backPic=row["backPic"].ToString();
				}
				if(row["seriesId"]!=null && row["seriesId"].ToString()!="")
				{
					model.seriesId=int.Parse(row["seriesId"].ToString());
				}
				if(row["seriesName"]!=null)
				{
					model.seriesName=row["seriesName"].ToString();
				}
				if(row["createDate"]!=null && row["createDate"].ToString()!="")
				{
					model.createDate=DateTime.Parse(row["createDate"].ToString());
				}
				if(row["seq"]!=null && row["seq"].ToString()!="")
				{
					model.seq=int.Parse(row["seq"].ToString());
				}
			}
			return model;
		}
示例#6
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public WechatBuilder.Model.wx_pano_sys GetModel(int id)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 id,wid,backPic,seriesId,seriesName,createDate,seq from wx_pano_sys ");
			strSql.Append(" where id=@id");
			SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
			parameters[0].Value = id;

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