/// <summary> /// 設定股票Cache資料 /// </summary> /// <param name="GroupNo">申請單號</param> /// <param name="GroupNo">修改狀態</param> /// <returns></returns> private void resetStockViewModel(string AplyNo = null, bool EditFlag = false) { Cache.Invalidate(CacheList.StockData); Cache.Invalidate(CacheList.StockMainData); Cache.Invalidate(CacheList.StockTempData); if (AplyNo.IsNullOrWhiteSpace()) { Cache.Set(CacheList.StockData, new StockViewModel()); Cache.Set(CacheList.StockMainData, new List <StockDetailViewModel>()); Cache.Set(CacheList.StockTempData, new List <StockDetailViewModel>()); } else { var data = Stock.GetDataByAplyNo(AplyNo, EditFlag); Cache.Set(CacheList.StockData, data); var viewModel = TreasuryAccess.GetTreasuryAccessViewModel(AplyNo); if (viewModel.vAccessType == Ref.AccessProjectTradeType.P.ToString()) { Cache.Set(CacheList.StockTempData, data.vDetail); } else if (viewModel.vAccessType == Ref.AccessProjectTradeType.G.ToString()) { Cache.Set(CacheList.StockMainData, data.vDetail); Cache.Set(CacheList.StockTempData, new List <StockDetailViewModel>()); } } }