/// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(Model.ProductImgMobile model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProductImgMobile set ");
            strSql.Append("typeId=@typeId,");
            strSql.Append("typeName=@typeName,");
            strSql.Append("productId=@productId,");
            strSql.Append("orderNum=@orderNum,");
            strSql.Append("imgUrl=@imgUrl,");
            strSql.Append("status=@status,");
            strSql.Append("remark=@remark,");
            strSql.Append("addTime=@addTime,");
            strSql.Append("addUser=@addUser,");
            strSql.Append("infoType=@infoType");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeId",    SqlDbType.Int,         4),
                new SqlParameter("@typeName",  SqlDbType.VarChar,   150),
                new SqlParameter("@productId", SqlDbType.Int,         4),
                new SqlParameter("@orderNum",  SqlDbType.Int,         4),
                new SqlParameter("@imgUrl",    SqlDbType.VarChar,   150),
                new SqlParameter("@status",    SqlDbType.Int,         4),
                new SqlParameter("@remark",    SqlDbType.NText),
                new SqlParameter("@addTime",   SqlDbType.DateTime),
                new SqlParameter("@addUser",   SqlDbType.Int,         4),
                new SqlParameter("@infoType",  SqlDbType.Int,         4),
                new SqlParameter("@id",        SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.typeId;
            parameters[1].Value  = model.typeName;
            parameters[2].Value  = model.productId;
            parameters[3].Value  = model.orderNum;
            parameters[4].Value  = model.imgUrl;
            parameters[5].Value  = model.status;
            parameters[6].Value  = model.remark;
            parameters[7].Value  = model.addTime;
            parameters[8].Value  = model.addUser;
            parameters[9].Value  = model.infoType;
            parameters[10].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public static Model.ProductImgMobile DataRowToModel(DataRow row)
 {
     Model.ProductImgMobile model = new Model.ProductImgMobile();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["typeId"] != null && row["typeId"].ToString() != "")
         {
             model.typeId = int.Parse(row["typeId"].ToString());
         }
         if (row["typeName"] != null)
         {
             model.typeName = row["typeName"].ToString();
         }
         if (row["productId"] != null && row["productId"].ToString() != "")
         {
             model.productId = int.Parse(row["productId"].ToString());
         }
         if (row["orderNum"] != null && row["orderNum"].ToString() != "")
         {
             model.orderNum = int.Parse(row["orderNum"].ToString());
         }
         if (row["imgUrl"] != null)
         {
             model.imgUrl = row["imgUrl"].ToString();
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["addTime"] != null && row["addTime"].ToString() != "")
         {
             model.addTime = DateTime.Parse(row["addTime"].ToString());
         }
         if (row["addUser"] != null && row["addUser"].ToString() != "")
         {
             model.addUser = int.Parse(row["addUser"].ToString());
         }
         if (row["infoType"] != null && row["infoType"].ToString() != "")
         {
             model.infoType = int.Parse(row["infoType"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static int Add(Model.ProductImgMobile model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProductImgMobile(");
            strSql.Append("typeId,typeName,productId,orderNum,imgUrl,status,remark,addTime,addUser,infoType)");
            strSql.Append(" values (");
            strSql.Append("@typeId,@typeName,@productId,@orderNum,@imgUrl,@status,@remark,@addTime,@addUser,@infoType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeId",    SqlDbType.Int,         4),
                new SqlParameter("@typeName",  SqlDbType.VarChar,   150),
                new SqlParameter("@productId", SqlDbType.Int,         4),
                new SqlParameter("@orderNum",  SqlDbType.Int,         4),
                new SqlParameter("@imgUrl",    SqlDbType.VarChar,   150),
                new SqlParameter("@status",    SqlDbType.Int,         4),
                new SqlParameter("@remark",    SqlDbType.NText),
                new SqlParameter("@addTime",   SqlDbType.DateTime),
                new SqlParameter("@addUser",   SqlDbType.Int,         4),
                new SqlParameter("@infoType",  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.typeId;
            parameters[1].Value = model.typeName;
            parameters[2].Value = model.productId;
            parameters[3].Value = model.orderNum;
            parameters[4].Value = model.imgUrl;
            parameters[5].Value = model.status;
            parameters[6].Value = model.remark;
            parameters[7].Value = model.addTime;
            parameters[8].Value = model.addUser;
            parameters[9].Value = model.infoType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 获取移动端日记Banner
        /// </summary>
        /// <param name="productId"></param>
        /// <returns></returns>
        public static ProductImgMobile GetMobileBanner(int productId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,typeId,typeName,productId,orderNum,imgUrl,status,remark,addTime,addUser,infoType from ProductImgMobile ");
            strSql.Append(" where productId=@productId and status = 1 order by id desc");
            SqlParameter[] parameters =
            {
                new SqlParameter("@productId", SqlDbType.Int, 4)
            };
            parameters[0].Value = productId;

            Model.ProductImgMobile model = new Model.ProductImgMobile();
            DataSet ds = DBHelperSQL.Query(strSql.ToString(), parameters);

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