protected static MySqlParameter[] GetParameters(NewsdescInfo item) { return(new MySqlParameter[] { GetParameter("?news_id", MySqlDbType.UInt32, 10, item.News_id), GetParameter("?content", MySqlDbType.Text, -1, item.Content) }); }
private static void RemoveCache(NewsdescInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("pifa_BLL_Newsdesc_", item.News_id)); }
public static pifa.DAL.Newsdesc.SqlUpdateBuild UpdateDiy(NewsdescInfo item, uint News_id) { if (itemCacheTimeout > 0) { RemoveCache(item != null ? item : GetItem(News_id)); } return(new pifa.DAL.Newsdesc.SqlUpdateBuild(item, News_id)); }
public static int Update(NewsdescInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
public APIReturn _Add([FromForm] uint?News_id, [FromForm] string Content) { NewsdescInfo item = new NewsdescInfo(); item.News_id = News_id; item.Content = Content; item = Newsdesc.Insert(item); return(APIReturn.成功.SetData("item", item.ToBson())); }
public static NewsdescInfo Insert(NewsdescInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
public ActionResult Edit([FromQuery] uint News_id) { NewsdescInfo item = Newsdesc.GetItem(News_id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } ViewBag.item = item; return(View()); }
public object GetItem(IDataReader dr, ref int index) { NewsdescInfo item = new NewsdescInfo(); if (!dr.IsDBNull(++index)) { item.News_id = (uint?)dr.GetInt32(index); } if (!dr.IsDBNull(++index)) { item.Content = dr.GetString(index); } return(item); }
public APIReturn _Edit([FromQuery] uint News_id, [FromForm] string Content) { NewsdescInfo item = Newsdesc.GetItem(News_id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } item.Content = Content; int affrows = Newsdesc.Update(item); if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public static NewsdescInfo GetItem(uint News_id) { if (itemCacheTimeout <= 0) { return(Select.WhereNews_id(News_id).ToOne()); } string key = string.Concat("pifa_BLL_Newsdesc_", News_id); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(NewsdescInfo.Parse(value)); } catch { } } NewsdescInfo item = Select.WhereNews_id(News_id).ToOne(); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
public SqlUpdateBuild(NewsdescInfo item, uint News_id) { _item = item; _where = SqlHelper.Addslashes("`news_id` = {0}", News_id); }
public int Update(NewsdescInfo item) { return(new SqlUpdateBuild(null, item.News_id.Value) .SetContent(item.Content).ExecuteNonQuery()); }
public NewsdescInfo Insert(NewsdescInfo item) { SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item)); return(item); }