public static bool ModifyStorageLocation(StorageLocationEntity entity) { long result = 0; if (entity != null) { StorageLocationRepository mr = new StorageLocationRepository(); StorageLocationInfo StorageLocationInfo = TranslateStorageLocationInfo(entity); if (entity.StorageLocationID > 0) { StorageLocationInfo.StorageLocationID = entity.StorageLocationID; StorageLocationInfo.ChangeDate = DateTime.Now; result = mr.ModifyStorageLocation(StorageLocationInfo); } else { StorageLocationInfo.ChangeDate = DateTime.Now; StorageLocationInfo.CreateDate = DateTime.Now; result = mr.CreateNew(StorageLocationInfo); } List <StorageLocationInfo> miList = mr.GetAllStorageLocation();//刷新缓存 Cache.Add("StorageLocationALL", miList); } return(result > 0); }
public static List <StorageLocationEntity> GetStorageLocationAll() { List <StorageLocationEntity> all = new List <StorageLocationEntity>(); StorageLocationRepository mr = new StorageLocationRepository(); List <StorageLocationInfo> miList = mr.GetAllStorageLocation();//Cache.Get<List<StorageLocationInfo>>("StorageLocationALL"); //if (miList.IsEmpty()) //{ // miList = mr.GetAllStorageLocation(); // Cache.Add("StorageLocationALL", miList); //} if (!miList.IsEmpty()) { foreach (StorageLocationInfo mInfo in miList) { StorageLocationEntity StorageLocationEntity = TranslateStorageLocationEntity(mInfo); all.Add(StorageLocationEntity); } } return(all); }