/// <summary> /// Check permission for access screen CMS200 /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CMS200_Authority(CMS200_ScreenParameter param) // IN parameter: string strContractCode, string strServiceTypeCode { ObjectResultData res = new ObjectResultData(); // Check permission if (!CheckUserPermission(ScreenID.C_SCREEN_ID_VIEW_CONTRACT_BILLING, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } // Check parameter is OK ? if (CommonUtil.IsNullOrEmpty(param.strContractCode) == false && CommonUtil.IsNullOrEmpty(param.strServiceTypeCode) == false) { param.ContractCode = param.strContractCode; param.ServiceTypeCode = param.strServiceTypeCode; } else { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0040); return(Json(res)); } // Check exist data try { CommonUtil c = new CommonUtil(); string ContractCode = c.ConvertContractCode(param.strContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); IRentralContractHandler handlerRC = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; ISaleContractHandler handlerSC = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; List <dtTbt_RentalContractBasicForView> listRC = new List <dtTbt_RentalContractBasicForView>(); List <dtTbt_SaleBasicForView> listSC = new List <dtTbt_SaleBasicForView>(); if (param.strServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) { listRC = handlerRC.GetTbt_RentalContractBasicForView(ContractCode); } else if (param.strServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE) { listSC = handlerSC.GetTbt_SaleBasicForView(ContractCode, null, true); } if (listRC.Count == 0 && listSC.Count == 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } } catch { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } return(InitialScreenEnvironment <CMS200_ScreenParameter>("CMS200", param, res)); }
/// <summary> /// Get Sale digest by type, contract code and OCC. /// </summary> /// <param name="sType"></param> /// <param name="strLongContractCode"></param> /// <param name="OCC"></param> /// <returns></returns> public ActionResult getSaleDigestCMS150(string sType, string strLongContractCode, string OCC) { if (OCC.Trim() == "") { OCC = null; } if (strLongContractCode.Trim() == "") { strLongContractCode = null; } if (sType.Trim() == "") { sType = null; } List <View_dtSaleHistoryDigestList> vSaleHist = null; ObjectResultData res = new ObjectResultData(); try { ISaleContractHandler handSale = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); List <dtTbt_SaleBasicForView> dtTbt_SaleBasicForView = handSale.GetTbt_SaleBasicForView(strLongContractCode, OCC, FlagType.C_FLAG_ON); //Add Currency to List for (int i = 0; i < dtTbt_SaleBasicForView.Count(); i++) { dtTbt_SaleBasicForView[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } if (dtTbt_SaleBasicForView.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); // return Json(res); } else { IViewContractHandler handView = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler; List <dtSaleHistoryDigest> dtSaleHistoryDigest = handView.GetSaleHistoryDigestList(dtTbt_SaleBasicForView[0].ContractCode, null, null); //Add Currency to List for (int i = 0; i < dtSaleHistoryDigest.Count(); i++) { dtSaleHistoryDigest[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } vSaleHist = CommonUtil.ConvertObjectbyLanguage <dtSaleHistoryDigest, View_dtSaleHistoryDigestList>(dtSaleHistoryDigest, "ChangeTypeName", "IncidentARTypeName"); } string XmlSaleHist = CommonUtil.ConvertToXml <View_dtSaleHistoryDigestList>(vSaleHist, "Common\\CMS150_sale", CommonUtil.GRID_EMPTY_TYPE.SEARCH); return(Json(XmlSaleHist)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
public ActionResult CMS210() { CMS210_ScreenParameter cond = new CMS210_ScreenParameter(); try { cond = GetScreenObject <CMS210_ScreenParameter>(); } catch { } // Keep ServiceTypeCode ViewBag.ServiceTypeCode = cond.ServiceTypeCode; CommonUtil c = new CommonUtil(); cond.ContractCode = c.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.MATargetContractCode = c.ConvertContractCode(cond.MATargetContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.ContractTargetCode = c.ConvertCustCode(cond.ContractTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); try { IRentralContractHandler handlerR = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; ISaleContractHandler handlerS = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; List <dtTbt_RentalContractBasicForView> dtRentalContract = new List <dtTbt_RentalContractBasicForView>(); List <dtTbt_SaleBasicForView> dtSaleContract = new List <dtTbt_SaleBasicForView>(); ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); if (cond.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) { dtRentalContract = handlerR.GetTbt_RentalContractBasicForView(cond.MATargetContractCode); //Add Currency to List for (int i = 0; i < dtRentalContract.Count(); i++) { dtRentalContract[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } foreach (var item in dtRentalContract) { item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } if (dtRentalContract.Count > 0) { ViewBag.txtContractCode = dtRentalContract[0].ContractCode; ViewBag.txtContract_target_name_English = dtRentalContract[0].CustFullNameEN_Cust; ViewBag.txtContract_target_address_English = dtRentalContract[0].AddressFullEN_Cust; ViewBag.txtSite_name_English = dtRentalContract[0].SiteNameEN_Site; ViewBag.Site_address_English = dtRentalContract[0].AddressFullEN_Site; ViewBag.txtContract_target_name_Local = dtRentalContract[0].CustFullNameLC_Cust; ViewBag.txtContract_target_address_Local = dtRentalContract[0].AddressFullLC_Cust; ViewBag.txtSite_name_Local = dtRentalContract[0].SiteNameLC_Site; ViewBag.txtSite_address_Local = dtRentalContract[0].AddressFullLC_Site; ViewBag.txtRentalAttachImportanceFlag = dtRentalContract[0].SpecialCareFlag; } } else if (cond.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE) { dtSaleContract = handlerS.GetTbt_SaleBasicForView(cond.MATargetContractCode, null, null); //Add Currency to List for (int i = 0; i < dtSaleContract.Count(); i++) { dtSaleContract[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } foreach (var item in dtSaleContract) { item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } if (dtSaleContract.Count > 0) { ViewBag.txtContractCode = dtSaleContract[0].ContractCode; ViewBag.txtContract_target_name_English = dtSaleContract[0].PurCust_CustFullNameEN; ViewBag.txtContract_target_address_English = dtSaleContract[0].AddressFullEN_PurCust; ViewBag.txtSite_name_English = dtSaleContract[0].site_SiteNameEN; ViewBag.Site_address_English = dtSaleContract[0].AddressFullEN_site; ViewBag.txtContract_target_name_Local = dtSaleContract[0].PurCust_CustFullNameLC; ViewBag.txtContract_target_address_Local = dtSaleContract[0].AddressFullLC_PurCust; ViewBag.txtSite_name_Local = dtSaleContract[0].site_SiteNameLC; ViewBag.txtSite_address_Local = dtSaleContract[0].AddressFullLC_site; ViewBag.txtSaleAttachImportanceFlag = dtSaleContract[0].SpecialCareFlag; } } return(View()); } catch (Exception ex) { ObjectResultData res = new ObjectResultData(); res.AddErrorMessage(ex); return(Json(res)); } }
public ActionResult CMS200() { string strContractCode = ""; string strServiceTypeCode = ""; try { CMS200_ScreenParameter param = GetScreenObject <CMS200_ScreenParameter>(); strContractCode = param.ContractCode; strServiceTypeCode = param.ServiceTypeCode; } catch { } // Keep service type code ViewBag.ServiceTypeCode = strServiceTypeCode; // Keep contract code (short) ViewBag._ContractCode = strContractCode; ViewBag._OCC = string.Empty; ViewBag._ContractTargetCode = string.Empty; ViewBag._RealCustomerCode = string.Empty; ViewBag._PurchaserCustCode = string.Empty; ViewBag._SiteCode = string.Empty; CommonUtil c = new CommonUtil(); strContractCode = c.ConvertContractCode(strContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); try { IRentralContractHandler handlerRC = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; ISaleContractHandler handlerSC = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; if (strServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) { List <dtTbt_RentalContractBasicForView> listRC = handlerRC.GetTbt_RentalContractBasicForView(strContractCode); if (listRC.Count > 0) { // convert code to short format listRC[0].ContractCode = c.ConvertContractCode(listRC[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); listRC[0].ContractTargetCustCode = c.ConvertCustCode(listRC[0].ContractTargetCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); listRC[0].RealCustomerCustCode = c.ConvertCustCode(listRC[0].RealCustomerCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); listRC[0].SiteCode = c.ConvertSiteCode(listRC[0].SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); // gorbal javascript variable ViewBag._OCC = listRC[0].LastOCC; ViewBag._ContractTargetCode = listRC[0].ContractTargetCustCode; ViewBag._RealCustomerCode = listRC[0].RealCustomerCustCode; ViewBag._SiteCode = listRC[0].SiteCode; ViewBag.txtContractCode = listRC[0].ContractCode; ViewBag.txtUserCode = listRC[0].UserCode; ViewBag.lnkCustomerCodeC = listRC[0].ContractTargetCustCode; ViewBag.lnkCustomerCodeR = listRC[0].RealCustomerCustCode; ViewBag.lnkSiteCode = listRC[0].SiteCode; ViewBag.txtContractNameEng = listRC[0].CustFullNameEN_Cust; ViewBag.txtContractAddrEng = listRC[0].AddressFullEN_Cust; ViewBag.txtSiteNameEng = listRC[0].SiteNameEN_Site; ViewBag.txtSiteAddrEng = listRC[0].AddressFullEN_Site; ViewBag.txtContractNameLocal = listRC[0].CustFullNameLC_Cust; ViewBag.txtContractAddrLocal = listRC[0].AddressFullLC_Cust; ViewBag.txtSiteNameLocal = listRC[0].SiteNameLC_Site; ViewBag.txtSiteAddrLocal = listRC[0].AddressFullLC_Site; //ViewBag.txtContactPoint = listRC[0].ContactPoint ; ViewBag.txtContactPoint = CommonUtil.IsNullOrEmpty(listRC[0].ContactPoint) == true ? "-" : listRC[0].ContactPoint; ViewBag.txtRentalAttachImportanceFlag = listRC[0].SpecialCareFlag; ViewBag.ProductTypeCode = listRC[0].ProductTypeCode; } } else if (strServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE) { List <dtTbt_SaleBasicForView> listSC = handlerSC.GetTbt_SaleBasicForView(strContractCode, null, true); if (listSC.Count > 0) // SCB : Sale Contract Basic { // convert code to short format listSC[0].ContractCode = c.ConvertContractCode(listSC[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); listSC[0].CustCode_PurCust = c.ConvertCustCode(listSC[0].CustCode_PurCust, CommonUtil.CONVERT_TYPE.TO_SHORT); listSC[0].CustCode_RealCust = c.ConvertCustCode(listSC[0].CustCode_RealCust, CommonUtil.CONVERT_TYPE.TO_SHORT); listSC[0].SiteCode = c.ConvertSiteCode(listSC[0].SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); // gorbal javascript variable ViewBag._OCC = listSC[0].OCC; ViewBag._PurchaserCustCode = listSC[0].CustCode_PurCust; ViewBag._RealCustomerCode = listSC[0].CustCode_RealCust; ViewBag._SiteCode = listSC[0].SiteCode; ViewBag.txtSCBContractCode = listSC[0].ContractCode; ViewBag.lnkSCBPurchaserC = listSC[0].CustCode_PurCust; ViewBag.lnkSCBCustomerCodeR = listSC[0].CustCode_RealCust; ViewBag.lnkSCBSiteCode = listSC[0].SiteCode; ViewBag.txtSCBPurchaserNameEng = listSC[0].PurCust_CustFullNameEN; ViewBag.txtSCBPurchaserAddrEng = listSC[0].AddressFullEN_PurCust; ViewBag.txtSCBSiteNameEng = listSC[0].site_SiteNameEN; ViewBag.txtSCBSiteAddrEng = listSC[0].AddressFullEN_site; ViewBag.txtSCBPurchaserNameLocal = listSC[0].PurCust_CustFullNameLC; ViewBag.txtSCBPurchaserAddrLocal = listSC[0].AddressFullLC_PurCust; ViewBag.txtSCBSiteNameLocal = listSC[0].site_SiteNameLC; ViewBag.txtSCBSiteAddrLocal = listSC[0].AddressFullLC_site; //ViewBag.txtSCBContactPoint = listSC[0].ContactPoint ; ViewBag.txtSCBContactPoint = CommonUtil.IsNullOrEmpty(listSC[0].ContactPoint) == true ? "-" : listSC[0].ContactPoint; ViewBag.txtSaleAttachImportanceFlag = listSC[0].SpecialCareFlag; ViewBag.ProductTypeCode = listSC[0].ProductTypeCode; } } return(View()); } catch (Exception ex) { ObjectResultData res = new ObjectResultData(); res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Get Sale Basic information from tbt_SaleBasic /// </summary> /// <param name="strLongContractCode"></param> /// <param name="OCC"></param> /// <returns></returns> public dsSaleBasicForHistDigestView GetSaleBasicForHistoryDigestView(string strLongContractCode, string OCC) { try { dsSaleBasicForHistDigestView dsSaleBasicForHDView = new dsSaleBasicForHistDigestView(); ISaleContractHandler handSale = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); List <dtTbt_SaleBasicForView> dtTbt_SaleBasicForView = handSale.GetTbt_SaleBasicForView(strLongContractCode, OCC, FlagType.C_FLAG_ON); //Check Currency if (dtTbt_SaleBasicForView[0].NormalInstallFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].NormalInstallFee = dtTbt_SaleBasicForView[0].NormalInstallFeeUsd; } if (dtTbt_SaleBasicForView[0].OrderInstallFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].OrderInstallFee = dtTbt_SaleBasicForView[0].OrderInstallFeeUsd; } if (dtTbt_SaleBasicForView[0].InstallFeePaidBySECOMCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].InstallFeePaidBySECOM = dtTbt_SaleBasicForView[0].InstallFeePaidBySECOMUsd; } if (dtTbt_SaleBasicForView[0].InstallFeeRevenueBySECOMCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].InstallFeeRevenueBySECOM = dtTbt_SaleBasicForView[0].InstallFeeRevenueBySECOMUsd; } if (dtTbt_SaleBasicForView[0].OrderProductPriceCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].OrderProductPrice = dtTbt_SaleBasicForView[0].OrderProductPriceUsd; } if (dtTbt_SaleBasicForView[0].NormalProductPriceCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].NormalProductPrice = dtTbt_SaleBasicForView[0].NormalProductPriceUsd; } if (dtTbt_SaleBasicForView[0].BidGuaranteeAmount1CurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].BidGuaranteeAmount1 = dtTbt_SaleBasicForView[0].BidGuaranteeAmount1Usd; } if (dtTbt_SaleBasicForView[0].BidGuaranteeAmount2CurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].BidGuaranteeAmount2 = dtTbt_SaleBasicForView[0].BidGuaranteeAmount2Usd; } if (dtTbt_SaleBasicForView[0].NewBldMgmtCostCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtTbt_SaleBasicForView[0].NewBldMgmtCost = dtTbt_SaleBasicForView[0].NewBldMgmtCostUsd; } //Add Currency to List for (int i = 0; i < dtTbt_SaleBasicForView.Count(); i++) { dtTbt_SaleBasicForView[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } if (dtTbt_SaleBasicForView.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); } dsSaleBasicForHDView.dtTbt_SaleBasicForView = dtTbt_SaleBasicForView; //3.3 //List<doMiscTypeCode> dtGetMiscTypeCode = new List<doMiscTypeCode>(); //for (int i = 0; i < 3; i++) // dtGetMiscTypeCode.Add(new doMiscTypeCode()); //dtGetMiscTypeCode[0].FieldName = MiscType.C_SALE_CHANGE_TYPE; //dtGetMiscTypeCode[0].ValueCode = "%"; //dtGetMiscTypeCode[1].FieldName = MiscType.C_INCIDENT_TYPE; //dtGetMiscTypeCode[1].ValueCode = "%"; //dtGetMiscTypeCode[2].FieldName = MiscType.C_AR_TYPE; //dtGetMiscTypeCode[2].ValueCode = "%"; //ICommonHandler handCom = ServiceContainer.GetService<ICommonHandler>() as ICommonHandler; //List<doMiscTypeCode> MiscTypeResult = handCom.GetMiscTypeCodeList(dtGetMiscTypeCode); //dsSaleBasicForHDView.dtMiscellaneousType = MiscTypeResult; //3.4 IViewContractHandler handView = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler; List <dtSaleHistoryDigest> dtSaleHistoryDigestList = handView.GetSaleHistoryDigestList(dsSaleBasicForHDView.dtTbt_SaleBasicForView[0].ContractCode, null, null); //Add Currency to List for (int i = 0; i < dtSaleHistoryDigestList.Count(); i++) { dtSaleHistoryDigestList[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } dsSaleBasicForHDView.dtSaleHistoryDigestList = dtSaleHistoryDigestList; return(dsSaleBasicForHDView); } catch (Exception) { throw; } }
public ActionResult CMS190() { string strContractCode = ""; string strServiceTypeCode = ""; try { CMS190_ScreenParameter param = GetScreenObject <CMS190_ScreenParameter>(); strContractCode = param.ContractCode; strServiceTypeCode = param.ServiceTypeCode; } catch { } /* ----- Set grobal variable for javascript side ---- */ ViewBag._ServiceTypeCode = strServiceTypeCode; ViewBag._ContractCode = strContractCode; CommonUtil c = new CommonUtil(); List <dtTbt_RentalContractBasicForView> vw_dtRentalContract = new List <dtTbt_RentalContractBasicForView>(); List <dtTbt_SaleBasicForView> vw_dtSaleContract = new List <dtTbt_SaleBasicForView>(); List <dtTbt_RentalSecurityBasicForView> vw_dtRentalSecurity = new List <dtTbt_RentalSecurityBasicForView>(); //List<dtContractTargetInfoByRelated> vw_dtMaintenanceContractInfo = new List<dtContractTargetInfoByRelated>(); ViewBag.Currency = CommonValue.CURRENCY_UNIT; string dateFormat = "dd-MMM-yyyy"; string numberFormat = "N0"; string floatNumberFormat = "N2"; // default ViewBag ViewBag.chkFire_monitoring = false; ViewBag.chkCrime_prevention = false; ViewBag.chkEmergency_report = false; ViewBag.chkFacility_monitoring = false; ViewBag.bOutOfRegulationDocFlag = false; try { strContractCode = c.ConvertContractCode(strContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); ICommonHandler handlerComm = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; /****** get misc display value ******/ List <string> lsFieldNames = new List <string>(); lsFieldNames.Add(MiscType.C_RENTAL_CHANGE_TYPE); lsFieldNames.Add(MiscType.C_SALE_CHANGE_TYPE); lsFieldNames.Add(MiscType.C_SALE_TYPE); lsFieldNames.Add(MiscType.C_SALE_PROC_MANAGE_STATUS); List <doMiscTypeCode> MiscTypeList = handlerComm.GetMiscTypeCodeListByFieldName(lsFieldNames); /************************************/ // Rental IRentralContractHandler handlerR = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; // Sale ISaleContractHandler handlerS = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; // Online IViewContractHandler handlerVC = ServiceContainer.GetService <IViewContractHandler>() as IViewContractHandler; IInstallationHandler iHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; string strInstallationStatusCode = "-"; string strInstallationStatusName = "-"; List <dtTbt_RentalContractBasicForView> dtRentalContract = new List <dtTbt_RentalContractBasicForView>(); List <dtTbt_SaleBasicForView> dtSaleContract = new List <dtTbt_SaleBasicForView>(); List <dtTbt_RentalSecurityBasicForView> dtRentalSecurity = new List <dtTbt_RentalSecurityBasicForView>(); List <dtContractTargetInfoByRelated> dtOnlineContractInfo = new List <dtContractTargetInfoByRelated>(); List <dtContractTargetInfoByRelated> dtMaintenanceContractInfo = new List <dtContractTargetInfoByRelated>(); ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); if (strServiceTypeCode == ServiceType.C_SERVICE_TYPE_RENTAL) { dtRentalContract = handlerR.GetTbt_RentalContractBasicForView(strContractCode); //Check Currency *For view if (dtRentalContract[0].NormalDepositFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtRentalContract[0].NormalDepositFee = dtRentalContract[0].NormalDepositFeeUsd; } if (dtRentalContract[0].OrderDepositFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtRentalContract[0].OrderDepositFee = dtRentalContract[0].OrderDepositFeeUsd; } if (dtRentalContract[0].LastOrderContractFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtRentalContract[0].LastOrderContractFee = dtRentalContract[0].LastOrderContractFeeUsd; } if (dtRentalContract[0].ExemptedDepositFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtRentalContract[0].ExemptedDepositFee = dtRentalContract[0].ExemptedDepositFeeUsd; } //Add currency to List for (int i = 0; i < dtRentalContract.Count(); i++) { dtRentalContract[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } } else if (strServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE) { dtSaleContract = handlerS.GetTbt_SaleBasicForView(strContractCode, null, true); if (dtSaleContract[0].NormalInstallFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].NormalInstallFee = dtSaleContract[0].NormalInstallFeeUsd; } if (dtSaleContract[0].OrderInstallFeeCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].OrderInstallFee = dtSaleContract[0].OrderInstallFeeUsd; } if (dtSaleContract[0].InstallFeePaidBySECOMCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].InstallFeePaidBySECOM = dtSaleContract[0].InstallFeePaidBySECOMUsd; } if (dtSaleContract[0].InstallFeeRevenueBySECOMCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].InstallFeeRevenueBySECOM = dtSaleContract[0].InstallFeeRevenueBySECOMUsd; } if (dtSaleContract[0].OrderProductPriceCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].OrderProductPrice = dtSaleContract[0].OrderProductPriceUsd; } if (dtSaleContract[0].NormalProductPriceCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].NormalProductPrice = dtSaleContract[0].NormalProductPriceUsd; } if (dtSaleContract[0].BidGuaranteeAmount1CurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].BidGuaranteeAmount1 = dtSaleContract[0].BidGuaranteeAmount1Usd; } if (dtSaleContract[0].BidGuaranteeAmount2CurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].BidGuaranteeAmount2 = dtSaleContract[0].BidGuaranteeAmount2Usd; } if (dtSaleContract[0].NewBldMgmtCostCurrencyType == SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US) { dtSaleContract[0].NewBldMgmtCost = dtSaleContract[0].NewBldMgmtCostUsd; } //Add Currency to List for (int i = 0; i < dtSaleContract.Count(); i++) { dtSaleContract[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } } if (dtRentalContract.Count > 0) { // Get related data dtRentalSecurity = handlerR.GetTbt_RentalSecurityBasicForView(strContractCode, dtRentalContract[0].LastOCC); for (int i = 0; i < dtRentalSecurity.Count(); i++) { dtRentalSecurity[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } //Must get InstallationInterfaceHandler.GetInstallationStatus (Next phase) strInstallationStatusCode = iHandler.GetInstallationStatus(strContractCode); //======== GET INSTALLATION STATUS NAME ============================= List <doMiscTypeCode> lst = new List <doMiscTypeCode>(); List <doMiscTypeCode> miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_INSTALL_STATUS, ValueCode = strInstallationStatusCode } }; lst = chandler.GetMiscTypeCodeList(miscs); if (lst != null && lst.Count > 0) { strInstallationStatusName = lst[0].ValueDisplay; } //================================================================ // Select language vw_dtRentalContract = CommonUtil.ConvertObjectbyLanguage <dtTbt_RentalContractBasicForView, dtTbt_RentalContractBasicForView>(dtRentalContract, "Quo_OfficeName", "Con_OfficeName", "Op_OfficeName"); vw_dtRentalSecurity = CommonUtil.ConvertObjectbyLanguage <dtTbt_RentalSecurityBasicForView, dtTbt_RentalSecurityBasicForView>(dtRentalSecurity, "ProductName", "DocumentName", "DocumentNoName", "SalesMan1_EmpFirstName", "SalesMan1_EmpFirstName", "SalesMan1_EmpLastName", "SalesMan2_EmpFirstName", "SalesMan2_EmpLastName", "SalesSupport_EmpFirstName", "SalesSupport_EmpLastName", "Alm_EmpFirstName", "Alm_EmpLastName", "NegStaff1_EmpFirstName", "NegStaff1_EmpLastName", "NegStaff2_EmpFirstName", "NegStaff2_EmpLastName", "CompStaff_EmpFirstName", "CompStaff_EmpLastName", "Planner_EmpFirstName", "Planner_EmpLastName", "PlanChecker_EmpFirstName", "PlanChecker_EmpLastName", "PlanApprover_EmpFirstName", "PlanApprover_EmpLastName" ); /**** Convert code to short format *****/ foreach (var item in vw_dtRentalContract) { // contract code item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); item.OldContractCode = c.ConvertContractCode(item.OldContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); // customer code item.ContractTargetCustCode = c.ConvertCustCode(item.ContractTargetCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); item.RealCustomerCustCode = c.ConvertCustCode(item.RealCustomerCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); //site code item.SiteCode = c.ConvertSiteCode(item.SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } // dtOnlineContractInfo foreach (var item in dtOnlineContractInfo) { item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } } // Sale if (dtSaleContract.Count > 0) { // Get related data //dtOnlineContractInfo = handlerVC.GetContractTargetInfoByRelated(strContractCode, RelationType.C_RELATION_TYPE_SALE, dtSaleContract[0].OCC, ProductType.C_PROD_TYPE_SALE, ProductType.C_PROD_TYPE_AL, ProductType.C_PROD_TYPE_ONLINE, dtSaleContract[0].ProductTypeCode, // RelationType.C_RELATION_TYPE_MA, RelationType.C_RELATION_TYPE_SALE); //dtMaintenanceContractInfo = handlerVC.GetContractTargetInfoByRelated(strContractCode, RelationType.C_RELATION_TYPE_MA, dtSaleContract[0].OCC, ProductType.C_PROD_TYPE_SALE, ProductType.C_PROD_TYPE_AL, ProductType.C_PROD_TYPE_ONLINE, dtSaleContract[0].ProductTypeCode, // RelationType.C_RELATION_TYPE_MA, RelationType.C_RELATION_TYPE_SALE); dtOnlineContractInfo = handlerVC.GetContractTargetInfoByRelated(strContractCode, RelationType.C_RELATION_TYPE_SALE, dtSaleContract[0].OCC, dtSaleContract[0].ProductTypeCode); dtMaintenanceContractInfo = handlerVC.GetContractTargetInfoByRelated(strContractCode, RelationType.C_RELATION_TYPE_MA, dtSaleContract[0].OCC, dtSaleContract[0].ProductTypeCode); //Must get InstallationInterfaceHandler.GetInstallationStatus (Next phase) strInstallationStatusCode = iHandler.GetInstallationStatus(strContractCode); //======== GET INSTALLATION STATUS NAME ============================= List <doMiscTypeCode> lst = new List <doMiscTypeCode>(); List <doMiscTypeCode> miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_INSTALL_STATUS, ValueCode = strInstallationStatusCode } }; lst = chandler.GetMiscTypeCodeList(miscs); if (lst != null && lst.Count > 0) { strInstallationStatusName = lst[0].ValueDisplay; } //================================================================ // select language vw_dtSaleContract = CommonUtil.ConvertObjectbyLanguage <dtTbt_SaleBasicForView, dtTbt_SaleBasicForView>(dtSaleContract, "PurCust_CustName", "PurCust_CustFullName", "RealCust_CustName", "RealCust_CustFullName", "site_SiteName", "QuoEmp_EmpFirstName", "QuoEmp_EmpLastName", "DocTemp_DocumentName", "DocTemp_DocumentNoName", "PlanEmp_EmpFirstName", "PlanEmp_EmpLastName", "planAppEmp_EmpFirstName", "planAppEmp_EmpLastName", "PlanChkrEmp_EmpFirstName", "PlanChkrEmp_EmpLastName", "ProductName", "SalesMan1_EmpFirstName", "SalesMan1_EmpLastName", "Quo_OfficeName", "Con_OfficeName", "Sale_OfficeName", "Op_OfficeName"); /**** Convert code to short format *****/ // vw_dtSaleContract foreach (var item in vw_dtSaleContract) { // contract code item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); // customer code item.CustCode_PurCust = c.ConvertCustCode(item.CustCode_PurCust, CommonUtil.CONVERT_TYPE.TO_SHORT); item.CustCode_RealCust = c.ConvertCustCode(item.CustCode_RealCust, CommonUtil.CONVERT_TYPE.TO_SHORT); item.RealCustomerCustCode = c.ConvertCustCode(item.RealCustomerCustCode, CommonUtil.CONVERT_TYPE.TO_SHORT); // site code item.SiteCode = c.ConvertSiteCode(item.SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } // dtMaintenanceContractInfo foreach (var item in dtMaintenanceContractInfo) { item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } // Online contract foreach (var item in dtOnlineContractInfo) { item.ContractCode = c.ConvertContractCode(item.ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } } // Rental if (vw_dtRentalContract.Count > 0) { /* --- global variable for javascript side --*/ ViewBag._ContractCode = vw_dtRentalContract[0].ContractCode; ViewBag._OCC = vw_dtRentalContract[0].LastOCC; ViewBag._ContractTargetCode = vw_dtRentalContract[0].ContractTargetCustCode; ViewBag._RealCustomerCode = vw_dtRentalContract[0].RealCustomerCustCode; ViewBag._SiteCode = vw_dtRentalContract[0].SiteCode; ViewBag._ServiceTypeCode = vw_dtRentalContract[0].ServiceTypeCode; ViewBag._OldContractCode = vw_dtRentalContract[0].OldContractCode; ViewBag.ProductTypeCode = vw_dtRentalContract[0].ProductTypeCode; ViewBag.SiteCodeList = vw_dtRentalContract[0].SiteCode; ViewBag.ContractCode = vw_dtRentalContract[0].ContractCode; ViewBag.txtContractCode = vw_dtRentalContract[0].ContractCode; ViewBag.txtOccurrence = vw_dtRentalContract[0].LastOCC; ViewBag.txtUserCode = vw_dtRentalContract[0].UserCode; ViewBag.lnkCustomerCodeC = vw_dtRentalContract[0].ContractTargetCustCode; ViewBag.lnkCustomerCodeR = vw_dtRentalContract[0].RealCustomerCustCode; ViewBag.lnkSiteCode = vw_dtRentalContract[0].SiteCode; ViewBag.txtContractNameEng = vw_dtRentalContract[0].CustFullNameEN_Cust; // ContractTargetFullNameEN ViewBag.txtContractAddrEng = vw_dtRentalContract[0].AddressFullEN_Cust; ViewBag.txtSiteNameEng = vw_dtRentalContract[0].SiteNameEN_Site; ViewBag.txtSiteAddrEng = vw_dtRentalContract[0].AddressFullEN_Site; ViewBag.txtContractNameLocal = vw_dtRentalContract[0].CustFullNameLC_Cust; // ContractTargetFullNameLC ViewBag.txtContractAddrLocal = vw_dtRentalContract[0].AddressFullLC_Cust; ViewBag.txtSiteNameLocal = vw_dtRentalContract[0].SiteNameLC_Site; ViewBag.txtSiteAddrLocal = vw_dtRentalContract[0].AddressFullLC_Site; //Add by Jutarat A. on 26032014 ViewBag.txtCustomerContact = vw_dtRentalContract[0].ContactPersonName_Cust; ViewBag.txtTelephoneNoCust = vw_dtRentalContract[0].PhoneNo_Cust; ViewBag.txtFaxNo = vw_dtRentalContract[0].FaxNo_Cust; ViewBag.txtPersonInCharge = vw_dtRentalContract[0].PersonInCharge_Site; ViewBag.txtTelephoneNoSite = vw_dtRentalContract[0].PhoneNo_Site; //End Add //ViewBag.txtContactPoint = vw_dtRentalContract[0].ContactPoint; ViewBag.txtContactPoint = CommonUtil.IsNullOrEmpty(vw_dtRentalContract[0].ContactPoint) == true ? "-" : vw_dtRentalContract[0].ContactPoint; // section: contract detail info //ViewBag.txtReceived_deposit_fee = vw_dtRentalContract[0].BilledDepositFee != null ? vw_dtRentalContract[0].BilledDepositFee.Value.ToString(floatNumberFormat) : "-"; // SA request to chagnge :31/Jan/2012 ref. UCCM1-8 //ViewBag.txtReceived_deposit_fee = vw_dtRentalContract[0].PaidDepositFee.HasValue ? vw_dtRentalContract[0].PaidDepositFee.Value.ToString(floatNumberFormat) : "-"; // SA request to chagnge#2 :15/Mar/2012 ref. UCCM1-75 ViewBag.txtReceived_deposit_fee = vw_dtRentalContract[0].TextTransferOrderDepositFee; //ViewBag.txtReceived_deposit_fee = vw_dtRentalContract[0].OrderDepositFee.HasValue ? vw_dtRentalContract[0].OrderDepositFee.Value.ToString(floatNumberFormat) : "-"; ViewBag.txtOperation_office = CommonUtil.TextCodeName(vw_dtRentalContract[0].OperationOfficeCode, vw_dtRentalContract[0].Op_OfficeName); ViewBag.txtFirst_operation_date = vw_dtRentalContract[0].FirstSecurityStartDate != null ? vw_dtRentalContract[0].FirstSecurityStartDate.Value.ToString(dateFormat) : "-"; ViewBag.txtContract_fee = vw_dtRentalContract[0].TextTransferLastOrderContractFee; //ViewBag.txtContract_fee = vw_dtRentalContract[0].LastOrderContractFee != null ? vw_dtRentalContract[0].LastOrderContractFee.Value.ToString(floatNumberFormat) : "-"; ViewBag.txtContract_office = CommonUtil.TextCodeName(vw_dtRentalContract[0].OfficeCode_Con, vw_dtRentalContract[0].Con_OfficeName); ViewBag.txtLast_operation_date = vw_dtRentalContract[0].LastChangeImplementDate != null ? vw_dtRentalContract[0].LastChangeImplementDate.Value.ToString(dateFormat) : "-"; //ViewBag.txtProcessing_installation = "-"; Get value from InstallInterfaceHandler.GetInstallationSatatus (ContractCode) if (strInstallationStatusCode != InstallationStatus.C_INSTALL_STATUS_NO_INSTALLATION) { ViewBag.txtProcessing_installation = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS190", "lblYes"); } else { ViewBag.txtProcessing_installation = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS190", "lblNo"); } //ViewBag.txtProcessing_installation = strInstallationStatusCode+" : "+strInstallationStatusName; string strLastChangeTypeDisplayValue = handlerComm.GetMiscDisplayValue(MiscTypeList, MiscType.C_RENTAL_CHANGE_TYPE, vw_dtRentalContract[0].LastChangeType); ViewBag.txtLast_change_type = CommonUtil.TextCodeName(vw_dtRentalContract[0].LastChangeType, strLastChangeTypeDisplayValue); //ViewBag.txtProcessing_installation_status = "-"; Get value from InstallInterfaceHandler.GetInstallationSatatus (ContractCode) ViewBag.txtProcessing_installation_status = strInstallationStatusCode + " : " + strInstallationStatusName; ViewBag.lnkOld_contract_codeC = vw_dtRentalContract[0].OldContractCode; //** // Change bOutOfRegulationDocFlag --> to RentalContract[0].IrregurationDocUsageFlag (old: vw_dtRentalSecurity[0].DocAuditResult ) ViewBag.bOutOfRegulationDocFlag = vw_dtRentalContract[0].IrregurationDocUsageFlag.HasValue == true ? vw_dtRentalContract[0].IrregurationDocUsageFlag.Value : false; ViewBag.txtRentalAttachImportanceFlag = vw_dtRentalContract[0].SpecialCareFlag; } if (vw_dtRentalSecurity.Count > 0) { // section: contract detail info ViewBag.txtProduct = CommonUtil.TextCodeName(vw_dtRentalSecurity[0].ProductCode, vw_dtRentalSecurity[0].ProductName); ViewBag.txtSecurity_type_code = vw_dtRentalSecurity[0].SecurityTypeCode; // ContractStartDate - ContractEndDate string strContractStartDate = vw_dtRentalSecurity[0].ContractStartDate != null ? vw_dtRentalSecurity[0].ContractStartDate.Value.ToString(dateFormat) : string.Empty; //string strContractEndDate = vw_dtRentalSecurity[0].ContractEndDate != null ? vw_dtRentalSecurity[0].ContractEndDate.Value.ToString(dateFormat) : string.Empty; string strContractEndDate = vw_dtRentalSecurity[0].CalContractEndDate != null ? vw_dtRentalSecurity[0].CalContractEndDate.Value.ToString(dateFormat) : string.Empty; ViewBag.strContractStartDate = strContractStartDate; ViewBag.strContractEndDate = strContractEndDate; if (CommonUtil.IsNullOrEmpty(strContractStartDate) == false && CommonUtil.IsNullOrEmpty(strContractEndDate) == false) { ViewBag.txtContract_duration = string.Format("{0} <span style='color:black;'> ~ </span> {1}", strContractStartDate, strContractEndDate); } else if (CommonUtil.IsNullOrEmpty(strContractStartDate) == false) { ViewBag.txtContract_duration = string.Format("{0} <span style='color:black;'> ~ </span> {1}", strContractStartDate, "-"); } else if (CommonUtil.IsNullOrEmpty(strContractEndDate) == false) { ViewBag.txtContract_duration = string.Format("{0} <span style='color:black;'> ~ </span> {1}", "-", strContractEndDate); } else { ViewBag.txtContract_duration = string.Empty; } ViewBag.txtSalesman1 = CommonUtil.TextCodeName(vw_dtRentalSecurity[0].SalesmanEmpNo1, string.Format("{0} {1}", vw_dtRentalSecurity[0].SalesMan1_EmpFirstName, vw_dtRentalSecurity[0].SalesMan1_EmpLastName));; ViewBag.txtContract_duration_month = vw_dtRentalSecurity[0].ContractDurationMonth != null ? vw_dtRentalSecurity[0].ContractDurationMonth.Value.ToString(numberFormat) : "-"; ViewBag.txtAuto_renew_months = vw_dtRentalSecurity[0].AutoRenewMonth != null ? vw_dtRentalSecurity[0].AutoRenewMonth.Value.ToString(numberFormat) : "-"; // Change bOutOfRegulationDocFlag --> to RentalContract[0].IrregurationDocUsageFlag //ViewBag.bOutOfRegulationDocFlag = vw_dtRentalSecurity[0].DocAuditResult == "1" ? true : false ; ViewBag.chkFire_monitoring = vw_dtRentalSecurity[0].FireMonitorFlag.HasValue == true ? vw_dtRentalSecurity[0].FireMonitorFlag.Value : false; ViewBag.chkCrime_prevention = vw_dtRentalSecurity[0].CrimePreventFlag.HasValue == true ? vw_dtRentalSecurity[0].CrimePreventFlag.Value : false;; ViewBag.chkEmergency_report = vw_dtRentalSecurity[0].EmergencyReportFlag.HasValue == true ? vw_dtRentalSecurity[0].EmergencyReportFlag.Value : false;; ViewBag.chkFacility_monitoring = vw_dtRentalSecurity[0].FacilityMonitorFlag.HasValue == true ? vw_dtRentalSecurity[0].FacilityMonitorFlag.Value : false;; } // Sale if (vw_dtSaleContract.Count > 0) { /* --- global variable for javascript side --*/ ViewBag._ContractCode = vw_dtSaleContract[0].ContractCode; ViewBag._OCC = vw_dtSaleContract[0].OCC; ViewBag._PurchaserCustCode = vw_dtSaleContract[0].CustCode_PurCust; ViewBag._RealCustomerCode = vw_dtSaleContract[0].RealCustomerCustCode; ViewBag._SiteCode = vw_dtSaleContract[0].SiteCode; ViewBag._ServiceTypeCode = vw_dtSaleContract[0].ServiceTypeCode; ViewBag.SiteCodeList = vw_dtSaleContract[0].SiteCode; ViewBag.ContractCode = vw_dtSaleContract[0].ContractCode; ViewBag.ProductTypeCode = vw_dtSaleContract[0].ProductTypeCode; ViewBag.txtContractCode = vw_dtSaleContract[0].ContractCode; ViewBag.txtOccurrence = vw_dtSaleContract[0].OCC; ViewBag.lnkCustomerCodeC_Purchaser = vw_dtSaleContract[0].CustCode_PurCust; ViewBag.lnkCustomerCodeR = vw_dtSaleContract[0].RealCustomerCustCode; ViewBag.lnkSiteCode = vw_dtSaleContract[0].SiteCode; ViewBag.txtContractNameEng = vw_dtSaleContract[0].PurCust_CustFullNameEN; ViewBag.txtContractAddrEng = vw_dtSaleContract[0].AddressFullEN_PurCust; ViewBag.txtSiteNameEng = vw_dtSaleContract[0].site_SiteNameEN; ViewBag.txtSiteAddrEng = vw_dtSaleContract[0].AddressFullEN_site; ViewBag.txtContractNameLocal = vw_dtSaleContract[0].PurCust_CustFullNameLC; ViewBag.txtContractAddrLocal = vw_dtSaleContract[0].AddressFullLC_PurCust; ViewBag.txtSiteNameLocal = vw_dtSaleContract[0].site_SiteNameLC; ViewBag.txtSiteAddrLocal = vw_dtSaleContract[0].AddressFullLC_site; //Add by Jutarat A. on 26032014 ViewBag.txtCustomerContact = vw_dtSaleContract[0].ContactPersonName_PurCust; ViewBag.txtTelephoneNoCust = vw_dtSaleContract[0].PhoneNo_PurCust; ViewBag.txtFaxNo = vw_dtSaleContract[0].FaxNo_PurCust; ViewBag.txtPersonInCharge = vw_dtSaleContract[0].PersonInCharge_site; ViewBag.txtTelephoneNoSite = vw_dtSaleContract[0].PhoneNo_site; //End Add //ViewBag.txtContactPoint = vw_dtSaleContract[0].ContactPoint; ViewBag.txtContactPoint = CommonUtil.IsNullOrEmpty(vw_dtSaleContract[0].ContactPoint) == true ? "-" : vw_dtSaleContract[0].ContactPoint; // section : sale contract detail info ViewBag.txtProduct = CommonUtil.TextCodeName(vw_dtSaleContract[0].ProductCode, vw_dtSaleContract[0].ProductName); string strSaleTypeDisplayValue = handlerComm.GetMiscDisplayValue(MiscTypeList, MiscType.C_SALE_TYPE, vw_dtSaleContract[0].SalesType); ViewBag.txtSale_type = CommonUtil.TextCodeName(vw_dtSaleContract[0].SalesType, strSaleTypeDisplayValue); ViewBag.txtProduct_Price = vw_dtSaleContract[0].TextTransferOrderProductPrice; ViewBag.txtInstallation_Fee = vw_dtSaleContract[0].TextTransferOrderInstallFee; //ViewBag.txtBilling_amount = vw_dtSaleContract[0].TextTransferOrderSalePrice; //ViewBag.txtBilling_amount = vw_dtSaleContract[0].OrderSalePrice != null ? vw_dtSaleContract[0].OrderSalePrice.Value.ToString(floatNumberFormat) : "-"; string SaleProdessManagementStatusDisplayValue = handlerComm.GetMiscDisplayValue(MiscTypeList, MiscType.C_SALE_PROC_MANAGE_STATUS, vw_dtSaleContract[0].SaleProcessManageStatus); ViewBag.txtProcess_management_status = CommonUtil.TextCodeName(vw_dtSaleContract[0].SaleProcessManageStatus, SaleProdessManagementStatusDisplayValue); ViewBag.txtLast_operation_date = vw_dtSaleContract[0].ChangeImplementDate != null ? vw_dtSaleContract[0].ChangeImplementDate.Value.ToString(dateFormat) : "-"; //ViewBag.txtProcessing_installation = "-";Get value from InstallInterfaceHandler.GetInstallationSatatus (ContractCode) if (strInstallationStatusCode != InstallationStatus.C_INSTALL_STATUS_NO_INSTALLATION) { ViewBag.txtProcessing_installation = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS190", "lblYes"); } else { ViewBag.txtProcessing_installation = CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS190", "lblNo"); } //ViewBag.txtProcessing_installation = strInstallationStatusCode + " : " + strInstallationStatusName; string strChangeTypeDisplayValue = handlerComm.GetMiscDisplayValue(MiscTypeList, MiscType.C_SALE_CHANGE_TYPE, vw_dtSaleContract[0].ChangeType); ViewBag.txtLast_change_type = CommonUtil.TextCodeName(vw_dtSaleContract[0].ChangeType, strChangeTypeDisplayValue); //ViewBag.txtProcessing_installation_status = "-"; Get value from InstallInterfaceHandler.GetInstallationSatatus (ContractCode) ViewBag.txtProcessing_installation_status = strInstallationStatusCode + " : " + strInstallationStatusName; ViewBag.txtApprove_date = vw_dtSaleContract[0].FirstContractDate != null ? vw_dtSaleContract[0].FirstContractDate.Value.ToString(dateFormat) : "-"; ViewBag.txtSalesman1 = CommonUtil.TextCodeName(vw_dtSaleContract[0].SalesmanEmpNo1, string.Format("{0} {1}", vw_dtSaleContract[0].SalesMan1_EmpFirstName, vw_dtSaleContract[0].SalesMan1_EmpLastName)); ViewBag.txtInstrument_stock_out_date = vw_dtSaleContract[0].InstrumentStockOutDate != null ? vw_dtSaleContract[0].InstrumentStockOutDate.Value.ToString(dateFormat) : "-"; ViewBag.txtContract_office = CommonUtil.TextCodeName(vw_dtSaleContract[0].ContractOfficeCode, vw_dtSaleContract[0].Con_OfficeName); ViewBag.txtComplete_installation_date = vw_dtSaleContract[0].InstallCompleteDate != null ? vw_dtSaleContract[0].InstallCompleteDate.Value.ToString(dateFormat) : "-"; ViewBag.txtSales_office = CommonUtil.TextCodeName(vw_dtSaleContract[0].SalesOfficeCode, vw_dtSaleContract[0].Sale_OfficeName); ViewBag.txtCustomer_acceptance_date = vw_dtSaleContract[0].CustAcceptanceDate != null ? vw_dtSaleContract[0].CustAcceptanceDate.Value.ToString(dateFormat) : "-"; ViewBag.txtOperation_office = CommonUtil.TextCodeName(vw_dtSaleContract[0].OperationOfficeCode, vw_dtSaleContract[0].Op_OfficeName); ViewBag.txtSaleAttachImportanceFlag = vw_dtSaleContract[0].SpecialCareFlag; } if (dtOnlineContractInfo.Count > 0) { ViewBag.lnkOnline_contract_code = dtOnlineContractInfo[0].ContractCode; ViewBag._OnlineContractCode = dtOnlineContractInfo[0].ContractCode; } if (dtMaintenanceContractInfo.Count > 0) { ViewBag.lnkMaintenance_contract_code = dtMaintenanceContractInfo[0].ContractCode; ViewBag._MaintenanceContractCode = dtMaintenanceContractInfo[0].ContractCode; } return(View()); } catch (Exception ex) { ObjectResultData res = new ObjectResultData(); res.AddErrorMessage(ex); return(Json(res)); } }