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.失败); }
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)); }
public static int Update(Product_commentInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
private static void RemoveCache(Product_commentInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("pifa_BLL_Product_comment_", item.Id)); }
public static Product_commentInfo Insert(Product_commentInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
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); }
public ActionResult Edit([FromQuery] uint Id) { Product_commentInfo item = Product_comment.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } ViewBag.item = item; return(View()); }
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()); }
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) }); }
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())); }
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); }
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); }
public SqlUpdateBuild(Product_commentInfo item, uint Id) { _item = item; _where = SqlHelper.Addslashes("`id` = {0}", Id); }