public static bool ModifySaler(SalerEntity entity) { int result = 0; if (entity != null) { SalerRepository mr = new SalerRepository(); SalerInfo info = TranslateSalerEntity(entity); if (entity.SID > 0) { result = mr.ModifySaler(info); } else { info.CreateDate = DateTime.Now; result = mr.CreateSaler(info); } List <SalerInfo> miList = mr.GetSalerAll();//刷新缓存 Cache.Add("SalerALL", miList); } return(result > 0); }
public static int RemoveSaler(long sid) { SalerRepository mr = new SalerRepository(); int r = mr.RemoveSaler(sid); List <SalerInfo> miList = mr.GetSalerAll();//刷新缓存 Cache.Add("ChargingBaseALL", miList); return(r); }
public static List <SalerEntity> GetAllSalerEntity() { List <SalerEntity> all = new List <SalerEntity>(); SalerRepository mr = new SalerRepository(); List <SalerInfo> miList = Cache.Get <List <SalerInfo> >("SalerALL"); if (miList.IsEmpty()) { miList = mr.GetSalerAll(); Cache.Add("SalerALL", miList); } if (!miList.IsEmpty()) { foreach (SalerInfo mInfo in miList) { SalerEntity salerEntity = TranslateSalerInfo(mInfo); all.Add(salerEntity); } } return(all); }