Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WeiXinPF.Model.wx_pano_jd model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_pano_jd(");
            strSql.Append("sysId,wid,jdName,music,pic_front,pic_right,pic_behind,pic_left,pic_top,pic_bottom,pic_yulan,remark,seq,createDate,extStr,extStr2)");
            strSql.Append(" values (");
            strSql.Append("@sysId,@wid,@jdName,@music,@pic_front,@pic_right,@pic_behind,@pic_left,@pic_top,@pic_bottom,@pic_yulan,@remark,@seq,@createDate,@extStr,@extStr2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sysId",      SqlDbType.Int,          4),
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@jdName",     SqlDbType.VarChar,    100),
                new SqlParameter("@music",      SqlDbType.VarChar,    800),
                new SqlParameter("@pic_front",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_right",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_behind", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_left",   SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_top",    SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_bottom", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_yulan",  SqlDbType.VarChar,   1000),
                new SqlParameter("@remark",     SqlDbType.VarChar,   2000),
                new SqlParameter("@seq",        SqlDbType.Int,          4),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@extStr",     SqlDbType.VarChar,    800),
                new SqlParameter("@extStr2",    SqlDbType.VarChar, 1000)
            };
            parameters[0].Value  = model.sysId;
            parameters[1].Value  = model.wid;
            parameters[2].Value  = model.jdName;
            parameters[3].Value  = model.music;
            parameters[4].Value  = model.pic_front;
            parameters[5].Value  = model.pic_right;
            parameters[6].Value  = model.pic_behind;
            parameters[7].Value  = model.pic_left;
            parameters[8].Value  = model.pic_top;
            parameters[9].Value  = model.pic_bottom;
            parameters[10].Value = model.pic_yulan;
            parameters[11].Value = model.remark;
            parameters[12].Value = model.seq;
            parameters[13].Value = model.createDate;
            parameters[14].Value = model.extStr;
            parameters[15].Value = model.extStr2;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WeiXinPF.Model.wx_pano_jd GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,sysId,wid,jdName,music,pic_front,pic_right,pic_behind,pic_left,pic_top,pic_bottom,pic_yulan,remark,seq,createDate,extStr,extStr2 from wx_pano_jd ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WeiXinPF.Model.wx_pano_jd DataRowToModel(DataRow row)
 {
     WeiXinPF.Model.wx_pano_jd model = new WeiXinPF.Model.wx_pano_jd();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["sysId"] != null && row["sysId"].ToString() != "")
         {
             model.sysId = int.Parse(row["sysId"].ToString());
         }
         if (row["wid"] != null && row["wid"].ToString() != "")
         {
             model.wid = int.Parse(row["wid"].ToString());
         }
         if (row["jdName"] != null)
         {
             model.jdName = row["jdName"].ToString();
         }
         if (row["music"] != null)
         {
             model.music = row["music"].ToString();
         }
         if (row["pic_front"] != null)
         {
             model.pic_front = row["pic_front"].ToString();
         }
         if (row["pic_right"] != null)
         {
             model.pic_right = row["pic_right"].ToString();
         }
         if (row["pic_behind"] != null)
         {
             model.pic_behind = row["pic_behind"].ToString();
         }
         if (row["pic_left"] != null)
         {
             model.pic_left = row["pic_left"].ToString();
         }
         if (row["pic_top"] != null)
         {
             model.pic_top = row["pic_top"].ToString();
         }
         if (row["pic_bottom"] != null)
         {
             model.pic_bottom = row["pic_bottom"].ToString();
         }
         if (row["pic_yulan"] != null)
         {
             model.pic_yulan = row["pic_yulan"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["seq"] != null && row["seq"].ToString() != "")
         {
             model.seq = int.Parse(row["seq"].ToString());
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["extStr"] != null)
         {
             model.extStr = row["extStr"].ToString();
         }
         if (row["extStr2"] != null)
         {
             model.extStr2 = row["extStr2"].ToString();
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WeiXinPF.Model.wx_pano_jd model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_pano_jd set ");
            strSql.Append("sysId=@sysId,");
            strSql.Append("wid=@wid,");
            strSql.Append("jdName=@jdName,");
            strSql.Append("music=@music,");
            strSql.Append("pic_front=@pic_front,");
            strSql.Append("pic_right=@pic_right,");
            strSql.Append("pic_behind=@pic_behind,");
            strSql.Append("pic_left=@pic_left,");
            strSql.Append("pic_top=@pic_top,");
            strSql.Append("pic_bottom=@pic_bottom,");
            strSql.Append("pic_yulan=@pic_yulan,");
            strSql.Append("remark=@remark,");
            strSql.Append("seq=@seq,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("extStr=@extStr,");
            strSql.Append("extStr2=@extStr2");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@sysId",      SqlDbType.Int,          4),
                new SqlParameter("@wid",        SqlDbType.Int,          4),
                new SqlParameter("@jdName",     SqlDbType.VarChar,    100),
                new SqlParameter("@music",      SqlDbType.VarChar,    800),
                new SqlParameter("@pic_front",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_right",  SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_behind", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_left",   SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_top",    SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_bottom", SqlDbType.VarChar,   1000),
                new SqlParameter("@pic_yulan",  SqlDbType.VarChar,   1000),
                new SqlParameter("@remark",     SqlDbType.VarChar,   2000),
                new SqlParameter("@seq",        SqlDbType.Int,          4),
                new SqlParameter("@createDate", SqlDbType.DateTime),
                new SqlParameter("@extStr",     SqlDbType.VarChar,    800),
                new SqlParameter("@extStr2",    SqlDbType.VarChar,   1000),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.sysId;
            parameters[1].Value  = model.wid;
            parameters[2].Value  = model.jdName;
            parameters[3].Value  = model.music;
            parameters[4].Value  = model.pic_front;
            parameters[5].Value  = model.pic_right;
            parameters[6].Value  = model.pic_behind;
            parameters[7].Value  = model.pic_left;
            parameters[8].Value  = model.pic_top;
            parameters[9].Value  = model.pic_bottom;
            parameters[10].Value = model.pic_yulan;
            parameters[11].Value = model.remark;
            parameters[12].Value = model.seq;
            parameters[13].Value = model.createDate;
            parameters[14].Value = model.extStr;
            parameters[15].Value = model.extStr2;
            parameters[16].Value = model.id;

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

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