/// <summary> /// Check user permission for screen CMS150 and check all parameter must have value. /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CMS150_Authority(CMS150_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { if (ModelState.IsValid == false) { ValidatorUtil.BuildErrorMessage(res, this); if (res.IsError) { return(Json(res)); } } //1. Check permission if (!CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_HISTORY_DIGEST, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //2. Check parameter is OK ? if (CommonUtil.IsNullOrEmpty(param.ContractCode) || CommonUtil.IsNullOrEmpty(param.ServiceTypeCode)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040); return(Json(res)); } CommonUtil ComUtil = new CommonUtil(); string strLongContractCode = ComUtil.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); // ---- Wrong !! -- You must get these data when pass check Authority !!! //dsRentalBasicForHistDigestView dsRentBasicForHDView; //dsSaleBasicForHistDigestView dsSaleBasicForHDView; //if (param.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) //{ // dsRentBasicForHDView = GetRentalBasicForHistoryDigestView(strLongContractCode); // param.dsRentBasicForHDView = dsRentBasicForHDView; //} //else //{ // dsSaleBasicForHDView = GetSaleBasicForHistoryDigestView(ComUtil.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG), param.OCC); // param.dsSaleBasicForHDView = dsSaleBasicForHDView; //} } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } return(InitialScreenEnvironment <CMS150_ScreenParameter>("CMS150", param, res)); }
public ActionResult CMS150() { CMS150_ScreenParameter param = GetScreenObject <CMS150_ScreenParameter>(); ObjectResultData res = new ObjectResultData(); if (param == null) { param = new CMS150_ScreenParameter(); } //if (param.dsRentBasicForHDView == null) // param.dsRentBasicForHDView = new dsRentalBasicForHistDigestView(); //if (param.dsSaleBasicForHDView == null) // param.dsSaleBasicForHDView = new dsSaleBasicForHistDigestView(); dsRentalBasicForHistDigestView dsRentBasicForHDView; dsSaleBasicForHistDigestView dsSaleBasicForHDView; CommonUtil ComUtil = new CommonUtil(); string strLongContractCode = ComUtil.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); // Get data if (param.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) { dsRentBasicForHDView = GetRentalBasicForHistoryDigestView(strLongContractCode); param.dsRentBasicForHDView = dsRentBasicForHDView; } else { dsSaleBasicForHDView = GetSaleBasicForHistoryDigestView(strLongContractCode, param.OCC); param.dsSaleBasicForHDView = dsSaleBasicForHDView; } // Assign and use data if (param.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) { dsRentBasicForHDView = param.dsRentBasicForHDView; //dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContractCode = ComUtil.ConvertContractCode(dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContractTargetCustCode = ComUtil.ConvertCustCode(dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContractTargetCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].RealCustomerCustCode = ComUtil.ConvertCustCode(dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].RealCustomerCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].SiteCode = ComUtil.ConvertSiteCode(dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); dsRentBasicForHDView.View_dtRentalHistoryDigest = CommonUtil.ConvertObjectbyLanguage <dtRentalHistoryDigest, View_dtRentalHistoryDigest>(dsRentBasicForHDView.dtRentalHistoryDigest, "ChangeTypeName", "IncidentARTypeName", "DocAuditResultName", "DocumentName"); if (dsRentBasicForHDView.dtTbt_RentalContractBasicForView != null && dsRentBasicForHDView.dtTbt_RentalContractBasicForView.Count > 0) { ViewBag.ContractCode = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContractCodeShort; ViewBag.UserCode = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].UserCode; ViewBag.CustCodeCT = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContractTargetCustCodeShort; ViewBag.CustCodeRC = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].RealCustomerCustCodeShort; ViewBag.SiteCode = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].SiteCodeShort; ViewBag.ContTGnamEn = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].CustFullNameEN_Cust; ViewBag.ContTGaddrEn = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].AddressFullEN_Cust; ViewBag.SiteNamEn = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].SiteNameEN_Site; ViewBag.SiteAddrEn = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].AddressFullEN_Site; ViewBag.ContTGnamLC = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].CustFullNameLC_Cust; ViewBag.ContTGaddrL = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].AddressFullLC_Cust; ViewBag.SiteNamLC = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].SiteNameLC_Site; ViewBag.SiteAddrLC = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].AddressFullLC_Site; ViewBag.ContPoint = CommonUtil.IsNullOrEmpty(dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContactPoint) == true ? "-" : dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContactPoint; //ViewBag.ContPoint = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ContactPoint; ViewBag.ProductTypeCode = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].ProductTypeCode; //for Rental ViewBag.OCC = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].LastOCC; ViewBag.txtRentalAttachImportanceFlag = dsRentBasicForHDView.dtTbt_RentalContractBasicForView[0].SpecialCareFlag; } ViewBag.EnableContractBasic = true; } else { dsSaleBasicForHDView = param.dsSaleBasicForHDView; //dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContractCode = ComUtil.ConvertContractCode(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].PurchaserCustCode = ComUtil.ConvertCustCode(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].PurchaserCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].RealCustomerCustCode = ComUtil.ConvertCustCode(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].RealCustomerCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].SiteCode = ComUtil.ConvertSiteCode(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); dsSaleBasicForHDView.View_dtSaleHistoryDigestList = CommonUtil.ConvertObjectbyLanguage <dtSaleHistoryDigest, View_dtSaleHistoryDigestList>(dsSaleBasicForHDView.dtSaleHistoryDigestList, "ChangeTypeName", "IncidentARTypeName"); if (dsSaleBasicForHDView.dtTbt_SaleBasicForView != null && dsSaleBasicForHDView.dtTbt_SaleBasicForView.Count > 0) { ViewBag.ContractCode = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContractCode_Short; ViewBag.CustCodePur = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].PurchaserCustCode_Short; ViewBag.CustCodeRC = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].RealCustomerCustCode_Short; ViewBag.SiteCode = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].SiteCode_Short; ViewBag.PurNameEn = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].PurCust_CustFullNameEN; ViewBag.PurAddrEn = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].AddressFullEN_PurCust; ViewBag.SiteNamEn = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].site_SiteNameEN; ViewBag.SiteAddrEn = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].AddressFullEN_site; ViewBag.PurchaserNamLC = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].PurCust_CustFullNameLC;// CustFullNameLC_PurCust; ViewBag.PurchaserAddrLC = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].AddressFullLC_PurCust; ViewBag.SiteNamLC = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].site_SiteNameLC; ViewBag.SiteAddrLC = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].AddressFullLC_site; //ViewBag.ContPoint = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContactPoint; ViewBag.ContPoint = CommonUtil.IsNullOrEmpty(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContactPoint) == true ? "-" : dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContactPoint; ViewBag.OCC = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].OCC; ViewBag.txtSaleAttachImportanceFlag = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].SpecialCareFlag; ViewBag.ProductTypeCode = dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ProductTypeCode; } ViewBag.EnableSalesContractBasic = true; } //--------------- Viewbag share data---------- ViewBag.C_SERVICE_TYPE_RENTAL = ServiceType.C_SERVICE_TYPE_RENTAL; ViewBag.strLongContractCode = ComUtil.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); ViewBag.CondOCC = param.OCC; ViewBag.ServiceType = param.ServiceTypeCode; ViewBag.C_CONTRACT_TYPE_CONTACT = ContractType.C_CONTRACT_TYPE_CONTACT; ViewBag.C_CONTRACT_TYPE_INCIDENT = ContractType.C_CONTRACT_TYPE_INCIDENT; ViewBag.C_CONTRACT_TYPE_AR = ContractType.C_CONTRACT_TYPE_AR; //ViewBag.EnableSecurityBasic = false; //ViewBag.EnableSecurityDetail = false; ViewBag.EnableHistoryDigest = false; ViewBag.EnableContractBillingTransfer = true; return(View()); }