Esempio n. 1
0
        public JsonResult TakeOutData(EstateDetailViewModel model, bool takeoutFlag)
        {
            MSGReturnModel <bool> result = new MSGReturnModel <bool>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.ESTATEData))
            {
                var tempData       = (List <EstateDetailViewModel>)Cache.Get(CacheList.ESTATEData);
                var updateTempData = tempData.FirstOrDefault(x => x.vItemId == model.vItemId);
                if (updateTempData != null)
                {
                    if (takeoutFlag)
                    {
                        updateTempData.vStatus = Ref.AccessInventoryType._4.GetDescription();
                    }
                    else
                    {
                        updateTempData.vStatus = Ref.AccessInventoryType._1.GetDescription();
                    }
                    updateTempData.vtakeoutFlag = takeoutFlag;
                    Cache.Invalidate(CacheList.ESTATEData);
                    Cache.Set(CacheList.ESTATEData, tempData);
                    result.RETURN_FLAG = true;
                    result.DESCRIPTION = Ref.MessageType.update_Success.GetDescription();
                    result.Datas       = tempData.Any(x => x.vtakeoutFlag);
                }
                else
                {
                    result.RETURN_FLAG = false;
                    result.DESCRIPTION = Ref.MessageType.update_Fail.GetDescription();
                }
            }
            return(Json(result));
        }
Esempio n. 2
0
        public JsonResult DeleteTempData(EstateDetailViewModel model)
        {
            MSGReturnModel <bool> result = new MSGReturnModel <bool>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.ESTATEData))
            {
                var data           = (TreasuryAccessViewModel)Cache.Get(CacheList.TreasuryAccessViewData);
                var tempData       = (List <EstateDetailViewModel>)Cache.Get(CacheList.ESTATEData);
                var deleteTempData = tempData.FirstOrDefault(x => x.vItemId == model.vItemId);
                if (deleteTempData != null)
                {
                    tempData.Remove(deleteTempData);
                    Cache.Invalidate(CacheList.ESTATEData);
                    Cache.Set(CacheList.ESTATEData, tempData);
                    result.RETURN_FLAG = true;
                    result.DESCRIPTION = Ref.MessageType.delete_Success.GetDescription();
                    result.Datas       = tempData.Any();
                }
                else
                {
                    result.RETURN_FLAG = false;
                    result.DESCRIPTION = Ref.MessageType.delete_Fail.GetDescription();
                }
            }
            return(Json(result));
        }
Esempio n. 3
0
        public JsonResult UpdateTempData(EstateDetailViewModel model)
        {
            MSGReturnModel <string> result = new MSGReturnModel <string>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.ESTATEData))
            {
                var tempData       = (List <EstateDetailViewModel>)Cache.Get(CacheList.ESTATEData);
                var updateTempData = tempData.FirstOrDefault(x => x.vItemId == model.vItemId);
                if (updateTempData != null)
                {
                    var  tempData2 = tempData.Where(x => x.vItemId != updateTempData.vItemId).ToList();
                    bool sameFlag  = //位(字號;地/建號;門牌號;流水號/編號等欄位)建置相同值時,系統提醒建相同資料的訊息(但不影響資料的建置)
                                     ((!model.vOwnership_Cert_No.IsNullOrWhiteSpace()) && tempData2.Where(x => x.vOwnership_Cert_No != null).Where(x => x.vOwnership_Cert_No?.Trim() == model.vOwnership_Cert_No?.Trim()).Any()) ||
                                     ((!model.vLand_Building_No.IsNullOrWhiteSpace()) && tempData2.Where(x => x.vLand_Building_No != null).Where(x => x.vLand_Building_No?.Trim() == model.vLand_Building_No?.Trim()).Any()) ||
                                     ((!model.vHouse_No.IsNullOrWhiteSpace()) && tempData2.Where(x => x.vHouse_No != null).Where(x => x.vHouse_No?.Trim() == model.vHouse_No?.Trim()).Any()) ||
                                     ((!model.vEstate_Seq.IsNullOrWhiteSpace()) && tempData2.Where(x => x.vEstate_Seq != null).Where(x => x.vEstate_Seq?.Trim() == model.vEstate_Seq?.Trim()).Any());
                    updateTempData.vEstate_From_No    = model.vEstate_From_No;
                    updateTempData.vEstate_Date       = model.vEstate_Date;
                    updateTempData.vOwnership_Cert_No = model.vOwnership_Cert_No;
                    updateTempData.vLand_Building_No  = model.vLand_Building_No;
                    updateTempData.vHouse_No          = model.vHouse_No;
                    updateTempData.vEstate_Seq        = model.vEstate_Seq;
                    updateTempData.vMemo = model.vMemo;
                    Cache.Invalidate(CacheList.ESTATEData);
                    Cache.Set(CacheList.ESTATEData, tempData);
                    result.RETURN_FLAG = true;
                    result.DESCRIPTION = Ref.MessageType.update_Success.GetDescription() + (sameFlag ? "</br>您建置的明細資料重複敬請確認,謝謝!" : string.Empty);
                }
                else
                {
                    result.RETURN_FLAG = false;
                    result.DESCRIPTION = Ref.MessageType.update_Fail.GetDescription();
                }
            }
            return(Json(result));
        }
Esempio n. 4
0
        public JsonResult InsertTempData(EstateDetailViewModel model)
        {
            MSGReturnModel <string> result = new MSGReturnModel <string>();

            result.RETURN_FLAG = false;
            result.DESCRIPTION = Ref.MessageType.login_Time_Out.GetDescription();
            if (Cache.IsSet(CacheList.ESTATEData))
            {
                var  tempData  = (List <EstateDetailViewModel>)Cache.Get(CacheList.ESTATEData);
                var  tempData2 = tempData.Where(x => x.vItemId != model.vItemId).ToList();
                bool sameFlag  = //位(字號;地/建號;門牌號;流水號/編號等欄位)建置相同值時,系統提醒建相同資料的訊息(但不影響資料的建置)
                                 tempData2.Where(x => x.vOwnership_Cert_No != null).Where(x => x.vOwnership_Cert_No?.Trim() == model.vOwnership_Cert_No?.Trim(), !model.vOwnership_Cert_No.IsNullOrWhiteSpace()).Any() ||
                                 tempData2.Where(x => x.vLand_Building_No != null).Where(x => x.vLand_Building_No?.Trim() == model.vLand_Building_No?.Trim(), !model.vLand_Building_No.IsNullOrWhiteSpace()).Any() ||
                                 tempData2.Where(x => x.vHouse_No != null).Where(x => x.vHouse_No?.Trim() == model.vHouse_No?.Trim(), !model.vHouse_No.IsNullOrWhiteSpace()).Any() ||
                                 tempData2.Where(x => x.vEstate_Seq != null).Where(x => x.vEstate_Seq?.Trim() == model.vEstate_Seq?.Trim(), !model.vEstate_Seq.IsNullOrWhiteSpace()).Any();
                model.vStatus = Ref.AccessInventoryType._3.GetDescription();
                tempData.Add(model);
                Cache.Invalidate(CacheList.ESTATEData);
                Cache.Set(CacheList.ESTATEData, tempData);
                result.RETURN_FLAG = true;
                result.DESCRIPTION = Ref.MessageType.insert_Success.GetDescription() + (sameFlag? "</br>您建置的明細資料重複敬請確認,謝謝!" : string.Empty);
            }
            return(Json(result));
        }