/// <summary> /// Getting installation slip history /// </summary> /// <param name="ContractProjectCode"></param> /// <param name="MaintenanceNo"></param> /// <param name="SlipNo"></param> /// <returns></returns> public ActionResult CMS180_GetInstallationSlipHistory(string ContractProjectCode, string MaintenanceNo, string SlipNo) { ObjectResultData res = new ObjectResultData(); try { IInstallationHandler hand = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; List <dtInstallationHistoryForView> lst = hand.GetTbt_InstallationHistoryForView( ServiceType.C_SERVICE_TYPE_SALE, ServiceType.C_SERVICE_TYPE_RENTAL, MiscType.C_SALE_INSTALL_TYPE, MiscType.C_RENTAL_INSTALL_TYPE, ChangeReasonType.C_CHANGE_REASON_TYPE_CUSTOMER, ChangeReasonType.C_CHANGE_REASON_TYPE_SECOM, MiscType.C_CUSTOMER_REASON, MiscType.C_SECOM_REASON, ContractProjectCode, MaintenanceNo, SlipNo, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_LOCAL, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US); if (lst.Count > 0) { res.ResultData = lst[0]; } //res.ResultData = lst; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Get rental contract basic information to show in user control /// </summary> /// <param name="strContrancCode"></param> /// <returns></returns> public doRentalContractBasicInformation GetRentalContactBasicInformationData(string strContractCode) { try { string installStatus = ""; doRentalContractBasicInformation doRentalContract = new doRentalContractBasicInformation(); doRentalContract.ContractCode = strContractCode; CommonUtil.CheckMandatoryFiled(doRentalContract); List <doRentalContractBasicInformation> doRentalContractBasicInformation = base.GetRentalContractBasicInformation(strContractCode); ICommonHandler common = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IInstallationHandler installhandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; List <doMiscTypeCode> lMiscTypeCode = new List <doMiscTypeCode>(); List <doMiscTypeCode> viewMiscTypeCode = new List <doMiscTypeCode>(); doMiscTypeCode dMiscTypeCode = new doMiscTypeCode(); installStatus = installhandler.GetInstallationStatus(strContractCode); dMiscTypeCode.FieldName = SECOM_AJIS.Common.Util.ConstantValue.MiscType.C_INSTALL_STATUS; //dMiscTypeCode.ValueCode = "99"; //I will set default to 00 because the table installation still not create. dMiscTypeCode.ValueCode = installStatus; lMiscTypeCode.Add(dMiscTypeCode); lMiscTypeCode = common.GetMiscTypeCodeList(lMiscTypeCode); viewMiscTypeCode = common.GetMiscTypeCodeList(lMiscTypeCode); if (doRentalContractBasicInformation.Count != 0) { if (viewMiscTypeCode != null && viewMiscTypeCode.Count > 0) { doRentalContractBasicInformation[0].InstallationStatusCode = installStatus; doRentalContractBasicInformation[0].InstallationStatusName = viewMiscTypeCode[0].ValueDisplay; } //List<doRentalContractBasicInformation> list = doRentalContractBasicInformation; //CommonUtil.MappingObjectLanguage<doRentalContractBasicInformation>(list); //doRentalContractBasicInformation[0].OperationOfficeName = list[0].OperationOfficeName; CommonUtil.MappingObjectLanguage <doRentalContractBasicInformation>(doRentalContractBasicInformation); MiscTypeMappingList miscList = new MiscTypeMappingList(); miscList.AddMiscType(doRentalContractBasicInformation[0]); ICommonHandler comHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comHandler.MiscTypeMappingList(miscList); return(doRentalContractBasicInformation[0]); } else { return(null); } } catch (Exception) { throw; } }
/// <summary> /// Getting instrument detail and load to grid /// </summary> /// <param name="SlipNo"></param> /// <returns></returns> public ActionResult CMS180_InstrumentDetailGrid(string SlipNo) { ObjectResultData res = new ObjectResultData(); List <dtInstallationSlipDetailsForView> lst = new List <dtInstallationSlipDetailsForView>(); try { IInstallationHandler hand = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; //lst = hand.GetTbt_InstallationSlipDetailsForView(SlipNo, null); lst = hand.GetTbt_InstallationSlipDetailsForView(SlipNo, null); //Add by Jutarat A. on 31012013 foreach (dtInstallationSlipDetailsForView data in lst) { data.AddInstalledQty = (data.TotalStockOutQty ?? 0) + (data.AddInstalledQty ?? 0); data.ReturnQty = (data.ReturnQty ?? 0) + (data.NotInstalledQty ?? 0); } //End Add var sortedList = from p in lst orderby p.InstrumentCode select p; lst = sortedList.ToList <dtInstallationSlipDetailsForView>(); res.ResultData = CommonUtil.ConvertToXml <dtInstallationSlipDetailsForView>(lst, "Common\\CMS180_InstrumentDetail", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult ISS061_CompleteInstallRental(string RentalContractCode) { ObjectResultData res = new ObjectResultData(); try { using (TransactionScope scope = new TransactionScope()) { if (CommonUtil.IsNullOrEmpty(RentalContractCode)) { res.AddErrorMessage(MessageUtil.MODULE_INSTALLATION, "ISS061", MessageUtil.MODULE_INSTALLATION, MessageUtil.MessageList.MSG0007, new string[] { "lblRentalContractCode" }, new string[] { "RentalContractCode" }); return(Json(res)); } IInstallationHandler iHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; iHandler.Temp_CompleteInstallation_Rental(RentalContractCode); scope.Complete(); return(Json(res)); } } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Get sale contract basic information to show in user control /// </summary> /// <param name="contractCode"></param> /// <param name="occCode"></param> /// <returns></returns> public List <doSaleContractBasicInformation> GetSaleContractBasicInformationData(string contractCode, string occCode) { try { List <doSaleContractBasicInformation> doSaleBasicList = base.GetSaleContractBasicInformation(contractCode, FlagType.C_FLAG_ON, occCode); if (doSaleBasicList == null) { doSaleBasicList = new List <doSaleContractBasicInformation>(); } else { //Add installation status IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; string strInstallationStatusCode = installHandler.GetInstallationStatus(contractCode); foreach (doSaleContractBasicInformation data in doSaleBasicList) { data.InstallationStatusCode = strInstallationStatusCode; } CommonUtil.MappingObjectLanguage <doSaleContractBasicInformation>(doSaleBasicList); MiscTypeMappingList miscList = new MiscTypeMappingList(); miscList.AddMiscType(doSaleBasicList.ToArray()); ICommonHandler comHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comHandler.MiscTypeMappingList(miscList); } return(doSaleBasicList); } catch (Exception ex) { throw ex; } }
/// <summary> /// Getting installaiton for CSV /// </summary> /// <returns></returns> public ActionResult CMS180_GetInstallationForCSV() { CMS180_ScreenParameter sParam = GetScreenObject <CMS180_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtInstallation> lst = new List <dtInstallation>(); try { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; doSearchInstallationCondition cond = new doSearchInstallationCondition(); cond.slipNoNullFlag = true; lst = handler.GetInstallationDataListForCsvFile(cond); List <CMS180_SearchResultGridData> resultGridData = CommonUtil.ClonsObjectList <dtInstallation, CMS180_SearchResultGridData>(lst); if (resultGridData.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } else { res.ResultData = resultGridData; sParam.doResultCSVData = resultGridData; //Add by Jutarat A. on 25062013 } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Search and get installation data list for view with initial /// </summary> /// <returns></returns> public ActionResult CMS180_SearchResultWithInitial() { CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtInstallation> lst = new List <dtInstallation>(); try { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; doSearchInstallationCondition cond = new doSearchInstallationCondition(); if (!CommonUtil.IsNullOrEmpty(param.ContractCode) || !CommonUtil.IsNullOrEmpty(param.InstallationSlipNo)) { cond.ContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.slipNo = param.InstallationSlipNo; cond.ViewFlag = true; cond.InstallationBy = null; } else { cond.InstallationBy = InstallationBy.C_INSTALLATION_BY_SECOM; } lst = handler.GetInstallationDataListForView(cond); res.ResultData = CommonUtil.ConvertToXml <dtInstallation>(lst, "Common\\CMS180_ViewInstallationInfo", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult ISS100_ExportExcelDataMonthly(doInstallationReportMonthly dtInstallation) { ISS100_ScreenParameter param = GetScreenObject <ISS100_ScreenParameter>(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { if (!this.ModelState.IsValid) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ValidatorUtil.BuildErrorMessage(res, this); return(Json(res)); } if (dtInstallation == null || CommonUtil.IsNullAllField(dtInstallation)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); } else { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; var lst = handler.GetInstallationReportMonthlyExcelFile(dtInstallation); if (lst == null || lst.Count == 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; return(Json(res)); } IInstallationDocumentHandler docService = ServiceContainer.GetService <IInstallationDocumentHandler>() as IInstallationDocumentHandler; if (dtInstallation.ReportType == "0") { param.PendingDownloadFilePath = docService.GenerateISR130Report(lst, dtInstallation); param.PendingDownloadFileName = "ISR130NewReport.xlsx"; } else { param.PendingDownloadFilePath = docService.GenerateISR140Report(lst, dtInstallation); param.PendingDownloadFileName = "ISR140ClaimReport.xlsx"; } res.ResultData = true; } } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Getting installation memo for view /// </summary> /// <param name="ContractProjectCode"></param> /// <returns></returns> public ActionResult CMS180_GetInstallationMemoForview(string ContractProjectCode, string MaintenanceNo, string SlipNo) { ObjectResultData res = new ObjectResultData(); try { IInstallationHandler hand = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; List <dtInstallationMemoForView> lst = hand.GetTbt_InstallationMemoForView(ContractProjectCode, MaintenanceNo, SlipNo); if (lst.Count > 0) { res.ResultData = lst; } //res.ResultData = lst; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult CMS180_InstallationHistory(string ContractProjectCode, string MaintenanceNo, string SlipNo) { ObjectResultData res = new ObjectResultData(); try { //IInstallationHandler hand = ServiceContainer.GetService<IInstallationHandler>() as IInstallationHandler; //List<tbt_InstallationHistory> lst = hand.GetTbt_InstallationHistory(ContractProjectCode, MaintenanceNo, null); IInstallationHandler hand = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; //List<dtInstallationHistoryForView> lst = hand.GetTbt_InstallationHistoryForView( // ServiceType.C_SERVICE_TYPE_SALE, // ServiceType.C_SERVICE_TYPE_RENTAL, // MiscType.C_SALE_INSTALL_TYPE, // MiscType.C_RENTAL_INSTALL_TYPE, // ChangeReasonType.C_CHANGE_REASON_TYPE_CUSTOMER, // ChangeReasonType.C_CHANGE_REASON_TYPE_SECOM, // MiscType.C_CUSTOMER_REASON, // MiscType.C_SECOM_REASON, // ContractProjectCode, MaintenanceNo, null); List <dtInsHistory> lst = hand.GetSlipNoHistory(SlipNo); //Comment by Jutarat A. on 08052013 (Sort from sp_IS_GetSlipNoHistory) //var sortedList = from p in lst // orderby p.SlipNo // select p; //lst = sortedList.ToList<dtInsHistory>(); //End Comment ComboBoxModel cboModel = new ComboBoxModel(); cboModel.SetList <dtInsHistory>(lst, "SlipNo", "SlipNo"); res.ResultData = cboModel; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Getting sub contractor /// </summary> /// <param name="MaintenanceNo"></param> /// <returns></returns> public ActionResult CMS180_SubcontractorGrid(string MaintenanceNo) { ObjectResultData res = new ObjectResultData(); List <dtInstallationPOManagementForView> lst = new List <dtInstallationPOManagementForView>(); try { IInstallationHandler hand = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; lst = hand.GetTbt_InstallationPOManagementForView(MaintenanceNo); var sortedList = from p in lst orderby p.SubcontractorCode select p; lst = sortedList.ToList <dtInstallationPOManagementForView>(); res.ResultData = CommonUtil.ConvertToXml <dtInstallationPOManagementForView>(lst, "Common\\CMS180_SubContractor", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Generate installation history combobox /// </summary> /// <param name="helper"></param> /// <param name="id"></param> /// <param name="attribute"></param> /// <param name="include_idx0"></param> /// <returns></returns> public static MvcHtmlString InstallationHistoryComboBox(this HtmlHelper helper, string id, object attribute = null, bool include_idx0 = true) { List <tbt_InstallationHistory> lst = new List <tbt_InstallationHistory>(); try { IInstallationHandler handle = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; lst = handle.GetTbt_InstallationHistory(null, null, null); var sortedList = from p in lst orderby p.HistoryNo select p; lst = sortedList.ToList <tbt_InstallationHistory>(); //lst = (from p in lst orderby p.DistrictName ascending select p).ToList<tbm_District>(); } catch { lst = new List <tbt_InstallationHistory>(); } return(CommonUtil.CommonComboBox <tbt_InstallationHistory>(id, lst, "SlipNo", "SlipNo", attribute)); }
public void UpdateOperationOffice(string contractCode, string operationOfficeCode) { try { if (string.IsNullOrEmpty(contractCode) || string.IsNullOrEmpty(operationOfficeCode)) { return; } ISaleContractHandler saleHandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; var lstSales = saleHandler.GetTbt_SaleBasic(contractCode, null, null); if (lstSales != null && lstSales.Count > 0) { foreach (var sale in lstSales) { sale.OperationOfficeCode = operationOfficeCode; saleHandler.UpdateTbt_SaleBasic(sale); } } IQuotationHandler quotationHandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; var lstQuotationTarget = quotationHandler.GetTbt_QuotationTargetByContractCode(contractCode); if (lstQuotationTarget != null && lstQuotationTarget.Count > 0) { foreach (var q in lstQuotationTarget) { quotationHandler.UpdateQuotationTarget(new doUpdateQuotationTargetData() { QuotationTargetCode = q.QuotationTargetCode, ContractTransferStatus = q.ContractTransferStatus, ContractCode = q.ContractCode, TransferDate = q.TransferDate, TransferAlphabet = q.TransferAlphabet, LastAlphabet = q.LastAlphabet, QuotationOfficeCode = q.QuotationTargetCode, OperationOfficeCode = operationOfficeCode, }); } } IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; var lstInstallationBasic = installHandler.GetTbt_InstallationBasicData(contractCode); if (lstInstallationBasic != null && lstInstallationBasic.Count > 0) { foreach (var ib in lstInstallationBasic) { ib.OperationOfficeCode = operationOfficeCode; installHandler.UpdateTbt_InstallationBasic(ib); } } var lstInstallationHistory = installHandler.GetTbt_InstallationHistory(contractCode, null, null); if (lstInstallationHistory != null && lstInstallationHistory.Count > 0) { foreach (var ih in lstInstallationHistory) { ih.OperationOfficeCode = operationOfficeCode; } installHandler.UpdateTbt_InstallationHistory(lstInstallationHistory); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Validate business of screen /// </summary> /// <param name="res"></param> /// <param name="tbt_SaleBasicData"></param> public void ValidateDataBusiness_CTS090(ObjectResultData res, tbt_SaleBasic tbt_SaleBasicData = null) { CTS090_RegisterCancelTargetData registerCancelData; IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; try { if (tbt_SaleBasicData != null) { registerCancelData = new CTS090_RegisterCancelTargetData(); registerCancelData.RegisterCancelData = tbt_SaleBasicData; } else { CTS090_ScreenParameter sParam = GetScreenObject <CTS090_ScreenParameter>(); registerCancelData = sParam.CTS090_Session; } if (registerCancelData != null) { //Check change type if ((registerCancelData.RegisterCancelData != null && registerCancelData.RegisterCancelData.ChangeType != null) && ((registerCancelData.RegisterCancelData.ChangeType != SaleChangeType.C_SALE_CHANGE_TYPE_NEW_SALE) && (registerCancelData.RegisterCancelData.ChangeType != SaleChangeType.C_SALE_CHANGE_TYPE_ADD_SALE))) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3168, null, null); return; } //Check complete installation status if ((registerCancelData.RegisterCancelData != null && registerCancelData.RegisterCancelData.InstallationCompleteFlag != null) && (registerCancelData.RegisterCancelData.InstallationCompleteFlag == FlagType.C_FLAG_ON)) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3058, null, null); return; } //Check cancel status if ((registerCancelData.RegisterCancelData != null && registerCancelData.RegisterCancelData.SaleProcessManageStatus != null) && (registerCancelData.RegisterCancelData.SaleProcessManageStatus == SaleProcessManageStatus.C_SALE_PROCESS_STATUS_CANCEL)) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3105, null, null); return; } //Add by Jutarat A. on 06062013 //Check installation status //Get installation basic List <tbt_InstallationBasic> doTbt_InstallationBasicValidate = installHandler.GetTbt_InstallationBasicData(registerCancelData.RegisterCancelData.ContractCode); if (doTbt_InstallationBasicValidate != null && doTbt_InstallationBasicValidate.Count > 0 && doTbt_InstallationBasicValidate[0].InstallationStatus != InstallationStatus.C_INSTALL_STATUS_INSTALL_NOT_REGISTERED) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3309, null, null); return; } //End Add } } catch (Exception ex) { res.AddErrorMessage(ex); } }
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)); } }
/// <summary> /// Check system suspending, user’s permission and user’s authority of screen /// </summary> /// <param name="param"></param> /// <returns></returns> public ActionResult CTS055_Authority(CTS055_ScreenParameter param) { ObjectResultData res = new ObjectResultData(); try { CommonUtil util = new CommonUtil(); ISaleContractHandler salehandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; ICommonHandler commonHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IRentralContractHandler renderHandler = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; IInstallationHandler installhandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; //1.1 Check suspending if (commonHandler.IsSystemSuspending()) { res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0049, null, null); return(Json(res)); } //1.2 Check user's permission if (!CheckUserPermission(ScreenID.C_SCREEN_ID_CP12_CANCEL_UNIMPLEMENTED_CONTRACT, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0053, null, null); return(Json(res)); } //if (String.IsNullOrEmpty(param.ContractCode) && !String.IsNullOrEmpty(CommonUtil.dsTransData.dtCommonSearch.ContractCode)) //{ // param.ContractCode = CommonUtil.dsTransData.dtCommonSearch.ContractCode; //} if (String.IsNullOrEmpty(param.ContractCode) && param.CommonSearch != null) { if (CommonUtil.IsNullOrEmpty(param.CommonSearch.ContractCode) == false) { param.ContractCode = param.CommonSearch.ContractCode; } } // Check parameter if ((param == null) || (String.IsNullOrEmpty(param.ContractCode))) { // Not valid //res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0011, new string[] { "Contract Code" }, null); res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0147, null, null); return(Json(res)); } //Comment by Jutarat A. on 08082012 //var saleExists = salehandler.IsContractExist(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG)); //if (saleExists.Count > 0 && saleExists[0].GetValueOrDefault()) //{ // res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3278, null, null); // return Json(res); //} // Check is contact exists var contractObj = renderHandler.GetTbt_RentalContractBasic(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG), null); if ((contractObj == null) || (contractObj.Count == 0)) { // Not found //res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0011, new string[] { String.Format("Contract Code: {0}", param.ContractCode) }, null); res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0124, null, null); return(Json(res)); } //1.3 Check user's authority to view data /* * if (CommonUtil.dsTransData.dtOfficeData.FindAll(delegate(OfficeDataDo s) { return s.OfficeCode == contractObj[0].ContractOfficeCode; }).Count == 0) * { * res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0063, null, null); * return Json(res); * } * * if (CommonUtil.dsTransData.dtOfficeData.FindAll(delegate(OfficeDataDo s) { return s.OfficeCode == contractObj[0].OperationOfficeCode; }).Count == 0) * { * res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0063, null, null); * return Json(res); * } * */ var existsContarctOffice = CommonUtil.dsTransData.dtOfficeData.Where(x => x.OfficeCode == contractObj[0].ContractOfficeCode); var existsOperateOffice = CommonUtil.dsTransData.dtOfficeData.Where(x => x.OfficeCode == contractObj[0].OperationOfficeCode); if ((contractObj[0].ContractStatus == ContractStatus.C_CONTRACT_STATUS_BEF_START && (existsContarctOffice.Count() <= 0) && (existsOperateOffice.Count() <= 0)) || (contractObj[0].ContractStatus == ContractStatus.C_CONTRACT_STATUS_AFTER_START && (existsOperateOffice.Count() <= 0)) ) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063, null, null); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } var lastOCC = renderHandler.GetLastUnimplementedOCC(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG)); if (String.IsNullOrEmpty(lastOCC) || contractObj[0].ProductTypeCode == ProductType.C_PROD_TYPE_MA || contractObj[0].ProductTypeCode == ProductType.C_PROD_TYPE_SG || contractObj[0].ProductTypeCode == ProductType.C_PROD_TYPE_BE ) { res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3056, null, null); return(Json(res)); } if ((contractObj[0].LastChangeType == RentalChangeType.C_RENTAL_CHANGE_TYPE_CANCEL) || (contractObj[0].LastChangeType == RentalChangeType.C_RENTAL_CHANGE_TYPE_CANCEL_BEFORE_START) || (contractObj[0].LastChangeType == RentalChangeType.C_RENTAL_CHANGE_TYPE_END_CONTRACT) || (contractObj[0].LastChangeType == RentalChangeType.C_RENTAL_CHANGE_TYPE_TERMINATED)) { res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3001, null, null); return(Json(res)); } var secureObj = renderHandler.GetTbt_RentalSecurityBasic(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG), lastOCC); // Unimplement Addition string installStatus = installhandler.GetInstallationStatus(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG)); if (((contractObj[0].ProductTypeCode == ProductType.C_PROD_TYPE_AL) || (contractObj[0].ProductTypeCode == ProductType.C_PROD_TYPE_RENTAL_SALE)) && ((installStatus != InstallationStatus.C_INSTALL_STATUS_NO_INSTALLATION) || (secureObj[0].InstallationCompleteFlag == FlagType.C_FLAG_ON))) { res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3054, null, null); return(Json(res)); } string occCode = renderHandler.GetLastUnimplementedOCC(contractObj[0].ContractCode); if (String.IsNullOrEmpty(occCode)) { res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3055, null, null); return(Json(res)); } var dtRentalSecurityBasic = renderHandler.GetTbt_RentalSecurityBasicForView(contractObj[0].ContractCode, occCode.Trim())[0]; if (StartType.C_START_TYPE_ALTER_START == contractObj[0].StartType && OCCType.C_FIRST_UNIMPLEMENTED_SECURITY_OCC == dtRentalSecurityBasic.OCC) { res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3288, null, null); return(Json(res)); } if (contractObj[0].ContractStatus == SECOM_AJIS.Common.Util.ConstantValue.ContractStatus.C_CONTRACT_STATUS_BEF_START && dtRentalSecurityBasic.OCC == SECOM_AJIS.Common.Util.ConstantValue.OCCType.C_FIRST_UNIMPLEMENTED_SECURITY_OCC) { res.AddErrorMessage("Contract", MessageUtil.MessageList.MSG3055, null, null); return(Json(res)); } //================ CHeck permission to view contract data =================== List <tbt_RentalContractBasic> listRentalContractBasic; listRentalContractBasic = renderHandler.GetTbt_RentalContractBasic(util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG), null); //1.3 Check user's authority to view data if (CommonUtil.dsTransData.dtOfficeData.FindAll(delegate(OfficeDataDo s) { return(s.OfficeCode == contractObj[0].ContractOfficeCode); }).Count == 0) { res.AddErrorMessage("Common", MessageUtil.MessageList.MSG0063, null, null); return(Json(res)); } //=========================================================================== CTS055_ScreenParameter session = InitialScreenSession_CTS055(); session.ScreenParameter.ContractCode = util.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); //return InitialScreenEnvironment("CTS054", session); return(InitialScreenEnvironment <CTS055_ScreenParameter>("CTS055", session, res)); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Update data to database when click [Confirm] button in ‘Action button’ section /// </summary> /// <param name="doCancalReason"></param> /// <returns></returns> public ActionResult CTS090_ConfirmRegisterCancelData(CTS090_doCancelReason doCancalReason) { ObjectResultData res = new ObjectResultData(); CTS090_RegisterCancelTargetData registerCancelData; List <tbt_SaleBasic> tbt_SaleBasicList; ISaleContractHandler saleHandler; IBillingTempHandler billingHandler; List <tbt_BillingTemp> tbt_BillingTempList; IQuotationHandler guotHandler; doUpdateQuotationData doUpdateQuotation; try { //CheckSystemStatus if (CheckIsSuspending(res) == true) { return(Json(res)); } //Check screen permission if (CheckUserPermission(ScreenID.C_SCREEN_ID_CANCEL_SALE_CONTRACT, FunctionID.C_FUNC_ID_OPERATE) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //ValidateScreenBusiness res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; if (doCancalReason.CancelDate > DateTime.Now.Date) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3154, null, new string[] { "dpCancelDate" }); return(Json(res)); } //ValidateDataBusiness res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; ValidateDataBusiness_CTS090(res); if (res.IsError) { return(Json(res)); } CTS090_ScreenParameter sParam = GetScreenObject <CTS090_ScreenParameter>(); using (TransactionScope scope = new TransactionScope()) { /*--- RegisterCancelContract ---*/ saleHandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; registerCancelData = sParam.CTS090_Session; if (registerCancelData.RegisterCancelData != null) { string strContractCode = registerCancelData.RegisterCancelData.ContractCode; string strOCCCode = registerCancelData.RegisterCancelData.OCC; string strQuotationTargetCode = registerCancelData.RegisterCancelData.QuotationTargetCode; string strAlphabet = registerCancelData.RegisterCancelData.Alphabet; //MapSaleContractData bool isUpdateQuotation = false; if (registerCancelData.RegisterCancelData.ChangeType == SaleChangeType.C_SALE_CHANGE_TYPE_NEW_SALE) { registerCancelData.RegisterCancelData.ContractStatus = ContractStatus.C_CONTRACT_STATUS_CANCEL; isUpdateQuotation = true; } registerCancelData.RegisterCancelData.OCC = registerCancelData.InitialData.OCCCode; registerCancelData.RegisterCancelData.ChangeType = SaleChangeType.C_SALE_CHANGE_TYPE_CANCEL; registerCancelData.RegisterCancelData.SaleProcessManageStatus = SaleProcessManageStatus.C_SALE_PROCESS_STATUS_CANCEL; registerCancelData.RegisterCancelData.ApproveNo1 = doCancalReason.ApproveNo1; registerCancelData.RegisterCancelData.CancelReasonType = doCancalReason.CancelReasonType; registerCancelData.RegisterCancelData.CancelDate = doCancalReason.CancelDate; registerCancelData.RegisterCancelData.CancelProcessDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; registerCancelData.RegisterCancelData.ChangeImplementDate = doCancalReason.CancelDate; //Save cancel contract data tbt_SaleBasicList = saleHandler.UpdateTbt_SaleBasic(registerCancelData.RegisterCancelData); //Delete billing temp billingHandler = ServiceContainer.GetService <IBillingTempHandler>() as IBillingTempHandler; tbt_BillingTempList = billingHandler.DeleteBillingTempByContractCodeOCC(strContractCode, strOCCCode); //Lock quotation guotHandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; bool isLockQuotComplete = guotHandler.LockQuotation(strQuotationTargetCode, strAlphabet, LockStyle.C_LOCK_STYLE_ALL); if (isUpdateQuotation) { //Update quotation data doUpdateQuotation = new doUpdateQuotationData(); doUpdateQuotation.QuotationTargetCode = strQuotationTargetCode; doUpdateQuotation.Alphabet = strAlphabet; doUpdateQuotation.LastUpdateDate = DateTime.MinValue; //null; doUpdateQuotation.ContractCode = strContractCode; doUpdateQuotation.ActionTypeCode = ActionType.C_ACTION_TYPE_CANCEL; int iUpdateQuotRowCount = guotHandler.UpdateQuotationData(doUpdateQuotation); } //Delete installation basic IInstallationHandler installHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; bool blnProcessResult = installHandler.DeleteInstallationBasicData(strContractCode); //Cancel book IInventoryHandler inventHandler = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; doBooking booking = new doBooking(); booking.ContractCode = registerCancelData.RegisterCancelData.ContractCode; bool isCancelBookComplete = inventHandler.CancelBooking(booking); } /*--------------------------*/ scope.Complete(); res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0046); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Validate register receiving returned instrument /// </summary> /// <param name="Con">Register condition object</param> /// <returns></returns> public ActionResult IVS030_cmdConfirm(IVS030ConfirmCond Con) { ObjectResultData res = new ObjectResultData(); try { IVS030_ScreenParameter prm = GetScreenObject <IVS030_ScreenParameter>(); if (prm.ElemInstrument == null) { prm.ElemInstrument = new List <IVS030INST>(); } IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; ICommonHandler ComH = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IInstallationHandler InstallH = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; //4.1 if (ComH.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_RECEIVE_RETURN, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //4.2 if (InvH.CheckStartedStockChecking() == 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4003); return(Json(res)); } prm.ApproveNo = Con.ApproveNo; prm.Memo = Con.Memo; //Check Memo if (!string.IsNullOrEmpty(prm.Memo) && prm.Memo.Replace(" ", "").Contains("\n\n\n\n")) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4022, null, new string[] { "Detmemo" }); return(Json(res)); } //4.3 //foreach (IVS030INST i in prm.ElemInstrument) //{ // //4.3.1 // if ((i.RemoveQty == null || i.RemoveQty <= 0) && (i.NotInstalledQty == null || i.NotInstalledQty <= 0)) // { // res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4127, null, null); // res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; // return Json(res); // } //} // 4.3.1 if (prm.ElemInstrument.Sum(q => q.RemoveQty) <= 0 && prm.ElemInstrument.Sum(q => q.NotInstalledQty) <= 0) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4127, null, null); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } //4.3.2 if (prm.SlipSelectType == IVS030_ScreenParameter.SlipType.InstallationSlip) { tbt_InstallationSlip doTbt_InstallationSlip = InstallH.GetTbt_InstallationSlipData(prm.SlipNo); if (doTbt_InstallationSlip.SlipStatus == SlipStatus.C_SLIP_STATUS_RETURNED) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4097, null, null); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } } else { List <tbt_InventorySlip> doTbt_InventorySlip = InvH.GetTbt_InventorySlip(prm.SlipNo); if (doTbt_InventorySlip.Count > 0 && doTbt_InventorySlip[0].SlipStatus == InventorySlipStatus.C_INV_SLIP_STATUS_COMPLETE) { res.AddErrorMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4097, null, null); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } } res.ResultData = prm.ElemInstrument; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Search data and send to show in grid search result /// </summary> /// <param name="searchCriteria"></param> /// <returns></returns> public ActionResult ISS080_SearchDataToGrid(doSearchInstallManageCriteria searchCriteria) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; CommonUtil comUtil = new CommonUtil(); string lang = CommonUtil.GetCurrentLanguage(); ISS080_RegisterStartResumeTargetData result = new ISS080_RegisterStartResumeTargetData(); try { searchCriteria.ContractCode = comUtil.ConvertContractCode(searchCriteria.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); searchCriteria.ProjectCode = comUtil.ConvertProjectCode(searchCriteria.ProjectCode, CommonUtil.CONVERT_TYPE.TO_LONG); if (searchCriteria.ContractCode == null && searchCriteria.IEStaffCode == null && searchCriteria.InstallationCompleteDateFrom == null && searchCriteria.InstallationCompleteDateTo == null && searchCriteria.InstallationFinishDateFrom == null && searchCriteria.InstallationFinishDateTo == null && searchCriteria.InstallationManagementStatus == null && searchCriteria.InstallationStartDateFrom == null && searchCriteria.InstallationStartDateTo == null && searchCriteria.InstallationType == null && searchCriteria.OperationOfficeCode == null && searchCriteria.ProjectCode == null && searchCriteria.ProposedInstallationCompleteDateFrom == null && searchCriteria.ProposedInstallationCompleteDateTo == null && searchCriteria.SiteAddress == null && searchCriteria.SiteName == null && searchCriteria.SubcontractorCode == null && searchCriteria.SubcontractorGroupName == null && searchCriteria.InstallationRequestDateFrom == null && //Add by Jutarat A. on 22102013 searchCriteria.InstallationRequestDateTo == null && //Add by Jutarat A. on 22102013 searchCriteria.ExpectedInstallationStartDateFrom == null && searchCriteria.ExpectedInstallationStartDateTo == null && searchCriteria.ExpectedInstallationFinishDateFrom == null && searchCriteria.ExpectedInstallationFinishDateTo == null ) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); return(Json(res)); } res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ///////////// START RETRIEVE DATA //////////////////////// IInstallationHandler iHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; List <doSearchInstallManagementResult> dtSearchResult = iHandler.SearchInstallationManagementList(searchCriteria); if (dtSearchResult == null) { //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); //return Json(res); } else { foreach (doSearchInstallManagementResult dtSearchData in dtSearchResult) { //================== Get Installation Type Name =================== if (!CommonUtil.IsNullOrEmpty(dtSearchData.InstallationType)) { List <doMiscTypeCode> miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = "RentalInstallationType", ValueCode = dtSearchData.InstallationType } }; ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> lst = hand.GetMiscTypeCodeList(miscs); if (lst.Count > 0) { dtSearchData.InstallationType = lst[0].ValueDisplay; } else { miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = "SaleInstallationType", ValueCode = dtSearchData.InstallationType } }; lst = hand.GetMiscTypeCodeList(miscs); if (lst.Count > 0) { dtSearchData.InstallationType = lst[0].ValueDisplay; } } } //======================================================= //================ Get management Status Name ============== dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", dtSearchData.InstallationManagementStatus); //========================================================== //=================== Convert Contract Code ======================== if (dtSearchData.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_PROJECT) { dtSearchData.ContractProjectCode = comUtil.ConvertProjectCode(dtSearchData.ContractProjectCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } else { dtSearchData.ContractProjectCode = comUtil.ConvertContractCode(dtSearchData.ContractProjectCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } //================================================================== if (lang == SECOM_AJIS.Common.Util.ConstantValue.CommonValue.DEFAULT_LANGUAGE_EN) { dtSearchData.IEStaffName1 = dtSearchData.IEStaffName1EN; dtSearchData.IEStaffName2 = dtSearchData.IEStaffName2EN; dtSearchData.SubcontractorName = dtSearchData.SubcontractorNameEN; dtSearchData.OperationOfficeName = dtSearchData.OperationOfficeNameEN; } else if (lang == SECOM_AJIS.Common.Util.ConstantValue.CommonValue.DEFAULT_LANGUAGE_JP) { dtSearchData.IEStaffName1 = dtSearchData.IEStaffName1EN; dtSearchData.IEStaffName2 = dtSearchData.IEStaffName2EN; dtSearchData.SubcontractorName = dtSearchData.SubcontractorNameEN; dtSearchData.OperationOfficeName = dtSearchData.OperationOfficeNameEN; } else if (lang == SECOM_AJIS.Common.Util.ConstantValue.CommonValue.DEFAULT_LANGUAGE_LC) { dtSearchData.IEStaffName1 = dtSearchData.IEStaffName1LC; dtSearchData.IEStaffName2 = dtSearchData.IEStaffName2LC; dtSearchData.SubcontractorName = dtSearchData.SubcontractorNameLC; dtSearchData.OperationOfficeName = dtSearchData.OperationOfficeNameLC; } } } result.doSearchData = dtSearchResult; if (dtSearchResult != null && dtSearchResult.Count > 0) { foreach (doSearchInstallManagementResult data in dtSearchResult) { string strInstallationStartDate = (CommonUtil.IsNullOrEmpty(data.InstallationStartDate) ? "-" : ((DateTime)data.InstallationStartDate).ToString("dd-MMM-yyyy")); string strInstallationFinishDate = (CommonUtil.IsNullOrEmpty(data.InstallationFinishDate) ? "-" : ((DateTime)data.InstallationFinishDate).ToString("dd-MMM-yyyy")); string strProposedInstallationCompleteDate = (CommonUtil.IsNullOrEmpty(data.ProposedInstallationCompleteDate) ? "-" : ((DateTime)data.ProposedInstallationCompleteDate).ToString("dd-MMM-yyyy")); string strActualInstallationCompleteDate = (CommonUtil.IsNullOrEmpty(data.ActualInstallationCompleteDate) ? "-" : ((DateTime)data.ActualInstallationCompleteDate).ToString("dd-MMM-yyyy")); string strInstallationRequestDate = (CommonUtil.IsNullOrEmpty(data.InstallationRequestDate) ? "-" : ((DateTime)data.InstallationRequestDate).ToString("dd-MMM-yyyy")); //Add by Jutarat A. on 22102013 if (CommonUtil.IsNullOrEmpty(data.ContractProjectCode)) { data.ContractProjectCode = "-"; } if (CommonUtil.IsNullOrEmpty(data.InstallationType)) { data.InstallationType = "-"; } if (CommonUtil.IsNullOrEmpty(data.IEStaffName1)) { data.IEStaffName1 = "-"; } if (CommonUtil.IsNullOrEmpty(data.IEStaffName2)) { data.IEStaffName2 = "-"; } if (CommonUtil.IsNullOrEmpty(data.SubcontractorName)) { data.SubcontractorName = "-"; } if (CommonUtil.IsNullOrEmpty(data.SubcontractorGroupName)) { data.SubcontractorGroupName = "-"; } if (CommonUtil.IsNullOrEmpty(data.SiteCode)) { data.SiteCode = "-"; } else { data.SiteCode = comUtil.ConvertSiteCode(data.SiteCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } if (CommonUtil.IsNullOrEmpty(data.SiteNameEN)) { data.SiteNameEN = "-"; } if (CommonUtil.IsNullOrEmpty(data.SiteNameLC)) { data.SiteNameLC = "-"; } if (CommonUtil.IsNullOrEmpty(data.OperationOfficeName)) { data.OperationOfficeName = "-"; } if (CommonUtil.IsNullOrEmpty(data.InstallationManagementStatus)) { data.InstallationManagementStatus = "-"; } data.ContractProjectCode = data.ContractProjectCode + "<br />" + data.InstallationType; data.IEStaffName = "(1) " + data.IEStaffName1 + "<br />" + "(2) " + data.IEStaffName2; data.Subcontractor = "(1) " + data.SubcontractorName + "<br />" + "(2) " + data.SubcontractorGroupName + "<br />" + "(3) " + data.NoOfSubcontractor; //data.IntsallationDate = "(1) " + strInstallationStartDate + "<br />" + // "(2) " + strInstallationFinishDate + // "<br />(3) " + strProposedInstallationCompleteDate + "<br />" + // "(4) " + strActualInstallationCompleteDate; data.IntsallationDate = "(1) " + strInstallationRequestDate + "<br />" + "(2) " + strProposedInstallationCompleteDate + "<br />" + "(3) " + data.ExpectInstallStartDate + "<br />" + "(4) " + data.ExpectInstallFinishDate + "<br />" + "(5) " + strInstallationStartDate + "<br />" + "(6) " + strInstallationFinishDate + "<br />" + "(7) " + strActualInstallationCompleteDate; //Modify (Add InstallationRequestDate) by Jutarat A. on 22102013 data.Site = "(1) " + data.SiteCode + "<br />" + "(2) " + data.SiteNameEN + "<br />" + "(3) " + data.SiteNameLC; data.OperationOffice = data.OperationOfficeName; } } //res.ResultData = result; res.ResultData = CommonUtil.ConvertToXml <doSearchInstallManagementResult>(dtSearchResult, "Installation\\ISS080_InstallManagementList", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Register receiving returned instrument /// </summary> /// <param name="Con">Register condition object</param> /// <returns></returns> public ActionResult IVS030_cmdConfirm_Cont(IVS030ConfirmCond Con) { ObjectResultData res = new ObjectResultData(); try { IVS030_ScreenParameter prm = GetScreenObject <IVS030_ScreenParameter>(); if (prm.ElemInstrument == null) { prm.ElemInstrument = new List <IVS030INST>(); } IInventoryHandler InvH = ServiceContainer.GetService <IInventoryHandler>() as IInventoryHandler; IInstallationHandler InstallH = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (comh.IsSystemSuspending()) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0049); return(Json(res)); } if (!CheckUserPermission(ScreenID.C_INV_SCREEN_ID_RECEIVE_RETURN, FunctionID.C_FUNC_ID_OPERATE)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0053); return(Json(res)); } //4.6 using (TransactionScope scope = new TransactionScope()) { List <tbt_InventorySlip> doTbt_InventorySlipForUpdate = null; //Comment by Jutarat A. on 11022013 (Move to check before 4.8.1) ////4.7.1 //if (!string.IsNullOrEmpty(prm.ContractCode) && prm.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE) //{ // //4.7.1.1 // bool blnProcessStatus = InstallH.ReceiveReturnInstrument(prm.SlipNo, prm.office.OfficeCode); // //4.7.1.2 // if (!blnProcessStatus) // { // //Rollback // return Json(res); // } // //4.7.1.3 // res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019); // return Json(res); //} //End Comment //4.7.1 if (!string.IsNullOrEmpty(prm.ContractCode)) { doTbt_InventorySlipForUpdate = InvH.GetTbt_InventorySlipForReceiveReturn(prm.SlipNo); } else { List <tbt_InventorySlip> doTbt_InventorySlip = InvH.GetTbt_InventorySlip(prm.SlipNo); doTbt_InventorySlipForUpdate = new List <tbt_InventorySlip>(); doTbt_InventorySlipForUpdate.AddRange(doTbt_InventorySlip); } if (doTbt_InventorySlipForUpdate == null) { doTbt_InventorySlipForUpdate = new List <tbt_InventorySlip>(); } //Add by Jutarat A. on 11022013 (Move to check before 4.8.1) //4.7.2 if (!string.IsNullOrEmpty(prm.ContractCode) && prm.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_SALE && (doTbt_InventorySlipForUpdate != null && doTbt_InventorySlipForUpdate.Count > 0 && doTbt_InventorySlipForUpdate[0].SourceLocationCode != InstrumentLocation.C_INV_LOC_WIP && doTbt_InventorySlipForUpdate[0].SourceLocationCode != InstrumentLocation.C_INV_LOC_PARTIAL_OUT)) { //4.7.2.1 bool blnProcessStatus = InstallH.ReceiveReturnInstrument(prm.SlipNo, prm.office.OfficeCode); //4.7.2.2 if (!blnProcessStatus) { //Rollback return(Json(res)); } //4.7.2.3 scope.Complete(); //Add by Jutarat A. on 11022013 (Commit) res.ResultData = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019); return(Json(res)); } //End Add //4.8.1 foreach (tbt_InventorySlip i in doTbt_InventorySlipForUpdate) { //4.8.2.1 if (i.DestinationLocationCode == InstrumentLocation.C_INV_LOC_ELIMINATION) { List <tbt_InventorySlip> lstUpdateSlip = InvH.GetTbt_InventorySlip(i.SlipNo); if (lstUpdateSlip.Count > 0) { lstUpdateSlip[0].SlipStatus = InventorySlipStatus.C_INV_SLIP_STATUS_COMPLETE; if (!string.IsNullOrEmpty(prm.Memo)) { lstUpdateSlip[0].Memo = prm.Memo; } if (!string.IsNullOrEmpty(prm.ApproveNo)) { lstUpdateSlip[0].ApproveNo = prm.ApproveNo; } lstUpdateSlip[0].StockInDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; //Comment by Jutarat A. on 30052013 (Set at UpdateTbt_InventorySlip()) //lstUpdateSlip[0].UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; //lstUpdateSlip[0].UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; //End Comment List <tbt_InventorySlip> doTbt_InventorySlip = InvH.UpdateTbt_InventorySlip(lstUpdateSlip); if (doTbt_InventorySlip == null || doTbt_InventorySlip.Count <= 0) { //Rollback return(Json(res)); } } } else { //4.8.2.2 bool blnProcessUpdate = InvH.RegisterReceiveInstrument(i.SlipNo, prm.Memo, prm.ApproveNo); if (!blnProcessUpdate) { //Rollback return(Json(res)); } } } string strSourceLocationCode = string.Empty; //4.9 foreach (tbt_InventorySlip i in doTbt_InventorySlipForUpdate) { //4.9.1 if (i.DestinationLocationCode == InstrumentLocation.C_INV_LOC_ELIMINATION) { continue; } //4.9.2 if (i.SourceLocationCode == InstrumentLocation.C_INV_LOC_UNOPERATED_WIP || i.SourceLocationCode == InstrumentLocation.C_INV_LOC_WIP || i.SourceLocationCode == InstrumentLocation.C_INV_LOC_PROJECT_WIP || i.SourceLocationCode == InstrumentLocation.C_INV_LOC_PARTIAL_OUT // New WIP concept @ 24-Feb-2015 ) { strSourceLocationCode = InstrumentLocation.C_INV_LOC_WAITING_RETURN; } else { strSourceLocationCode = InstrumentLocation.C_INV_LOC_RETURN_WIP; } //4.9.3 if (InvH.CheckNewInstrument(i.SlipNo) == 1) { //4.9.3.1 List <doGroupNewInstrument> doGroupNewInstrument = InvH.GetGroupNewInstrument(i.SlipNo); foreach (doGroupNewInstrument groupNewIns in doGroupNewInstrument) { //4.9.3.2 groupNewIns.SourceLocationCode = strSourceLocationCode; //4.9.3.3 #region Monthly Price @ 2015 //decimal decMovingAveragePrice = InvH.CalculateMovingAveragePrice(groupNewIns); var decMovingAveragePrice = InvH.GetMonthlyAveragePrice(groupNewIns.Instrumentcode, i.SlipIssueDate, InventoryAccountCode.C_INV_ACCOUNT_CODE_INPROCESS, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_LOCAL, SECOM_AJIS.Common.Util.ConstantValue.CurrencyUtil.C_CURRENCY_US); #endregion int? intReturnInprocess; // New WIP concept @ 24-Feb-2015 bool blnUpdate = InvH.UpdateAccountTransferNewInstrument(groupNewIns, Convert.ToDecimal(decMovingAveragePrice), out intReturnInprocess); // New WIP concept @ 24-Feb-2015 if (!blnUpdate) { //Rollback return(Json(res)); } #region // New WIP concept @ 24-Feb-2015 if ((intReturnInprocess ?? 0) > 0) { List <tbt_AccountInprocess> accountInProcessList = InvH.GetTbt_AccountInProcess( groupNewIns.SourceLocationCode , groupNewIns.ContractCode ?? groupNewIns.ProjectCode , groupNewIns.Instrumentcode ); tbt_AccountStockMoving accountStockMoving = new tbt_AccountStockMoving(); accountStockMoving.SlipNo = i.SlipNo; accountStockMoving.TransferTypeCode = i.TransferTypeCode; accountStockMoving.SourceAccountStockCode = InventoryAccountCode.C_INV_ACCOUNT_CODE_INPROCESS; accountStockMoving.DestinationAccountStockCode = InventoryAccountCode.C_INV_ACCOUNT_CODE_INSTOCK; accountStockMoving.SourceLocationCode = groupNewIns.SourceLocationCode; accountStockMoving.DestinationLocationCode = groupNewIns.DestinationLocationCode; accountStockMoving.InstrumentCode = groupNewIns.Instrumentcode; accountStockMoving.InstrumentQty = intReturnInprocess; if (accountInProcessList.Count != 0) { accountStockMoving.InstrumentPrice = accountInProcessList[0].MovingAveragePrice.Value; } accountStockMoving.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; accountStockMoving.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; accountStockMoving.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; accountStockMoving.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; List <tbt_AccountStockMoving> targetAccountStockMovingList = new List <tbt_AccountStockMoving>(); targetAccountStockMovingList.Add(accountStockMoving); List <tbt_AccountStockMoving> resultAccountStockMovingList = InvH.InsertAccountStockMoving(targetAccountStockMovingList); if (resultAccountStockMovingList.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_ACC_STOCK_MOVING }); } //end if/else } #endregion } } //4.9.4 if (InvH.CheckSecondhandInstrument(i.SlipNo) == 1) { //4.9.4.1 List <doGroupSecondhandInstrument> doGroupSecondhandInstrument = InvH.GetGroupSecondhandInstrument(i.SlipNo); //4.9.4.2 foreach (doGroupSecondhandInstrument doGroupSecond in doGroupSecondhandInstrument) { doGroupSecond.SourceLocationCode = strSourceLocationCode; bool blnUpdate = InvH.UpdateAccountTransferSecondhandInstrument(doGroupSecond); if (!blnUpdate) { //Rollback return(Json(res)); } } } //4.9.5 if (InvH.CheckSampleInstrument(i.SlipNo) == 1) { //4.9.5.1 List <doGroupSampleInstrument> doGroupSampleInstrument = InvH.GetGroupSampleInstrument(i.SlipNo); //4.9.5.2 foreach (doGroupSampleInstrument dogroupSample in doGroupSampleInstrument) { dogroupSample.SourceLocationCode = strSourceLocationCode; int? intReturnInprocess; // New WIP concept @ 24-Feb-2015 bool blnUpdate = InvH.UpdateAccountTransferSampleInstrument(dogroupSample, null, out intReturnInprocess); // New WIP concept @ 24-Feb-2015 if (!blnUpdate) { //Rollback return(Json(res)); } #region // New WIP concept @ 24-Feb-2015 if ((intReturnInprocess ?? 0) > 0) { tbt_AccountStockMoving accountStockMoving = new tbt_AccountStockMoving(); accountStockMoving.SlipNo = i.SlipNo; accountStockMoving.TransferTypeCode = i.TransferTypeCode; accountStockMoving.SourceAccountStockCode = InventoryAccountCode.C_INV_ACCOUNT_CODE_INPROCESS; accountStockMoving.DestinationAccountStockCode = InventoryAccountCode.C_INV_ACCOUNT_CODE_INSTOCK; accountStockMoving.SourceLocationCode = dogroupSample.SourceLocationCode; accountStockMoving.DestinationLocationCode = dogroupSample.DestinationLocationCode; accountStockMoving.InstrumentCode = dogroupSample.Instrumentcode; accountStockMoving.InstrumentQty = intReturnInprocess; accountStockMoving.InstrumentPrice = InventoryConfig.C_INV_DEFAULT_SAMPLE_AMOUNT; accountStockMoving.CreateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; accountStockMoving.CreateBy = CommonUtil.dsTransData.dtUserData.EmpNo; accountStockMoving.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; accountStockMoving.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; List <tbt_AccountStockMoving> targetAccountStockMovingList = new List <tbt_AccountStockMoving>(); targetAccountStockMovingList.Add(accountStockMoving); List <tbt_AccountStockMoving> resultAccountStockMovingList = InvH.InsertAccountStockMoving(targetAccountStockMovingList); if (resultAccountStockMovingList.Count <= 0) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0148, new string[] { TableName.C_TBL_NAME_INV_ACC_STOCK_MOVING }); } //end if/else } #endregion } } } //4.10 if (prm.SlipSelectType == IVS030_ScreenParameter.SlipType.InstallationSlip) { bool blnProcessStatus = InstallH.ReceiveReturnInstrument(prm.SlipNo, prm.office.OfficeCode); if (!blnProcessStatus) { //Rollback return(Json(res)); } } //Genereate Invenotry Slip Report var srvInvDoc = ServiceContainer.GetService <IInventoryDocumentHandler>() as IInventoryDocumentHandler; string invslipnolist = string.Join(",", doTbt_InventorySlipForUpdate.Select(d => d.SlipNo)); srvInvDoc.GenerateIVR210FilePath(invslipnolist, null, CommonUtil.dsTransData.dtUserData.EmpNo, CommonUtil.dsTransData.dtOperationData.ProcessDateTime); res.ResultData = new { SlipNo = prm.SlipNo, Message = MessageUtil.GetMessage(MessageUtil.MODULE_INVENTORY, MessageUtil.MessageList.MSG4019) }; scope.Complete(); } return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Search and get installation data list for view /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS180_SearchResult(doSearchInstallationCondition cond) { CMS180_ScreenParameter param = GetScreenObject <CMS180_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ObjectResultData res = new ObjectResultData(); List <dtInstallation> lst = new List <dtInstallation>(); try { IInstallationHandler handler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; // Concate string CustomerTypeCode with commar separate. like ,xx,yy,zz, List <string> lstManagementStatus = new List <string>(); lstManagementStatus.Add(cond.chkInstallationNotRegistered); lstManagementStatus.Add(cond.chkInstallationRequestedAndPoRegistered); lstManagementStatus.Add(cond.chkInstallationNotRequest); lstManagementStatus.Add(cond.chkInstallationUnderInstall); //Add by Jutarat A. on 27032014 lstManagementStatus.Add(cond.chkInstallationCompleted); lstManagementStatus.Add(cond.chkInstallationRequestButPoNotRegistered); lstManagementStatus.Add(cond.chkInstallationCancelled); cond.installationStatus = CommonUtil.CreateCSVString(lstManagementStatus); List <string> lstSlipStatus = new List <string>(); lstSlipStatus.Add(cond.chkNotStockOut); lstSlipStatus.Add(cond.chkNoNeedToStockOut); lstSlipStatus.Add(cond.chkReturned); lstSlipStatus.Add(cond.chkPartialStockOut); lstSlipStatus.Add(cond.chkInstallationSlipCanceled); lstSlipStatus.Add(cond.chkNoNeedToReturn); lstSlipStatus.Add(cond.chkStockOut); lstSlipStatus.Add(cond.chkWaitForReturn); lstSlipStatus.Add(cond.chkReplaced); cond.slipStatus = CommonUtil.CreateCSVString(lstSlipStatus); List <string> lstInstallationManagementStatus = new List <string>(); lstInstallationManagementStatus.Add(cond.chkProcessing); lstInstallationManagementStatus.Add(cond.chkApproved); lstInstallationManagementStatus.Add(cond.chkCompleted); lstInstallationManagementStatus.Add(cond.chkRequestApprove); lstInstallationManagementStatus.Add(cond.chkRejected); lstInstallationManagementStatus.Add(cond.chkCanceled); cond.managementStatus = CommonUtil.CreateCSVString(lstInstallationManagementStatus); cond.siteCode = cm.ConvertSiteCode(cond.siteCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.ViewFlag = false; cond.ContractCode = cm.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); List <string> ignoreList = new List <string>(); ignoreList.Add("chkInstallationNotRegistered"); ignoreList.Add("chkInstallationRequestedAndPoRegistered"); ignoreList.Add("chkInstallationNotRequest"); ignoreList.Add("chkInstallationUnderInstall"); //Add by Jutarat A. on 27032014 ignoreList.Add("chkInstallationCompleted"); ignoreList.Add("chkInstallationRequestButPoNotRegistered"); ignoreList.Add("chkInstallationCancelled"); ignoreList.Add("chkNotStockOut"); ignoreList.Add("chkNoNeedToStockOut"); ignoreList.Add("chkReturned"); ignoreList.Add("chkPartialStockOut"); ignoreList.Add("chkInstallationSlipCanceled"); ignoreList.Add("chkNoNeedToReturn"); ignoreList.Add("chkStockOut"); ignoreList.Add("chkWaitForReturn"); ignoreList.Add("chkReplaced"); ignoreList.Add("chkProcessing"); ignoreList.Add("chkApproved"); ignoreList.Add("chkCompleted"); ignoreList.Add("chkRequestApprove"); ignoreList.Add("chkRejected"); ignoreList.Add("chkCanceled"); ignoreList.Add("ViewFlag"); ignoreList.Add("slipNoNullFlag"); //================ Teerapong S. 24/09/2011 ================ ignoreList.Add("NotRegisteredYetSlipFlag"); ignoreList.Add("NotRegisteredYetManagementFlag"); //========================================================= res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; //=============== Teerapong S. 24/09/2011 ================== if ( (CommonUtil.IsNullOrEmpty(cond.chkInstallationNotRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationRequestedAndPoRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationNotRequest) && CommonUtil.IsNullOrEmpty(cond.chkInstallationCompleted) && CommonUtil.IsNullOrEmpty(cond.chkInstallationRequestButPoNotRegistered) && CommonUtil.IsNullOrEmpty(cond.chkInstallationCancelled)) && CommonUtil.IsNullOrEmpty(cond.chkInstallationUnderInstall) || //Add (chkInstallationUnderInstall) by Jutarat A. on 27032014) (CommonUtil.IsNullOrEmpty(cond.chkNotStockOut) && CommonUtil.IsNullOrEmpty(cond.chkNoNeedToStockOut) && CommonUtil.IsNullOrEmpty(cond.chkReturned) && CommonUtil.IsNullOrEmpty(cond.chkPartialStockOut) && CommonUtil.IsNullOrEmpty(cond.chkInstallationSlipCanceled) && CommonUtil.IsNullOrEmpty(cond.chkNoNeedToReturn) && CommonUtil.IsNullOrEmpty(cond.chkStockOut) && CommonUtil.IsNullOrEmpty(cond.chkWaitForReturn) && CommonUtil.IsNullOrEmpty(cond.chkReplaced) && CommonUtil.IsNullOrEmpty(cond.NotRegisteredYetSlipFlag)) || (CommonUtil.IsNullOrEmpty(cond.chkProcessing) && CommonUtil.IsNullOrEmpty(cond.chkApproved) && CommonUtil.IsNullOrEmpty(cond.chkCompleted) && CommonUtil.IsNullOrEmpty(cond.chkRequestApprove) && CommonUtil.IsNullOrEmpty(cond.chkRejected) && CommonUtil.IsNullOrEmpty(cond.chkCanceled) && CommonUtil.IsNullOrEmpty(cond.NotRegisteredYetManagementFlag))) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0158); return(Json(res)); } //========================================================= if (CommonUtil.IsNullAllField(cond, ignoreList.ToArray())) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); return(Json(res)); } if (cond.slipIssueDateFrom > cond.slipIssueDateTo) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090); return(Json(res)); } cond.InstallationBy = InstallationBy.C_INSTALLATION_BY_SECOM; lst = handler.GetInstallationDataListForView(cond); res.ResultData = CommonUtil.ConvertToXml <dtInstallation>(lst, "Common\\CMS180_ViewInstallationInfo", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
//public ActionResult ISR110_GetRptDeliveryConfirmData(string strSlipNo) //{ // strSlipNo = "401029201112043"; // IReportHandler reportHandler = ServiceContainer.GetService<IReportHandler>() as IReportHandler; // List<RPTDeliveryConfirmDo> rptList = reportHandler.GetRptDeliveryConfirmData(strSlipNo); // IDocumentHandler dochandler = ServiceContainer.GetService<IDocumentHandler>() as IDocumentHandler; // List<tbm_DocumentTemplate> dLst = dochandler.GetDocumentTemplateByDocumentCode(DocumentCode.C_DOCUMENT_CODE_DELIVERY_CONFIRMATION_AND_WARRANTY); // ReportDocument rptH = new ReportDocument(); // string path = ReportUtil.GetReportPath("Reports/ISR110_DeliveryConfirmData.rpt", Server.MapPath("/")); // rptH.Load(path); // List<RPTDeliveryConfirmDo> lst = new List<RPTDeliveryConfirmDo>(); // int i = 0; // foreach (RPTDeliveryConfirmDo rptDataRow in rptList) // { // lst.Add(rptDataRow); // if (dLst.Count > 0) // { // lst[i].DocumentNameEN = dLst[0].DocumentNameEN; // lst[i].DocumentVersion = dLst[0].DocumentVersion; // } // i++; // } // rptH.SetDataSource(lst); // rptH.Subreports["Page1"].SetDataSource(lst); // rptH.Subreports["Page2"].SetDataSource(lst); // Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); // rptH.Close(); // return File(stream, "application/pdf"); //} #endregion public ActionResult GenerateInstallationSlipDocBySlipNo() { ObjectResultData res = new ObjectResultData(); ICommonHandler comHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IInstallationDocumentHandler docHand = ServiceContainer.GetService <IInstallationDocumentHandler>() as IInstallationDocumentHandler; IInstallationHandler installHand = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; try { //using (TransactionScope scope = new TransactionScope()) //{ List <tbt_InstallationSlip> installList = installHand.GetTbt_InstallationSlip(null); List <tbt_DocumentList> documentList = comHandler.GetTbt_DocumentList(null, null, null); installList = (from t in installList where //( //t.SlipStatus == "01" //|| t.SlipStatus == "02" //|| t.SlipStatus == "03" //|| t.SlipStatus == "04" //|| t.SlipStatus == "06") //&& t.SlipIssueFlag == true //&& t.CreateDate >= new DateTime(2013,7,24,12,20,0) t.CreateBy == "INITIAL" && documentList.Any(d => (d.DocumentNo == t.SlipNo)) select t).ToList <tbt_InstallationSlip>(); foreach (tbt_InstallationSlip data in installList) { tbt_InstallationSlip dataSlip = installHand.GetTbt_InstallationSlipData(data.SlipNo); //if (dataSlip != null // && dataSlip.SlipStatus != SlipStatus.C_SLIP_STATUS_NO_NEED_TO_STOCK_OUT // && dataSlip.SlipStatus != SlipStatus.C_SLIP_STATUS_NOT_STOCK_OUT //Modify by Jutarat A. on 07022013 // && dataSlip.SlipStatus != SlipStatus.C_SLIP_STATUS_PARTIAL_STOCK_OUT //Add by Jutarat A. on 17062013 // && dataSlip.SlipStatus != SlipStatus.C_SLIP_STATUS_STOCK_OUT) //Add by Jutarat A. on 24062013 //{ // return Json(res); //} if (dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_NEW || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_CHANGEPLAN_NEW) { //6.1.1. Call InstallationDocumentHandler.CreateISR010 //Parameter doTbt_InstallationSlip.SlipNo //Return fsPDFFileISR010 docHand.CreateInstallationReport(dataSlip.SlipNo, DocumentCode.C_DOCUMENT_CODE_NEW_INSTALL_SLIP_RENTAL); } if (dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_CHANGE_WIRING || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_CHANGEPLAN_AFTER_NEW || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_MAINTENANCE_EXCHANGE || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_MOVE || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_PERIODICAL_MAINTENANCE || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_REMOVE_DURING_STOP_PARTIAL || dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_REMOVE_DURING_STOP_REMOVE_ALL || dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_CHANGE_WIRING || dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_MAINTENANCE_EXCHANGE || dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_MOVE || dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_PARTIAL_REMOVE ) { //6.2.1. Call InstallationDocumentHandler.CreateISR020 //Parameter doTbt_InstallationSlip.SlipNo //Return fsPDFFileISR020 docHand.CreateInstallationReport(dataSlip.SlipNo, DocumentCode.C_DOCUMENT_CODE_CHANGE_INSTALL_SLIP); } if (dataSlip.InstallationType == RentalInstallationType.C_RENTAL_INSTALL_TYPE_REMOVE_ALL || dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_REMOVE_ALL) { //6.3.1. Call InstallationDocumentHandler.CreateISR030 //Parameter doTbt_InstallationSlip.SlipNo //Return fsPDFFileISR030 docHand.CreateInstallationReport(dataSlip.SlipNo, DocumentCode.C_DOCUMENT_CODE_REMOVAL_INSTALL_SLIP); } if (dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_NEW || dataSlip.InstallationType == SaleInstallationType.C_SALE_INSTALL_TYPE_ADD) { //6.4.1. Call InstallationDocumentHandler.CreateISR040 //Parameter doTbt_InstallationSlip.SlipNo //Return fsPDFFileISR040 docHand.CreateInstallationReport(dataSlip.SlipNo, DocumentCode.C_DOCUMENT_CODE_NEW_INSTALL_SLIP_SALE); } if (dataSlip != null && dataSlip.SlipIssueFlag != FlagType.C_FLAG_ON) { dataSlip.SlipIssueFlag = FlagType.C_FLAG_ON; int updatedRpw = installHand.UpdateTbt_InstallationSlip(dataSlip); } } // scope.Complete(); // res.ResultData = "Process Complete."; //} res.ResultData = "Process Complete."; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// ISS080 retrieve data /// </summary> /// <param name="searchCriteria"></param> /// <returns></returns> public ActionResult ISS080_RetrieveData(doSearchInstallManageCriteria searchCriteria) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; CommonUtil comUtil = new CommonUtil(); string lang = CommonUtil.GetCurrentLanguage(); ISS080_RegisterStartResumeTargetData result = new ISS080_RegisterStartResumeTargetData(); try { searchCriteria.ContractCode = comUtil.ConvertContractCode(searchCriteria.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); searchCriteria.ProjectCode = comUtil.ConvertProjectCode(searchCriteria.ProjectCode, CommonUtil.CONVERT_TYPE.TO_LONG); if (searchCriteria.ContractCode == null && searchCriteria.IEStaffCode == null && searchCriteria.InstallationCompleteDateFrom == null && searchCriteria.InstallationCompleteDateTo == null && searchCriteria.InstallationFinishDateFrom == null && searchCriteria.InstallationFinishDateTo == null && searchCriteria.InstallationManagementStatus == null && searchCriteria.InstallationStartDateFrom == null && searchCriteria.InstallationStartDateTo == null && searchCriteria.InstallationType == null && searchCriteria.OperationOfficeCode == null && searchCriteria.ProjectCode == null && searchCriteria.ProposedInstallationCompleteDateFrom == null && searchCriteria.ProposedInstallationCompleteDateTo == null && searchCriteria.SiteAddress == null && searchCriteria.SiteName == null && searchCriteria.SubcontractorCode == null && searchCriteria.SubcontractorGroupName == null && searchCriteria.InstallationRequestDateFrom == null && //Add by Jutarat A. on 22102013 searchCriteria.InstallationRequestDateTo == null //Add by Jutarat A. on 22102013 ) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0006); return(Json(res)); } res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ///////////// START RETRIEVE DATA //////////////////////// IInstallationHandler iHandler = ServiceContainer.GetService <IInstallationHandler>() as IInstallationHandler; List <doSearchInstallManagementResult> dtSearchResult = iHandler.SearchInstallationManagementList(searchCriteria); if (dtSearchResult == null) { //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); //return Json(res); } else { foreach (doSearchInstallManagementResult dtSearchData in dtSearchResult) { //================== Get Installation Type Name =================== if (!CommonUtil.IsNullOrEmpty(dtSearchData.InstallationType)) { List <doMiscTypeCode> miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = "RentalInstallationType", ValueCode = dtSearchData.InstallationType } }; ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> lst = hand.GetMiscTypeCodeList(miscs); if (lst.Count > 0) { dtSearchData.InstallationType = lst[0].ValueDisplay; } else { miscs = new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = "SaleInstallationType", ValueCode = dtSearchData.InstallationType } }; lst = hand.GetMiscTypeCodeList(miscs); if (lst.Count > 0) { dtSearchData.InstallationType = lst[0].ValueDisplay; } } } //======================================================= //================ Get management Status Name ============== if (dtSearchData.InstallationManagementStatus == InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_PROCESSING) { dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_PROCESSING);//"Processing"; } else if (dtSearchData.InstallationManagementStatus == InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_REQUEST_APPROVE) { dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_REQUEST_APPROVE);//"Request approve"; } else if (dtSearchData.InstallationManagementStatus == InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_APPROVED) { dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_APPROVED);//"Approved"; } else if (dtSearchData.InstallationManagementStatus == InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_REJECTED) { dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_REJECTED);//"Rejected"; } else if (dtSearchData.InstallationManagementStatus == InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_COMPLETED) { dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_COMPLETED);//"Completed"; } else if (dtSearchData.InstallationManagementStatus == InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_CANCELED) { dtSearchData.InstallationManagementStatus = ISS080_GetMiscDisplayByValueCode("InstallationManagementStatus", InstallationManagementStatus.C_INSTALL_MANAGE_STATUS_CANCELED);//"Canceled"; } //========================================================== //=================== Convert Contract Code ======================== if (dtSearchData.ServiceTypeCode == ServiceType.C_SERVICE_TYPE_PROJECT) { dtSearchData.ContractProjectCode = comUtil.ConvertProjectCode(dtSearchData.ContractProjectCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } else { dtSearchData.ContractProjectCode = comUtil.ConvertContractCode(dtSearchData.ContractProjectCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } //================================================================== if (lang == SECOM_AJIS.Common.Util.ConstantValue.CommonValue.DEFAULT_LANGUAGE_EN) { dtSearchData.IEStaffName1 = dtSearchData.IEStaffName1EN; dtSearchData.IEStaffName2 = dtSearchData.IEStaffName2EN; dtSearchData.SubcontractorName = dtSearchData.SubcontractorNameEN; dtSearchData.OperationOfficeName = dtSearchData.OperationOfficeNameEN; } else if (lang == SECOM_AJIS.Common.Util.ConstantValue.CommonValue.DEFAULT_LANGUAGE_JP) { dtSearchData.IEStaffName1 = dtSearchData.IEStaffName1EN; dtSearchData.IEStaffName2 = dtSearchData.IEStaffName2EN; dtSearchData.SubcontractorName = dtSearchData.SubcontractorNameEN; dtSearchData.OperationOfficeName = dtSearchData.OperationOfficeNameEN; } else if (lang == SECOM_AJIS.Common.Util.ConstantValue.CommonValue.DEFAULT_LANGUAGE_LC) { dtSearchData.IEStaffName1 = dtSearchData.IEStaffName1LC; dtSearchData.IEStaffName2 = dtSearchData.IEStaffName2LC; dtSearchData.SubcontractorName = dtSearchData.SubcontractorNameLC; dtSearchData.OperationOfficeName = dtSearchData.OperationOfficeNameLC; } } } result.doSearchData = dtSearchResult; res.ResultData = result; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }