Beispiel #1
0
        public JsonResult ApplyTempData(ItemBookStock vStockDate, ItemBookStockModel vStockModel, string AccessType)
        {
            MSGReturnModel <IEnumerable <ITreaItem> > result = new MSGReturnModel <IEnumerable <ITreaItem> >();

            if (Cache.IsSet(CacheList.TreasuryAccessViewData) && Cache.IsSet(CacheList.StockData))
            {
                TreasuryAccessViewModel data = (TreasuryAccessViewModel)Cache.Get(CacheList.TreasuryAccessViewData);
                var _data = (StockViewModel)Cache.Get(CacheList.StockData);
                _data.vStockDate  = vStockDate;
                _data.vStockModel = vStockModel;
                if (AccessType == Ref.AccessProjectTradeType.P.ToString())
                {
                    _data.vDetail = (List <StockDetailViewModel>)Cache.Get(CacheList.StockTempData);
                }
                if (AccessType == Ref.AccessProjectTradeType.G.ToString())
                {
                    //判斷至少勾選一筆資料
                    var vDetail = ((List <StockDetailViewModel>)Cache.Get(CacheList.StockMainData)).Where(x => x.vTakeoutFlag == true).ToList();

                    if (vDetail.Any())
                    {
                        _data.vDetail = (List <StockDetailViewModel>)Cache.Get(CacheList.StockMainData);
                    }
                    else
                    {
                        _data.vDetail = new List <StockDetailViewModel>();
                    }
                }

                List <StockViewModel> _datas = new List <StockViewModel>();
                _datas.Add(_data);
                result = Stock.ApplyAudit(_datas, data);
                if (result.RETURN_FLAG && !data.vAplyNo.IsNullOrWhiteSpace())
                {
                    new TreasuryAccessController().ResetSearchData();
                }
            }
            else
            {
                result.RETURN_FLAG = false;
                result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            }
            return(Json(result));
        }