Exemple #1
0
        public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Member_id, [FromForm] uint?Order_id, [FromForm] uint?Product_id, [FromForm] uint?Productitem_id, [FromForm] string Content, [FromForm] string Nickname, [FromForm] byte?Star_price, [FromForm] byte?Star_quality, [FromForm] byte?Star_value, [FromForm] Product_commentSTATE?State, [FromForm] string Title, [FromForm] string Upload_image_url)
        {
            Product_commentInfo item = Product_comment.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.Member_id        = Member_id;
            item.Order_id         = Order_id;
            item.Product_id       = Product_id;
            item.Productitem_id   = Productitem_id;
            item.Content          = Content;
            item.Create_time      = DateTime.Now;
            item.Nickname         = Nickname;
            item.Star_price       = Star_price;
            item.Star_quality     = Star_quality;
            item.Star_value       = Star_value;
            item.State            = State;
            item.Title            = Title;
            item.Upload_image_url = Upload_image_url;
            int affrows = Product_comment.Update(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Exemple #2
0
 public static pifa.DAL.Product_comment.SqlUpdateBuild UpdateDiy(Product_commentInfo item, uint Id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Id));
     }
     return(new pifa.DAL.Product_comment.SqlUpdateBuild(item, Id));
 }
Exemple #3
0
 public static int Update(Product_commentInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Exemple #4
0
 private static void RemoveCache(Product_commentInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Product_comment_", item.Id));
 }
Exemple #5
0
 public static Product_commentInfo Insert(Product_commentInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Exemple #6
0
        public Product_commentInfo Insert(Product_commentInfo item)
        {
            uint loc1;

            if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1))
            {
                item.Id = loc1;
            }
            return(item);
        }
Exemple #7
0
        public ActionResult Edit([FromQuery] uint Id)
        {
            Product_commentInfo item = Product_comment.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Exemple #8
0
 public int Update(Product_commentInfo item)
 {
     return(new SqlUpdateBuild(null, item.Id.Value)
            .SetMember_id(item.Member_id)
            .SetOrder_id(item.Order_id)
            .SetProduct_id(item.Product_id)
            .SetProductitem_id(item.Productitem_id)
            .SetContent(item.Content)
            .SetCreate_time(item.Create_time)
            .SetNickname(item.Nickname)
            .SetStar_price(item.Star_price)
            .SetStar_quality(item.Star_quality)
            .SetStar_value(item.Star_value)
            .SetState(item.State)
            .SetTitle(item.Title)
            .SetUpload_image_url(item.Upload_image_url).ExecuteNonQuery());
 }
Exemple #9
0
 protected static MySqlParameter[] GetParameters(Product_commentInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?id", MySqlDbType.UInt32, 10, item.Id),
         GetParameter("?member_id", MySqlDbType.UInt32, 10, item.Member_id),
         GetParameter("?order_id", MySqlDbType.UInt32, 10, item.Order_id),
         GetParameter("?product_id", MySqlDbType.UInt32, 10, item.Product_id),
         GetParameter("?productitem_id", MySqlDbType.UInt32, 10, item.Productitem_id),
         GetParameter("?content", MySqlDbType.VarChar, 255, item.Content),
         GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time),
         GetParameter("?nickname", MySqlDbType.VarChar, 255, item.Nickname),
         GetParameter("?star_price", MySqlDbType.UByte, 3, item.Star_price),
         GetParameter("?star_quality", MySqlDbType.UByte, 3, item.Star_quality),
         GetParameter("?star_value", MySqlDbType.UByte, 3, item.Star_value),
         GetParameter("?state", MySqlDbType.Enum, -1, item.State?.ToInt64()),
         GetParameter("?title", MySqlDbType.VarChar, 255, item.Title),
         GetParameter("?upload_image_url", MySqlDbType.VarChar, 255, item.Upload_image_url)
     });
 }
Exemple #10
0
        public APIReturn _Add([FromForm] uint?Member_id, [FromForm] uint?Order_id, [FromForm] uint?Product_id, [FromForm] uint?Productitem_id, [FromForm] string Content, [FromForm] string Nickname, [FromForm] byte?Star_price, [FromForm] byte?Star_quality, [FromForm] byte?Star_value, [FromForm] Product_commentSTATE?State, [FromForm] string Title, [FromForm] string Upload_image_url)
        {
            Product_commentInfo item = new Product_commentInfo();

            item.Member_id        = Member_id;
            item.Order_id         = Order_id;
            item.Product_id       = Product_id;
            item.Productitem_id   = Productitem_id;
            item.Content          = Content;
            item.Create_time      = DateTime.Now;
            item.Nickname         = Nickname;
            item.Star_price       = Star_price;
            item.Star_quality     = Star_quality;
            item.Star_value       = Star_value;
            item.State            = State;
            item.Title            = Title;
            item.Upload_image_url = Upload_image_url;
            item = Product_comment.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Exemple #11
0
        public static Product_commentInfo GetItem(uint Id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereId(Id).ToOne());
            }
            string key   = string.Concat("pifa_BLL_Product_comment_", Id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(Product_commentInfo.Parse(value)); } catch { }
            }
            Product_commentInfo item = Select.WhereId(Id).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Exemple #12
0
        public object GetItem(IDataReader dr, ref int index)
        {
            Product_commentInfo item = new Product_commentInfo();

            if (!dr.IsDBNull(++index))
            {
                item.Id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Member_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Order_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Product_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Productitem_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Content = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Create_time = (DateTime?)dr.GetDateTime(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Nickname = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Star_price = (byte?)dr.GetByte(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Star_quality = (byte?)dr.GetByte(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Star_value = (byte?)dr.GetByte(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.State = (Product_commentSTATE?)dr.GetInt64(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Title = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Upload_image_url = dr.GetString(index);
            }
            return(item);
        }
Exemple #13
0
 public SqlUpdateBuild(Product_commentInfo item, uint Id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`id` = {0}", Id);
 }