public object GetItem(IDataReader dr, ref int index) { Shop_friendly_linksInfo item = new Shop_friendly_linksInfo(); if (!dr.IsDBNull(++index)) { item.Id = (uint?)dr.GetInt32(index); } if (!dr.IsDBNull(++index)) { item.Shop_id = (uint?)dr.GetInt32(index); } if (!dr.IsDBNull(++index)) { item.Create_time = (DateTime?)dr.GetDateTime(index); } if (!dr.IsDBNull(++index)) { item.Sort = (byte?)dr.GetByte(index); } if (!dr.IsDBNull(++index)) { item.Title = dr.GetString(index); } if (!dr.IsDBNull(++index)) { item.Url = dr.GetString(index); } return(item); }
private static void RemoveCache(Shop_friendly_linksInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("pifa_BLL_Shop_friendly_links_", item.Id)); }
public static pifa.DAL.Shop_friendly_links.SqlUpdateBuild UpdateDiy(Shop_friendly_linksInfo item, uint Id) { if (itemCacheTimeout > 0) { RemoveCache(item != null ? item : GetItem(Id)); } return(new pifa.DAL.Shop_friendly_links.SqlUpdateBuild(item, Id)); }
public static int Update(Shop_friendly_linksInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
public static Shop_friendly_linksInfo Insert(Shop_friendly_linksInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
public int Update(Shop_friendly_linksInfo item) { return(new SqlUpdateBuild(null, item.Id.Value) .SetShop_id(item.Shop_id) .SetCreate_time(item.Create_time) .SetSort(item.Sort) .SetTitle(item.Title) .SetUrl(item.Url).ExecuteNonQuery()); }
public Shop_friendly_linksInfo Insert(Shop_friendly_linksInfo item) { uint loc1; if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1)) { item.Id = loc1; } return(item); }
protected static MySqlParameter[] GetParameters(Shop_friendly_linksInfo item) { return(new MySqlParameter[] { GetParameter("?id", MySqlDbType.UInt32, 10, item.Id), GetParameter("?shop_id", MySqlDbType.UInt32, 10, item.Shop_id), GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time), GetParameter("?sort", MySqlDbType.UByte, 3, item.Sort), GetParameter("?title", MySqlDbType.VarChar, 255, item.Title), GetParameter("?url", MySqlDbType.VarChar, 255, item.Url) }); }
public ActionResult Edit([FromQuery] uint Id) { Shop_friendly_linksInfo item = Shop_friendly_links.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } ViewBag.item = item; return(View()); }
public APIReturn _Add([FromForm] uint?Shop_id, [FromForm] byte?Sort, [FromForm] string Title, [FromForm] string Url) { Shop_friendly_linksInfo item = new Shop_friendly_linksInfo(); item.Shop_id = Shop_id; item.Create_time = DateTime.Now; item.Sort = Sort; item.Title = Title; item.Url = Url; item = Shop_friendly_links.Insert(item); return(APIReturn.成功.SetData("item", item.ToBson())); }
public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Shop_id, [FromForm] byte?Sort, [FromForm] string Title, [FromForm] string Url) { Shop_friendly_linksInfo item = Shop_friendly_links.GetItem(Id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } item.Shop_id = Shop_id; item.Create_time = DateTime.Now; item.Sort = Sort; item.Title = Title; item.Url = Url; int affrows = Shop_friendly_links.Update(item); if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public static Shop_friendly_linksInfo GetItem(uint Id) { if (itemCacheTimeout <= 0) { return(Select.WhereId(Id).ToOne()); } string key = string.Concat("pifa_BLL_Shop_friendly_links_", Id); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(Shop_friendly_linksInfo.Parse(value)); } catch { } } Shop_friendly_linksInfo item = Select.WhereId(Id).ToOne(); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
public SqlUpdateBuild(Shop_friendly_linksInfo item, uint Id) { _item = item; _where = SqlHelper.Addslashes("`id` = {0}", Id); }