public object GetItem(IDataReader dr, ref int index) { ShopsecurityInfo item = new ShopsecurityInfo(); if (!dr.IsDBNull(++index)) { item.Shop_id = (uint?)dr.GetInt32(index); } if (!dr.IsDBNull(++index)) { item.Idcard = dr.GetString(index); } if (!dr.IsDBNull(++index)) { item.Idcard_img1 = dr.GetString(index); } if (!dr.IsDBNull(++index)) { item.Idcard_img2 = dr.GetString(index); } if (!dr.IsDBNull(++index)) { item.License_img = dr.GetString(index); } return(item); }
public static pifa.DAL.Shopsecurity.SqlUpdateBuild UpdateDiy(ShopsecurityInfo item, uint Shop_id) { if (itemCacheTimeout > 0) { RemoveCache(item != null ? item : GetItem(Shop_id)); } return(new pifa.DAL.Shopsecurity.SqlUpdateBuild(item, Shop_id)); }
public static int Update(ShopsecurityInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
public int Update(ShopsecurityInfo item) { return(new SqlUpdateBuild(null, item.Shop_id.Value) .SetIdcard(item.Idcard) .SetIdcard_img1(item.Idcard_img1) .SetIdcard_img2(item.Idcard_img2) .SetLicense_img(item.License_img).ExecuteNonQuery()); }
private static void RemoveCache(ShopsecurityInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("pifa_BLL_Shopsecurity_", item.Shop_id)); RedisHelper.Remove(string.Concat("pifa_BLL_ShopsecurityByIdcard_", item.Idcard)); }
public static ShopsecurityInfo Insert(ShopsecurityInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
protected static MySqlParameter[] GetParameters(ShopsecurityInfo item) { return(new MySqlParameter[] { GetParameter("?shop_id", MySqlDbType.UInt32, 10, item.Shop_id), GetParameter("?idcard", MySqlDbType.VarChar, 32, item.Idcard), GetParameter("?idcard_img1", MySqlDbType.VarChar, 255, item.Idcard_img1), GetParameter("?idcard_img2", MySqlDbType.VarChar, 255, item.Idcard_img2), GetParameter("?license_img", MySqlDbType.VarChar, 255, item.License_img) }); }
public ActionResult Edit([FromQuery] uint Shop_id) { ShopsecurityInfo item = Shopsecurity.GetItem(Shop_id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } ViewBag.item = item; return(View()); }
public APIReturn _Add([FromForm] uint?Shop_id, [FromForm] string Idcard, [FromForm] string Idcard_img1, [FromForm] string Idcard_img2, [FromForm] string License_img, [FromForm] IFormFile License_img_file) { ShopsecurityInfo item = new ShopsecurityInfo(); item.Shop_id = Shop_id; if (License_img_file != null) { item.License_img = $"/upload/{Guid.NewGuid().ToString()}.png"; using (FileStream fs = new FileStream(System.IO.Path.Combine(AppContext.BaseDirectory, item.License_img), FileMode.Create)) License_img_file.CopyTo(fs); } else { item.License_img = License_img; } item.Idcard = Idcard; item.Idcard_img1 = Idcard_img1; item.Idcard_img2 = Idcard_img2; item = Shopsecurity.Insert(item); return(APIReturn.成功.SetData("item", item.ToBson())); }
public static ShopsecurityInfo GetItemByIdcard(string Idcard) { if (itemCacheTimeout <= 0) { return(Select.WhereIdcard(Idcard).ToOne()); } string key = string.Concat("pifa_BLL_ShopsecurityByIdcard_", Idcard); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(ShopsecurityInfo.Parse(value)); } catch { } } ShopsecurityInfo item = Select.WhereIdcard(Idcard).ToOne(); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
public APIReturn _Edit([FromQuery] uint Shop_id, [FromForm] string Idcard, [FromForm] string Idcard_img1, [FromForm] string Idcard_img2, [FromForm] string License_img, [FromForm] IFormFile License_img_file) { ShopsecurityInfo item = Shopsecurity.GetItem(Shop_id); if (item == null) { return(APIReturn.记录不存在_或者没有权限); } if (!string.IsNullOrEmpty(item.License_img) && (item.License_img != License_img || License_img_file != null)) { string path = System.IO.Path.Combine(AppContext.BaseDirectory, item.License_img); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } } if (License_img_file != null) { item.License_img = $"/upload/{Guid.NewGuid().ToString()}.png"; using (FileStream fs = new FileStream(System.IO.Path.Combine(AppContext.BaseDirectory, item.License_img), FileMode.Create)) License_img_file.CopyTo(fs); } else { item.License_img = License_img; } item.Idcard = Idcard; item.Idcard_img1 = Idcard_img1; item.Idcard_img2 = Idcard_img2; int affrows = Shopsecurity.Update(item); if (affrows > 0) { return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}")); } return(APIReturn.失败); }
public ShopsecurityInfo Insert(ShopsecurityInfo item) { SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item)); return(item); }
public SqlUpdateBuild(ShopsecurityInfo item, uint Shop_id) { _item = item; _where = SqlHelper.Addslashes("`shop_id` = {0}", Shop_id); }