コード例 #1
0
ファイル: BILLController.cs プロジェクト: BiancoLee/BETA
        public JsonResult InsertTempData(BillViewModel model)
        {
            MSGReturnModel <string> result = new MSGReturnModel <string>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.BILLTempData) && Cache.IsSet(CacheList.TreasuryAccessViewData))
            {
                var checkdata = (List <BillViewModel>)Cache.Get(CacheList.BILLDayData);
                var sameFlag  = checkSameData(checkdata, model);
                if (!sameFlag.IsNullOrWhiteSpace())
                {
                    result.RETURN_FLAG = false;
                    result.DESCRIPTION = sameFlag;
                    return(Json(result));
                }
                var data     = (TreasuryAccessViewModel)Cache.Get(CacheList.TreasuryAccessViewData);
                var tempData = (List <BillViewModel>)Cache.Get(CacheList.BILLTempData);
                model.vStatus = Ref.AccessInventoryType._3.GetDescription();
                tempData.Add(model);
                Cache.Invalidate(CacheList.BILLTempData);
                Cache.Set(CacheList.BILLTempData, SetBillViewRowNum(tempData));
                var dayData = (List <BillViewModel>)Bill.GetDayData(data.vAplyUnit);
                if (!data.vAplyNo.IsNullOrWhiteSpace())
                {
                    dayData = dayData.Where(x => x.vAplyNo != data.vAplyNo).ToList();
                }
                dayData.AddRange(tempData.ModelConvert <BillViewModel, BillViewModel>());
                Cache.Invalidate(CacheList.BILLDayData);
                Cache.Set(CacheList.BILLDayData, SetBillTakeOutViewModelGroup(dayData));
                result.RETURN_FLAG = true;
                result.DESCRIPTION = Ref.MessageType.insert_Success.GetDescription();
            }
            return(Json(result));
        }