/// <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> /// Get View Billing Target Data ForSearch /// </summary> /// <param name="cond">Billing target data for search</param> /// <returns></returns> public List <dtBillingTargetData> GetViewBillingTargetDataForSearch(doBillingTargetDataSearchCondition cond) { try { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <dtBillingTargetData> lst = base.GetViewBillingTargetDataForSearch( cond.CMS470_BillingClientCode, cond.CMS470_BillingOffice, cond.CMS470_BillingClientName, cond.CMS470_CustomerTypeCode, cond.CMS470_CompanyTypeCode, cond.CMS470_RegionCode, cond.CMS470_BusinessTypeCode, cond.CMS470_Address, cond.CMS470_TelephoneNo ); // Misc Mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(lst.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); CommonUtil.MappingObjectLanguage <dtBillingTargetData>(lst); return(lst); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get project purchaser data /// </summary> /// <param name="strProjectCode"></param> /// <returns></returns> public ActionResult CTS260_GetProjectPurchaser(string strProjectCode) { IProjectHandler projh = ServiceContainer.GetService <IProjectHandler>() as IProjectHandler; List <dtTbt_ProjectPurchaserCustomerForView> lstPurchaser = new List <dtTbt_ProjectPurchaserCustomerForView>(); lstPurchaser = projh.GetTbt_ProjectPurchaserCustomerForView(strProjectCode); if (lstPurchaser.Count > 0) { if (!CommonUtil.IsNullOrEmpty(lstPurchaser[0].CustCode)) { ICustomerMasterHandler icustMast = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler; List <doCustomer> lstCust = icustMast.GetCustomer(lstPurchaser[0].CustCode); lstPurchaser = CommonUtil.ClonsObjectList <doCustomer, dtTbt_ProjectPurchaserCustomerForView>(lstCust); } } EmployeeMappingList emlst = new EmployeeMappingList(); emlst.AddEmployee(lstPurchaser.ToArray()); IEmployeeMasterHandler Emph = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; Emph.EmployeeListMapping(emlst); CommonUtil.MappingObjectLanguage <dtTbt_ProjectPurchaserCustomerForView>(lstPurchaser); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(lstPurchaser.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); return(Json(lstPurchaser)); }
/// <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> /// Get project data for view /// </summary> /// <param name="strProjectCode"></param> /// <returns></returns> public ActionResult CTS260_GetProjectForView(string strProjectCode) { ObjectResultData res = new ObjectResultData(); if (CommonUtil.IsNullOrEmpty(strProjectCode)) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, "CTS260", MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "lblProjectCode" }, new string[] { "ProjectCode" }); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } IProjectHandler Projh = ServiceContainer.GetService <IProjectHandler>() as IProjectHandler; List <doTbt_Project> lstProject = Projh.GetTbt_ProjectForView(strProjectCode); if (lstProject.Count <= 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0091, new string[] { strProjectCode }, new string[] { "ProjectCode" }); return(Json(res)); } else { //CommonUtil.dsTransData.dtCommonSearch.ProjectCode = strProjectCode; CommonUtil comUtil = new CommonUtil(); //CommonUtil.dsTransData.dtCommonSearch.ProjectCode = comUtil.ConvertProjectCode(lstProject[0].ProjectCode,CommonUtil.CONVERT_TYPE.TO_SHORT); //CommonUtil.dsTransData.dtCommonSearch.ContractCode = null; CTS260_ScreenParameter param = GetScreenObject <CTS260_ScreenParameter>(); param.CommonSearch = new ScreenParameter.CommonSearchDo() { ProjectCode = comUtil.ConvertProjectCode(lstProject[0].ProjectCode, CommonUtil.CONVERT_TYPE.TO_SHORT) }; } EmployeeMappingList emlst = new EmployeeMappingList(); emlst.AddEmployee(lstProject.ToArray()); IEmployeeMasterHandler Emph = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; Emph.EmployeeListMapping(emlst); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(lstProject.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); return(Json(lstProject)); }
public void CreateAddressFull(doCustomer cust) { try { if (cust == null) { return; } ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; doCustomerAddress custAddress = new doCustomerAddress(); MiscTypeMappingList miscLst = new MiscTypeMappingList(); miscLst.AddMiscType(custAddress); chandler.MiscTypeMappingList(miscLst); #region EN string[] addrEN = new string[] { cust.AddressEN, CommonUtil.TextWithPrefixSuffix(cust.AlleyEN, custAddress.AlleyPrefixEN, custAddress.AlleySuffixEN), CommonUtil.TextWithPrefixSuffix(cust.RoadEN, custAddress.RoadPrefixEN, custAddress.RoadSuffixEN), CommonUtil.TextWithPrefixSuffix(cust.SubDistrictEN, custAddress.SubDistrictPrefixEN, custAddress.SubDistrictSuffixEN), CommonUtil.TextWithPrefixSuffix(cust.DistrictNameEN, custAddress.DistrictPrefixEN, custAddress.DistrictSuffixEN), CommonUtil.TextWithPrefixSuffix(cust.ProvinceNameEN, custAddress.ProvincePrefixEN, custAddress.ProvinceSuffixEN), cust.ZipCode }; cust.AddressFullEN = CommonUtil.TextList(addrEN, " "); #endregion #region LC string[] addrLC = new string[] { cust.AddressLC, CommonUtil.TextWithPrefixSuffix(cust.AlleyLC, custAddress.AlleyPrefixLC, custAddress.AlleySuffixLC), CommonUtil.TextWithPrefixSuffix(cust.RoadLC, custAddress.RoadPrefixLC, custAddress.RoadSuffixLC), CommonUtil.TextWithPrefixSuffix(cust.SubDistrictLC, custAddress.SubDistrictPrefixLC, custAddress.SubDistrictSuffixLC), CommonUtil.TextWithPrefixSuffix(cust.DistrictNameLC, custAddress.DistrictPrefixLC, custAddress.DistrictSuffixLC), CommonUtil.TextWithPrefixSuffix(cust.ProvinceNameLC, custAddress.ProvincePrefixLC, custAddress.ProvinceSuffixLC), cust.ZipCode }; cust.AddressFullLC = CommonUtil.TextList(addrLC, " "); #endregion } catch (Exception) { throw; } }
/// <summary> /// Validate user input. /// </summary> /// <returns></returns> public ActionResult MAS030_ValidateData() { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { doBillingClient custDo = null; MAS030_ScreenParameter custData = GetScreenObject <MAS030_ScreenParameter>(); if (custData != null) { if (custData.InputData != null) { custDo = custData.InputData; } } if (custDo != null) { //IMasterHandler mhandler = ServiceContainer.GetService<IMasterHandler>() as IMasterHandler; ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; #region Set Misc Data MiscTypeMappingList miscList = new MiscTypeMappingList(); miscList.AddMiscType(custDo); chandler.MiscTypeMappingList(miscList); #endregion } MAS030_ValidateCombo validate = CommonUtil.CloneObject <doBillingClient, MAS030_ValidateCombo>(custDo); ValidatorUtil.BuildErrorMessage(res, new object[] { validate }); if (custDo != null) { if (custDo.ValidateBillingClient == true) { MAS030_CheckReqField vq = CommonUtil.CloneObject <doBillingClient, MAS030_CheckReqField>(custDo); ValidatorUtil.BuildErrorMessage(res, new object[] { vq }); } } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Search AR by criteria when click [Search] button on AR list by role section /// </summary> /// <param name="condition"></param> /// <returns></returns> public ActionResult CTS360_SearchAR(SearchARCondition condition) { ObjectResultData res = new ObjectResultData(); try { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; ValidatorUtil.BuildErrorMessage(res, this, new object[] { condition }); if (condition.SpecfyPeriod == null && (condition.SpecifyPeriodFrom.HasValue || condition.SpecifyPeriodTo.HasValue)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0116, null, new string[] { "cboSearchSpecifyPeriod" }); } if (condition.SpecfyPeriod != null && condition.SpecifyPeriodFrom.HasValue && condition.SpecifyPeriodTo.HasValue && condition.SpecifyPeriodFrom.Value.CompareTo(condition.SpecifyPeriodTo.Value) > 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090, null, new string[] { "dateSearchPeriodFrom", "dateSearchPeriodTo" }); } if (res.IsError) { return(Json(res)); } CommonUtil c = new CommonUtil(); condition.ContractCode = c.ConvertContractCode(condition.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); condition.QuotationTargetCode = c.ConvertQuotationTargetCode(condition.QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); IARHandler hand = ServiceContainer.GetService <IARHandler>() as IARHandler; List <dtARList> list = hand.SearchARList(condition); CommonUtil.MappingObjectLanguage <dtARList>(list); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(list.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); foreach (var ar in list) { setColStyle(ar); } string xml = CommonUtil.ConvertToXml <dtARList>(list, "Contract\\CTS360", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public override /// <summary> /// Get BillingBasic data for view /// </summary> /// <param name="strContractCode"></param> /// <param name="strBillingOCC"></param> /// <param name="strBillingClientCode"></param> /// <param name="strBillingTargetCode"></param> /// <param name="strBillingCilentname"></param> /// <param name="strAddress"></param> /// <returns></returns> List <dtViewBillingBasic> GetViewBillingBasic(string strContractCode, string strBillingOCC, string strBillingClientCode, string strBillingTargetCode, string strBillingCilentname, string strAddress) { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <dtViewBillingBasic> result = base.GetViewBillingBasic(strContractCode, strBillingOCC, strBillingClientCode, strBillingTargetCode, strBillingCilentname, strAddress); // Misc Mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(result.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); CommonUtil.MappingObjectLanguage <dtViewBillingBasic>(result); return(result); }
public ActionResult CMS421() { ObjectResultData res = new ObjectResultData(); try { CMS421_ScreenParameter param = GetScreenObject <CMS421_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <dtTbt_AutoTransferBankAccountForView> listAutoTransferBankAccountData = handler.GetTbt_AutoTransferBankAccountForView(strContractCode, param.BillingOCC); ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (listAutoTransferBankAccountData.Count > 0) { //Misc mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(listAutoTransferBankAccountData.ToArray <dtTbt_AutoTransferBankAccountForView>()); handlerCommon.MiscTypeMappingList(miscMapping); } if (listAutoTransferBankAccountData.Count > 0) { ViewBag.txtBillingCode = listAutoTransferBankAccountData[0].BillingCode_Short; ViewBag.txtBillingClientCode = listAutoTransferBankAccountData[0].BillingClientCode_Short; ViewBag.txtBillingClientNameEN = listAutoTransferBankAccountData[0].FullNameEN; ViewBag.txtBillingClientNameLC = listAutoTransferBankAccountData[0].FullNameLC; ViewBag.txtAutoTransferAccountName = listAutoTransferBankAccountData[0].AccountName; ViewBag.txtBankBranch = listAutoTransferBankAccountData[0].BankNameEN + "/" + listAutoTransferBankAccountData[0].BankBranchNameEN; ViewBag.txtAccountType = listAutoTransferBankAccountData[0].AccountTypeName; ViewBag.txtAccountNo = listAutoTransferBankAccountData[0].AccountNo_ForView; // Edit by Narupon W. 28/05/2012 ViewBag.txtAutoTransferDate = listAutoTransferBankAccountData[0].AutoTransferDate; ViewBag.txtLastAutoTransferResult = listAutoTransferBankAccountData[0].LastestResultName; } return(View()); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Search AR by role when change mode to "Requester List Mode", "Approver List Mode", or "Auditor List Mode" /// </summary> /// <param name="condition"></param> /// <returns></returns> public ActionResult CTS360_ARListByRole(doSearchARListByRole condition) { ObjectResultData res = new ObjectResultData(); try { if (condition.ARSpecifyPeriod == null && (condition.ARSpecifyPeriodFrom.HasValue || condition.ARSpecifyPeriodTo.HasValue)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0116, null, new string[] { "cboARSpecifyPeriod" }); } if (condition.ARSpecifyPeriod != null && condition.ARSpecifyPeriodFrom != null && condition.ARSpecifyPeriodTo != null && condition.ARSpecifyPeriodFrom.Value.CompareTo(condition.ARSpecifyPeriodTo.Value) > 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0090, null, new string[] { "dateByRoldPeriodFrom", "dateByRolePeriodTo" }); } if (res.IsError) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } IARHandler hand = ServiceContainer.GetService <IARHandler>() as IARHandler; List <dtARList> list = hand.GetARListByRole(condition); CommonUtil.MappingObjectLanguage <dtARList>(list); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(list.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); foreach (var ar in list) { setColStyle(ar); } string xml = CommonUtil.ConvertToXml <dtARList>(list, "Contract\\CTS360", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Get all tables of project for view /// </summary> /// <param name="strProjectCode"></param> /// <returns></returns> public List <doTbt_Project> GetTbt_ProjectForView(string strProjectCode) { List <tbt_Project> lstTbt_Project = base.GetTbt_ProjectForViewSQL(strProjectCode); List <doTbt_Project> doTbt_Project = CommonUtil.ClonsObjectList <tbt_Project, doTbt_Project>(lstTbt_Project); EmployeeMappingList emlst = new EmployeeMappingList(); emlst.AddEmployee(doTbt_Project.ToArray()); IEmployeeMasterHandler Emph = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; Emph.EmployeeListMapping(emlst); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(doTbt_Project.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); return(doTbt_Project); }
public List <doSubcontractor> GetSubcontractor(string SubcontractorCode, string CoCompanyCode, string InstallationTeam, string SubcontractorName) { try { List <doSubcontractor> result = base.GetSubcontractor(SubcontractorCode, CoCompanyCode, InstallationTeam, SubcontractorName); // Misc Mapping ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(result.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); return(result); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get billing detail list by target code /// </summary> /// <param name="billingTargetCode">Billing target code</param> /// <returns></returns> public override List <dtViewBillingDetailList> GetViewBillingDetailListByTargetCode(string billingTargetCode) { try { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <dtViewBillingDetailList> result = base.GetViewBillingDetailListByTargetCode(billingTargetCode); // Misc Mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(result.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); CommonUtil.MappingObjectLanguage <dtViewBillingDetailList>(result); return(result); } catch (Exception ex) { throw ex; } }
public override List <dtViewDepositDetailInformation> GetViewDepositDetailInformation(string contractCode, string billingOCC) { try { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <dtViewDepositDetailInformation> result = base.GetViewDepositDetailInformation(contractCode, billingOCC); // Misc Mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(result.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); CommonUtil.MappingObjectLanguage <dtViewDepositDetailInformation>(result); return(result); } catch (Exception ex) { throw ex; } }
/// <summary> /// Get billing detail list of last invoice OCC /// </summary> /// <param name="invoiceNo">Invoice no</param> /// <param name="billingClientCode">Billing client code</param> /// <param name="billingTargetCode">Billing target code</param> /// <param name="billingCilentname">Billing client name</param> /// <param name="address">Address</param> /// <returns></returns> public override List <dtViewBillingDetailListOfLastInvoiceOCC> GetViewBillingDetailListOfLastInvoiceOCC(string invoiceNo, string billingClientCode, string billingTargetCode, string billingCilentname, string address) { try { List <dtViewBillingDetailListOfLastInvoiceOCC> result = base.GetViewBillingDetailListOfLastInvoiceOCC(invoiceNo, billingClientCode, billingTargetCode, billingCilentname, address); // Misc Mapping ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(result.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); CommonUtil.MappingObjectLanguage <dtViewBillingDetailListOfLastInvoiceOCC>(result); return(result); } catch (Exception ex) { throw ex; } }
/// <summary> /// Validate customer data /// </summary> /// <param name="cust"></param> /// <param name="isFullValidate"></param> public void ValidateCustomerData(doCustomer cust, bool isFullValidate = false) { IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; doCompanyType cType = null; cust.ValidateCustomerData = true; try { #region Set Misc Data MiscTypeMappingList miscList = new MiscTypeMappingList(); miscList.AddMiscType(cust); chandler.MiscTypeMappingList(miscList); #endregion #region Company Type List <doCompanyType> clst = mhandler.GetCompanyType(cust.CompanyTypeCode); if (clst.Count > 0) { cType = clst[0]; cust.CompanyTypeName = clst[0].CompanyTypeName; } #endregion #region Nationality Data if (CommonUtil.IsNullOrEmpty(cust.RegionCode) == false) { List <tbm_Region> nlst = mhandler.GetTbm_Region(); if (nlst.Count > 0) { foreach (tbm_Region r in nlst) { if (cust.RegionCode == r.RegionCode) { cust.Nationality = r.Nationality; break; } } } } #endregion #region BusinessType Data if (CommonUtil.IsNullOrEmpty(cust.BusinessTypeCode) == false) { List <tbm_BusinessType> blst = mhandler.GetTbm_BusinessType(); if (blst.Count > 0) { foreach (tbm_BusinessType b in blst) { if (cust.BusinessTypeCode == b.BusinessTypeCode) { cust.BusinessTypeName = b.BusinessTypeName; break; } } } } #endregion #region Province Data if (CommonUtil.IsNullOrEmpty(cust.ProvinceCode) == false) { List <tbm_Province> plst = mhandler.GetTbm_Province(); if (plst.Count > 0) { foreach (tbm_Province pv in plst) { if (cust.ProvinceCode == pv.ProvinceCode) { cust.ProvinceNameEN = pv.ProvinceNameEN; cust.ProvinceNameLC = pv.ProvinceNameLC; break; } } } } #endregion #region District if (CommonUtil.IsNullOrEmpty(cust.DistrictCode) == false) { List <tbm_District> dlst = mhandler.GetTbm_District(cust.ProvinceCode); if (dlst.Count > 0) { foreach (tbm_District d in dlst) { if (cust.ProvinceCode == d.ProvinceCode && cust.DistrictCode == d.DistrictCode) { cust.DistrictNameEN = d.DistrictNameEN; cust.DistrictNameLC = d.DistrictNameLC; break; } } } } #endregion if (CommonUtil.IsNullOrEmpty(cust.CustTypeName) || cust.CustTypeCode != CustomerType.C_CUST_TYPE_JURISTIC) { cust.CompanyTypeName = null; } if (CommonUtil.IsNullOrEmpty(cust.CompanyTypeName) || cust.CompanyTypeCode != CompanyType.C_COMPANY_TYPE_PUBLIC_CO_LTD) { cust.FinancialMaketTypeName = null; } if (CommonUtil.IsNullOrEmpty(cust.CustCode)) { if (isFullValidate) { ApplicationErrorException.CheckMandatoryField <doCustomer, ValidateCustomer_Full>(cust); } else if (CommonUtil.IsNullOrEmpty(cust.CustCode) == true) { ApplicationErrorException.CheckMandatoryField <doCustomer, ValidateCustomer_CodeNull>(cust); } else { ApplicationErrorException.CheckMandatoryField <doCustomer, ValidateCustomer>(cust); } } } catch { cust.ValidateCustomerData = false; } try { if (cType == null) { cType = new doCompanyType(); } cust.CustFullNameEN = CommonUtil.TextList(new string[] { cType.CustNamePrefixEN, cust.CustNameEN, cType.CustNameSuffixEN }, " "); cust.CustFullNameLC = CommonUtil.TextList(new string[] { cType.CustNamePrefixLC, cust.CustNameLC, cType.CustNameSuffixLC }, " "); mhandler.CreateAddressFull(cust); } catch (Exception) { throw; } }
/// <summary> /// Get searach result of document data /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CMS030_SearchResponse(doDocumentDataCondition cond) { CommonUtil c = new CommonUtil(); ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; List <dtDocumentData> list = new List <dtDocumentData>(); //List<dtDocumentData> vw_list = new List<dtDocumentData>(); try { cond.QuotationTargetCode = c.ConvertQuotationTargetCode(cond.QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); //cond.ProjectCode = c.ConvertProjectCode(cond.ProjectCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.ContractCode = c.ConvertContractCode(cond.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); cond.BillingTargetCode = c.ConvertBillingTargetCode(cond.BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_CONTRACT) { cond.DocumentNo = ConvertDocumentNo(cond.DocumentNo, CommonUtil.CONVERT_TYPE.TO_LONG.ToString()); } if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_INCOME) { if (cond.DocumentCode == "BLR060") { List <string> fieldName = new List <string>(); List <string> controlName = new List <string>(); List <string> realFieldName = new List <string>(); if (CommonUtil.IsNullOrEmpty(cond.GenerateDateFrom)) { fieldName.Add("lblGenerateDate"); controlName.Add("GenerateDateFrom"); } if (CommonUtil.IsNullOrEmpty(cond.GenerateDateTo)) { fieldName.Add("lblGenerateDate"); controlName.Add("GenerateDateTo"); } foreach (var rawFieldName in fieldName.Distinct()) { realFieldName.Add(CommonUtil.GetLabelFromResource(MessageUtil.MODULE_COMMON, "CMS030", rawFieldName)); } if ((realFieldName.Count > 0) || (controlName.Count > 0)) { if ((realFieldName.Count > 0) && (controlName.Count > 0)) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, realFieldName.ToArray(), controlName.ToArray()); } res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; return(Json(res)); } } } if (cond.DocumentType == null || cond.DocumentCode == null) { //res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0098); } else { ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IDocumentHandler handler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler; list = handler.GetDocumentDataList(cond); //vw_list = CommonUtil.ConvertObjectbyLanguage<dtDocumentData, dtDocumentData>(list, // "ConOfficeCodeName", // "OperOfficeCodeName", // "BillOfficeCodeName", // "IssueOfficeCodeName", // "DocumentName" // ); // Misc Mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(list.ToArray()); handlerCommon.MiscTypeMappingList(miscMapping); // Language Mapping CommonUtil.MappingObjectLanguage <dtDocumentData>(list); if (cond.DocumentType == DocumentType.C_DOCUMENT_TYPE_CONTRACT) { foreach (var item in list) { item.DocumentNo = ConvertDocumentNo(item.DocumentNo, CommonUtil.CONVERT_TYPE.TO_SHORT.ToString()); } } } } catch (Exception ex) { list = new List <dtDocumentData>(); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); } if (cond.Mode == 0) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 1) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode1", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 2) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode2", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 3) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode3", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 4) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode4", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 5) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode5", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 6) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode6", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 7) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode7_CMR020", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 8) { res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(list, "Common\\CMS030_Mode8", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } else if (cond.Mode == 9) { IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; var datas = billingHandler.GetRptInvoiceIssueList(cond.GenerateDateFrom, cond.GenerateDateTo); List <dtDocumentData> ls = new List <dtDocumentData>(); if (datas != null && datas.Count > 0) { ls.Add(new dtDocumentData() { GenerateDateFrom = cond.GenerateDateFrom, GenerateDateTo = cond.GenerateDateTo }); } res.ResultData = CommonUtil.ConvertToXml <dtDocumentData>(ls, "Common\\CMS030_Mode9", CommonUtil.GRID_EMPTY_TYPE.SEARCH); } return(Json(res)); }
/// <summary> /// Validate customer data.<br /> /// - Set company type.<br /> /// - Set nationality.<br /> /// - Set business type.<br /> /// - Set province.<br /> /// - Set district.<br /> /// - Check require field. /// </summary> /// <returns></returns> public ActionResult MAS050_ValidateData() { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; try { doCustomer custDo = null; MAS050_ScreenParameter custData = GetScreenObject <MAS050_ScreenParameter>(); if (custData != null) { if (custData.doCustomer != null) { custDo = custData.doCustomer; } } if (custDo != null) { IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; #region Set Misc Data MiscTypeMappingList miscList = new MiscTypeMappingList(); miscList.AddMiscType(custDo); chandler.MiscTypeMappingList(miscList); #endregion #region Company Type if (CommonUtil.IsNullOrEmpty(custDo.CompanyTypeCode) == false) { List <doCompanyType> clst = mhandler.GetCompanyType(custDo.CompanyTypeCode); if (clst.Count > 0) { custDo.CompanyTypeName = clst[0].CompanyTypeName; } } #endregion #region Nationality Data if (CommonUtil.IsNullOrEmpty(custDo.RegionCode) == false) { List <tbm_Region> nlst = mhandler.GetTbm_Region(); if (nlst.Count > 0) { foreach (tbm_Region r in nlst) { if (custDo.RegionCode == r.RegionCode) { custDo.Nationality = r.Nationality; break; } } } } #endregion #region BusinessType Data if (CommonUtil.IsNullOrEmpty(custDo.BusinessTypeCode) == false) { List <tbm_BusinessType> blst = mhandler.GetTbm_BusinessType(); if (blst.Count > 0) { foreach (tbm_BusinessType b in blst) { if (custDo.BusinessTypeCode == b.BusinessTypeCode) { custDo.BusinessTypeName = b.BusinessTypeName; break; } } } } #endregion #region Province Data if (CommonUtil.IsNullOrEmpty(custDo.ProvinceCode) == false) { List <tbm_Province> plst = mhandler.GetTbm_Province(); if (plst.Count > 0) { foreach (tbm_Province pv in plst) { if (custDo.ProvinceCode == pv.ProvinceCode) { custDo.ProvinceNameEN = pv.ProvinceNameEN; custDo.ProvinceNameLC = pv.ProvinceNameLC; break; } } } } #endregion #region District if (CommonUtil.IsNullOrEmpty(custDo.DistrictCode) == false) { List <tbm_District> dlst = mhandler.GetTbm_District(custDo.ProvinceCode); if (dlst.Count > 0) { foreach (tbm_District d in dlst) { if (custDo.ProvinceCode == d.ProvinceCode && custDo.DistrictCode == d.DistrictCode) { custDo.DistrictNameEN = d.DistrictNameEN; custDo.DistrictNameLC = d.DistrictNameLC; break; } } } } #endregion if (CommonUtil.IsNullOrEmpty(custDo.CustTypeName) || custDo.CustTypeCode != CustomerType.C_CUST_TYPE_JURISTIC) { custDo.CompanyTypeName = null; } if (CommonUtil.IsNullOrEmpty(custDo.CompanyTypeName) || custDo.CompanyTypeCode != CompanyType.C_COMPANY_TYPE_PUBLIC_CO_LTD) { custDo.FinancialMaketTypeName = null; } } MAS050_ValidateCombo validate = CommonUtil.CloneObject <doCustomer, MAS050_ValidateCombo>(custDo); ValidatorUtil.BuildErrorMessage(res, new object[] { validate }); if (custDo != null) { if (custDo.ValidateCustomerData == false) { object validate1 = null; if (custData.CallerScreenID == ScreenID.C_SCREEN_ID_PROJ_NEW || custData.CallerScreenID == ScreenID.C_SCREEN_ID_PROJ_CHANGE || custData.CallerScreenID == ScreenID.C_SCREEN_ID_QTN_TARGET) { if (CommonUtil.IsNullOrEmpty(custDo.CustCode) == true) { MAS050_CheckRequiredFieldCustNull cCustDo = CommonUtil.CloneObject <doCustomer, MAS050_CheckRequiredFieldCustNull>(custDo); validate1 = cCustDo; } else { MAS050_CheckRequiredFieldNotFull cCustDo = CommonUtil.CloneObject <doCustomer, MAS050_CheckRequiredFieldNotFull>(custDo); validate1 = cCustDo; } } else { MAS050_CheckRequiredField cCustDo = CommonUtil.CloneObject <doCustomer, MAS050_CheckRequiredField>(custDo); validate1 = cCustDo; } ValidatorUtil.BuildErrorMessage(res, new object[] { validate1 }); } } //Add by Jutarat A. on 02012014 if (custDo != null) { if (custDo.CustTypeCode == CustomerType.C_CUST_TYPE_JURISTIC || custDo.CustTypeCode == CustomerType.C_CUST_TYPE_ASSOCIATION || custDo.CustTypeCode == CustomerType.C_CUST_TYPE_PUBLIC_OFFICE) { if (custDo.DummyIDFlag != null && custDo.DummyIDFlag.Value == false) { if (CommonUtil.IsNullOrEmpty(custDo.IDNo) == false && custDo.IDNo.Length != 15) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, "MAS050", MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1060, null, new string[] { "IDNo" }); res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; return(Json(res)); } } } } //End Add } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Search incident by criteria when click [Search] button on Incident list by role section /// </summary> /// <param name="condition"></param> /// <returns></returns> public ActionResult CTS310_searchIncidentList(SearchIncidentCondition condition) { ObjectResultData res = new ObjectResultData(); try { CommonUtil c = new CommonUtil(); condition.ContractCode = c.ConvertContractCode(condition.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); IIncidentHandler hand = ServiceContainer.GetService <IIncidentHandler>() as IIncidentHandler; List <dtIncidentList> incidentList = hand.SearchIncidentList(condition); foreach (var item in incidentList) { // Set default if (item.DueDateDeadLine.HasValue) { item.DueDateDeadLine = new DateTime(item.DueDateDeadLine.Value.Year, item.DueDateDeadLine.Value.Month, item.DueDateDeadLine.Value.Day, 23, 59, 59); if (item.DueDateTime.HasValue) { item.DueDateDeadLine = new DateTime(item.DueDateDeadLine.Value.Year, item.DueDateDeadLine.Value.Month, item.DueDateDeadLine.Value.Day, item.DueDateTime.Value.Hours, item.DueDateTime.Value.Minutes, item.DueDateTime.Value.Seconds); } } item.IncidentNo = (String.IsNullOrEmpty(item.IncidentNo)) ? CommonUtil.GetLabelFromResource("Contract", "CTS310", "lblNA") : item.IncidentNo; } CommonUtil.MappingObjectLanguage <dtIncidentList>(incidentList); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(incidentList.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); CTS310_ScreenParameter param = GetScreenObject <CTS310_ScreenParameter>(); foreach (var incident in incidentList) { if (CommonUtil.IsNullOrEmpty(incident.IncidentNo)) { incident.IncidentNo = incident.IncidentID.ToString(); } doHasIncidentPermission hasPermission = hand.HasIncidentPermission(incident.IncidentID); incident.canViewConfidential = param.isAdmin || (!incident.ConfidentialFlag.Value) || hasPermission.ViewConfidentialIncidentFlag; setColStyle(incident); } string xml = CommonUtil.ConvertToXml <dtIncidentList>(incidentList, "Contract\\CTS310", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
/// <summary> /// Add received contract document /// </summary> /// <param name="cond"></param> /// <returns></returns> public ActionResult CTS190_AddReceivedContractDoc(CTS190_ScreenParameter cond) { ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; CommonUtil cm = new CommonUtil(); IMasterHandler handlerMaster = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; List <dtDocumentTemplateByDocumentCode> listDocTemplate = new List <dtDocumentTemplateByDocumentCode>(); string contracCode; string quotationTargetCode; try { ICommonContractHandler handler = ServiceContainer.GetService <ICommonContractHandler>() as ICommonContractHandler; List <dtContractDocHeader> list = new List <dtContractDocHeader>(); contracCode = cm.ConvertContractCode(cond.ContractCode_QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); quotationTargetCode = cm.ConvertQuotationTargetCode(cond.ContractCode_QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); // Check required field. if (ModelState.IsValid == false) { ValidatorUtil.BuildErrorMessage(res, this); if (res.IsError) { return(Json(res)); } } // Business check 1 if (cond.OCC_Alphabet == null) { cond.OCC_Alphabet = string.Empty; } if (!(cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_PO.ToUpper())) //|| cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_START_CONFIRM_LETTER.ToUpper())) //Comment by Jutarat A. on 22042013 { //Then Check "Contract document OCC" field // ---> Then show message at warning section (MSG3234: Please specify contract document occurrence) if (CommonUtil.IsNullOrEmpty(cond.ContractDocOCC) == true) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3234, null, new string[] { "ContractDocOCC" }); return(Json(res)); } } // Business check 2 if (CommonUtil.IsNullOrEmpty(cond.ContractDocOCC) == true) // Not fill ContractDocOCC { if (!(cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_PO.ToUpper())) //|| cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_START_CONFIRM_LETTER.ToUpper())) //Comment by Jutarat A. on 22042013 { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } //#region Check billing basic data //if (cond.OCC_Alphabet.ToUpper().CompareTo(ParticularOCC.C_PARTICULAR_OCC_MIN_BILLING_MEMO.ToUpper()) >= 0 // && cond.OCC_Alphabet.ToUpper().CompareTo(ParticularOCC.C_PARTICULAR_OCC_MAX_BILLING_MEMO.ToUpper()) <= 0) //{ // string occ = cond.OCC_Alphabet.Trim(); // if (occ.Length > 2) // occ = occ.Substring(occ.Length - 2); // IBillingHandler bhandler = ServiceContainer.GetService<IBillingHandler>() as IBillingHandler; // doTbt_BillingBasic bs = bhandler.GetBillingBasicData(contracCode.Trim(), occ, null, null, null); // if (bs == null) // { // res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3242); // return Json(res); // } //} //#endregion list = handler.GetContractDocHeader(contracCode.Trim(), quotationTargetCode.Trim(), cond.OCC_Alphabet.Trim(), cond.ContractDocOCC); if (list.Count == 0) // not found ! (ContractDoc Header) { //Comment by Jutarat A. on 22042013 //if (cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_START_CONFIRM_LETTER.ToUpper()) //{ // res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); // return Json(res); //} //End Comment IRentralContractHandler handlerRental = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; List <tbt_RentalContractBasic> rentalList = handlerRental.GetTbt_RentalContractBasic(contracCode, null); if (rentalList.Count == 0) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } else { // Create dt !! dtContractDocHeader dt = new dtContractDocHeader(); dt.ContractCode = contracCode.ToUpper(); dt.OCC = cond.OCC_Alphabet.Trim().ToUpper(); if (cond.OCC_Alphabet.Trim().ToUpper() == ParticularOCC.C_PARTICULAR_OCC_PO.ToUpper()) { dt.DocumentCode = DocumentCode.C_DOCUMENT_CODE_PO; } //else //{ // dt.DocumentCode = DocumentCode.C_DOCUMENT_CODE_CHANGE_PAYMENT_MEMO; //} listDocTemplate = handlerMaster.GetDocumentTemplateByDocumentCode(dt.DocumentCode); if (listDocTemplate.Count > 0) { dt.DocumentNameEN = listDocTemplate[0].DocumentNameEN; dt.DocumentNameJP = listDocTemplate[0].DocumentNameJP; dt.DocumentNameLC = listDocTemplate[0].DocumentNameLC; } dt.ContractOfficeCode = rentalList[0].ContractOfficeCode; dt.OperationOfficeCode = rentalList[0].OperationOfficeCode; dt.DocStatus = ContractDocStatus.C_CONTRACT_DOC_STATUS_COLLECTED; dt.DocAuditResult = cond.DocAuditResult; dt.CollectDocDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; // extra field dt.ContractCode_QuotationTargetCode = contracCode.ToUpper(); dt.OCC_Alphabet = cond.OCC_Alphabet.Trim().ToUpper(); dt.IsCreateFlag = true; //*** dt.IsContractFlag = true; //*** list.Clear(); list.Add(dt); } } else // Found !! (ContractDoc Header) { // Update dt !! list[0].IsCreateFlag = false; // is updated list[0].DocStatus = ContractDocStatus.C_CONTRACT_DOC_STATUS_COLLECTED; list[0].DocAuditResult = cond.DocAuditResult; list[0].CollectDocDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; } } else // ContractDocOCC is filled { list = handler.GetContractDocHeader(contracCode.Trim(), quotationTargetCode.Trim(), cond.OCC_Alphabet.Trim(), cond.ContractDocOCC.Trim()); if (list.Count > 0) { // get Document templete for get "ReportFlag" listDocTemplate = handlerMaster.GetDocumentTemplateByDocumentCode(list[0].DocumentCode); if (listDocTemplate.Count == 0) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0111, new string[] { "Document Template is not found." }, null); return(Json(res)); } // Business check if (CommonUtil.IsNullOrEmpty(list[0].ContractCode) == true) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3160); return(Json(res)); } // Business check if (listDocTemplate[0].ReportFlag == true) { if (list[0].DocStatus == ContractDocStatus.C_CONTRACT_DOC_STATUS_NOT_ISSUED || list[0].IssuedDate.HasValue == false) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3179); return(Json(res)); } } else { if (list[0].DocStatus == ContractDocStatus.C_CONTRACT_DOC_STATUS_NOT_ISSUED) { res.AddErrorMessage(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3179); return(Json(res)); } } // Update dt !! list[0].IsCreateFlag = false; // is updated list[0].DocStatus = ContractDocStatus.C_CONTRACT_DOC_STATUS_COLLECTED; list[0].DocAuditResult = cond.DocAuditResult; list[0].CollectDocDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; } } if (list.Count > 0) { // CheckDataAuthority if (CTS190_CheckDataAuthority(list[0]) == false) { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063); return(Json(res)); } } else { res.AddErrorMessage(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0001); return(Json(res)); } CommonUtil.MappingObjectLanguage <dtContractDocHeader>(list); MiscTypeMappingList miscList = new MiscTypeMappingList(); miscList.AddMiscType(list.ToArray()); ICommonHandler comHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comHandler.MiscTypeMappingList(miscList); if (list.Count > 0) { if (list[0].IsContractFlag.Value) { list[0].ContractCode_QuotationTargetCode = cm.ConvertContractCode(list[0].ContractCode_QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } else { list[0].ContractCode_QuotationTargetCode = cm.ConvertQuotationTargetCode(list[0].ContractCode_QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } string myContractCode = cm.ConvertContractCode(list[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); string myOCC = list[0].OCC; string myQuotationTargetCode = cm.ConvertQuotationTargetCode(list[0].QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); string myAlphabet = list[0].Alphabet; string myDocOCC = list[0].ContractDocOCC; if (cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_PO.ToUpper()) { //|| cond.OCC_Alphabet.ToUpper() == ParticularOCC.C_PARTICULAR_OCC_START_CONFIRM_LETTER.ToUpper()) //Comment by Jutarat A. on 22042013 myDocOCC = ""; } // Update my_checked_id_by_ct , my_checked_id_by_quo , my_checked_id list[0].my_checked_id_by_ct = string.Format("{0}-{1}-{2}", myContractCode, myOCC, myDocOCC).ToUpper(); list[0].my_checked_id_by_quo = string.Format("{0}-{1}-{2}", myQuotationTargetCode, myAlphabet, myDocOCC).ToUpper(); list[0].my_checked_id = string.Format("{0}-{1}", list[0].my_checked_id_by_ct, list[0].my_checked_id_by_quo).ToUpper(); res.ResultData = list[0]; } return(Json(res)); } catch (Exception ex) { res.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION; res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Get entire draft sale contract /// </summary> /// <param name="cond"></param> /// <param name="mode"></param> /// <param name="procType"></param> /// <returns></returns> public doDraftSaleContractData GetEntireDraftSaleContract(doDraftSaleContractCondition cond, doDraftSaleContractData.SALE_CONTRACT_MODE mode, doDraftSaleContractData.PROCESS_TYPE procType) { try { doDraftSaleContractData saleData = null; if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.QUOTATION) { CommonUtil cmm = new CommonUtil(); doGetQuotationDataCondition qcond = new doGetQuotationDataCondition(); qcond.QuotationTargetCode = cond.QuotationTargetCodeLong; qcond.Alphabet = cond.Alphabet; qcond.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; if (procType == doDraftSaleContractData.PROCESS_TYPE.NEW) { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_QTN_CODE; } else { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_CONTRACT_CODE; } qcond.ContractFlag = true; IQuotationHandler qhandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; dsQuotationData qData = qhandler.GetQuotationData(qcond); if (qData != null) { #region Check Authority bool hasAuthority = false; List <OfficeDataDo> officeLst = CommonUtil.dsTransData.dtOfficeData; if (qData.dtTbt_QuotationTarget != null && officeLst.Count > 0) { foreach (OfficeDataDo office in officeLst) { if (office.OfficeCode == qData.dtTbt_QuotationTarget.QuotationOfficeCode || office.OfficeCode == qData.dtTbt_QuotationTarget.OperationOfficeCode) { hasAuthority = true; break; } } } if (hasAuthority == false) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063); } #endregion saleData = new doDraftSaleContractData(); if (qData.dtTbt_QuotationTarget.UpdateDate != null) { saleData.LastUpdateDateQuotationData = qData.dtTbt_QuotationTarget.UpdateDate.Value; } #region Set Draft Sale Contract saleData.doTbt_DraftSaleContract = CommonUtil.CloneObject <tbt_QuotationBasic, tbt_DraftSaleContract>(qData.dtTbt_QuotationBasic); if (saleData.doTbt_DraftSaleContract != null) { saleData.doTbt_DraftSaleContract.QuotationTargetCode = cond.QuotationTargetCodeLong; saleData.doTbt_DraftSaleContract.Alphabet = cond.Alphabet; saleData.doTbt_DraftSaleContract.ProductTypeCode = qData.dtTbt_QuotationTarget.ProductTypeCode; saleData.doTbt_DraftSaleContract.BranchNameEN = qData.dtTbt_QuotationTarget.BranchNameEN; saleData.doTbt_DraftSaleContract.BranchNameLC = qData.dtTbt_QuotationTarget.BranchNameLC; saleData.doTbt_DraftSaleContract.BranchAddressEN = qData.dtTbt_QuotationTarget.BranchAddressEN; saleData.doTbt_DraftSaleContract.BranchAddressLC = qData.dtTbt_QuotationTarget.BranchAddressLC; saleData.doTbt_DraftSaleContract.PurchaserMemo = qData.dtTbt_QuotationTarget.ContractTargetMemo; saleData.doTbt_DraftSaleContract.RealCustomerMemo = qData.dtTbt_QuotationTarget.RealCustomerMemo; foreach (tbt_QuotationCustomer cust in qData.dtTbt_QuotationCustomer) { if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_CONTRACT_TARGET) { saleData.doTbt_DraftSaleContract.PurchaserCustCode = cust.CustCode; } else if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_REAL_CUST) { saleData.doTbt_DraftSaleContract.RealCustomerCustCode = cust.CustCode; } } if (qData.dtTbt_QuotationSite != null) { saleData.doTbt_DraftSaleContract.SiteCode = qData.dtTbt_QuotationSite.SiteCode; } saleData.doTbt_DraftSaleContract.ConnectTargetCode = qData.dtTbt_QuotationBasic.SaleOnlineContractCode; if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.ConnectTargetCode) == false) { saleData.doTbt_DraftSaleContract.ConnectionFlag = FlagType.C_FLAG_ON; } else { saleData.doTbt_DraftSaleContract.ConnectionFlag = FlagType.C_FLAG_OFF; } saleData.doTbt_DraftSaleContract.NormalProductPriceCurrencyType = qData.dtTbt_QuotationBasic.ProductPriceCurrencyType; saleData.doTbt_DraftSaleContract.NormalProductPrice = qData.dtTbt_QuotationBasic.ProductPrice; saleData.doTbt_DraftSaleContract.NormalProductPriceUsd = qData.dtTbt_QuotationBasic.ProductPriceUsd; saleData.doTbt_DraftSaleContract.NormalInstallFeeCurrencyType = qData.dtTbt_QuotationBasic.InstallationFeeCurrencyType; saleData.doTbt_DraftSaleContract.NormalInstallFee = qData.dtTbt_QuotationBasic.InstallationFee; saleData.doTbt_DraftSaleContract.NormalInstallFeeUsd = qData.dtTbt_QuotationBasic.InstallationFeeUsd; if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalProductPrice) == false || CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalInstallFee) == false) { saleData.doTbt_DraftSaleContract.NormalSalePrice = 0; //if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalProductPrice) == false) // saleData.doTbt_DraftSaleContract.NormalSalePrice += saleData.doTbt_DraftSaleContract.NormalProductPrice; //if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.NormalInstallFee) == false) // saleData.doTbt_DraftSaleContract.NormalSalePrice += saleData.doTbt_DraftSaleContract.NormalInstallFee; } saleData.doTbt_DraftSaleContract.NormalSpecialItemPrice = 0; saleData.doTbt_DraftSaleContract.NormalOtherProdPrice = 0; saleData.doTbt_DraftSaleContract.NormalOtherInstallFee = 0; //saleData.doTbt_DraftSaleContract.OrderProductPrice = qData.dtTbt_QuotationBasic.ProductPrice; //saleData.doTbt_DraftSaleContract.OrderInstallFee = qData.dtTbt_QuotationBasic.InstallationFee; //saleData.doTbt_DraftSaleContract.OrderSalePrice = saleData.doTbt_DraftSaleContract.NormalSalePrice; saleData.doTbt_DraftSaleContract.OrderProductPriceCurrencyType = qData.dtTbt_QuotationBasic.ProductPriceCurrencyType; saleData.doTbt_DraftSaleContract.OrderProductPrice = null; saleData.doTbt_DraftSaleContract.OrderProductPriceUsd = null; saleData.doTbt_DraftSaleContract.OrderInstallFeeCurrencyType = qData.dtTbt_QuotationBasic.InstallationFeeCurrencyType; saleData.doTbt_DraftSaleContract.OrderInstallFee = null; saleData.doTbt_DraftSaleContract.OrderInstallFeeUsd = null; saleData.doTbt_DraftSaleContract.OrderSalePrice = null; saleData.doTbt_DraftSaleContract.TotalSaleBilingAmt_Agreed = 0; saleData.doTbt_DraftSaleContract.QuotationStaffEmpNo = qData.dtTbt_QuotationTarget.QuotationStaffEmpNo; saleData.doTbt_DraftSaleContract.QuotationOfficeCode = qData.dtTbt_QuotationTarget.QuotationOfficeCode; saleData.doTbt_DraftSaleContract.OperationOfficeCode = qData.dtTbt_QuotationTarget.OperationOfficeCode; saleData.doTbt_DraftSaleContract.AcquisitionTypeCode = qData.dtTbt_QuotationTarget.AcquisitionTypeCode; saleData.doTbt_DraftSaleContract.IntroducerCode = qData.dtTbt_QuotationTarget.IntroducerCode; saleData.doTbt_DraftSaleContract.MotivationTypeCode = qData.dtTbt_QuotationTarget.MotivationTypeCode; saleData.doTbt_DraftSaleContract.ApproveNo1 = null; saleData.doTbt_DraftSaleContract.ApproveNo2 = null; saleData.doTbt_DraftSaleContract.ApproveNo3 = null; saleData.doTbt_DraftSaleContract.ApproveNo4 = null; saleData.doTbt_DraftSaleContract.ApproveNo5 = null; saleData.doTbt_DraftSaleContract.CreateBy = null; saleData.doTbt_DraftSaleContract.CreateDate = null; saleData.doTbt_DraftSaleContract.UpdateBy = null; saleData.doTbt_DraftSaleContract.UpdateDate = null; List <tbt_DraftSaleContract> contractLst = this.GetTbt_DraftSaleContract(cond.QuotationTargetCodeLong); if (contractLst.Count > 0) { saleData.doTbt_DraftSaleContract.CreateBy = contractLst[0].CreateBy; saleData.doTbt_DraftSaleContract.CreateDate = contractLst[0].CreateDate; saleData.doTbt_DraftSaleContract.UpdateBy = contractLst[0].UpdateBy; saleData.doTbt_DraftSaleContract.UpdateDate = contractLst[0].UpdateDate; } if (saleData.doTbt_DraftSaleContract.ProductTypeCode == ProductType.C_PROD_TYPE_ONLINE) { ISaleContractHandler shandler = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; if (qData.dtTbt_QuotationBasic.SaleOnlineContractCode != null) { doSaleContractData doSaleContract = shandler.GetSaleContractData(qData.dtTbt_QuotationBasic.SaleOnlineContractCode, null); if (doSaleContract != null) { saleData.doTbt_DraftSaleContract.SecurityAreaFrom = doSaleContract.dtTbt_SaleBasic.SecurityAreaFrom; saleData.doTbt_DraftSaleContract.SecurityAreaTo = doSaleContract.dtTbt_SaleBasic.SecurityAreaTo; } } } } #endregion #region Set Draft Sale Customer MiscTypeMappingList cmLst = new MiscTypeMappingList(); ICustomerMasterHandler chandler = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler; foreach (tbt_QuotationCustomer cust in qData.dtTbt_QuotationCustomer) { doCustomerWithGroup icust = null; if (cust.CustCode != null) { List <doCustomerWithGroup> lst = chandler.GetCustomerWithGroup(cust.CustCode); if (lst.Count > 0) { icust = lst[0]; } } else { icust = CommonUtil.CloneObject <tbt_QuotationCustomer, doCustomerWithGroup>(cust); if (icust != null) { icust.CustomerGroupData = new List <dtCustomeGroupData>(); } IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; if (icust.BusinessTypeCode != null) { List <tbm_BusinessType> btLst = mhandler.GetTbm_BusinessType(); foreach (tbm_BusinessType bt in btLst) { if (bt.BusinessTypeCode == icust.BusinessTypeCode) { icust.BusinessTypeName = bt.BusinessTypeName; break; } } } if (icust.RegionCode != null) { List <tbm_Region> rLst = mhandler.GetTbm_Region(); foreach (tbm_Region r in rLst) { if (r.RegionCode == icust.RegionCode) { icust.Nationality = r.Nationality; break; } } } if (icust.CustTypeCode != null) { cmLst.AddMiscType(icust); } } if (icust != null) { if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_CONTRACT_TARGET) { saleData.doPurchaserCustomer = icust; } else if (cust.CustPartTypeCode == CustPartType.C_CUST_PART_TYPE_REAL_CUST) { saleData.doRealCustomer = icust; } } } ICommonHandler cmmhandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; cmmhandler.MiscTypeMappingList(cmLst); #endregion #region Set Draft Sale Site if (qData.dtTbt_QuotationSite != null) { if (qData.dtTbt_QuotationSite.SiteCode != null) { ISiteMasterHandler shandler = ServiceContainer.GetService <ISiteMasterHandler>() as ISiteMasterHandler; List <doSite> lst = shandler.GetSite(qData.dtTbt_QuotationSite.SiteCode, null); if (lst.Count > 0) { saleData.doSite = lst[0]; } } else { saleData.doSite = CommonUtil.CloneObject <tbt_QuotationSite, doSite>(qData.dtTbt_QuotationSite); IMasterHandler mhandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; List <tbm_BuildingUsage> blst = mhandler.GetTbm_BiuldingUsage(); foreach (tbm_BuildingUsage b in blst) { if (b.BuildingUsageCode == saleData.doSite.BuildingUsageCode) { saleData.doSite.BuildingUsageName = b.BuildingUsageName; break; } } } } #endregion #region Set Draft Sale Instrument saleData.doTbt_DraftSaleInstrument = new List <tbt_DraftSaleInstrument>(); if (qData.dtTbt_QuotationInstrumentDetails != null) { foreach (tbt_QuotationInstrumentDetails inst in qData.dtTbt_QuotationInstrumentDetails) { tbt_DraftSaleInstrument dInst = new tbt_DraftSaleInstrument(); dInst.QuotationTargetCode = cond.QuotationTargetCodeLong; dInst.InstrumentCode = inst.InstrumentCode; dInst.InstrumentQty = inst.InstrumentQty; dInst.InstrumentTypeCode = InstrumentType.C_INST_TYPE_GENERAL; if (CommonUtil.IsNullOrEmpty(dInst.InstrumentQty) == false) { if (CommonUtil.IsNullOrEmpty(inst.AddQty) == false) { dInst.InstrumentQty += inst.AddQty; } if (CommonUtil.IsNullOrEmpty(inst.RemoveQty) == false) { dInst.InstrumentQty -= inst.RemoveQty; } } saleData.doTbt_DraftSaleInstrument.Add(dInst); } } if (qData.dtTbt_QuotationFacilityDetails != null) { foreach (tbt_QuotationFacilityDetails facility in qData.dtTbt_QuotationFacilityDetails) { tbt_DraftSaleInstrument dInst = new tbt_DraftSaleInstrument(); dInst.QuotationTargetCode = cond.QuotationTargetCode; dInst.InstrumentCode = facility.FacilityCode; dInst.InstrumentQty = facility.FacilityQty; dInst.InstrumentTypeCode = InstrumentType.C_INST_TYPE_MONITOR; saleData.doTbt_DraftSaleInstrument.Add(dInst); } } if (saleData.doTbt_DraftSaleInstrument.Count > 0) { InstrumentMappingList instMappingLst = new InstrumentMappingList(); instMappingLst.AddInstrument(saleData.doTbt_DraftSaleInstrument.ToArray()); IInstrumentMasterHandler ihandler = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ihandler.InstrumentListMapping(instMappingLst); } #endregion #region Set Draft Relation Type saleData.doTbt_RelationType = new List <tbt_RelationType>(); /* -- Sale Online --- */ if (CommonUtil.IsNullOrEmpty(qData.dtTbt_QuotationBasic.SaleOnlineContractCode) == false) { saleData.doTbt_RelationType.Add(new tbt_RelationType() { RelatedContractCode = qData.dtTbt_QuotationBasic.SaleOnlineContractCode, RelatedOCC = qData.dtTbt_QuotationBasic.LastOccNo, OCC = null, RelationType = RelationType.C_RELATION_TYPE_SALE }); } #endregion } } else if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.DRAFT || mode == doDraftSaleContractData.SALE_CONTRACT_MODE.APPROVE) { saleData = new doDraftSaleContractData(); #region Set Draft Sale Contract List <tbt_DraftSaleContract> contractLst = this.GetTbt_DraftSaleContract(cond.QuotationTargetCodeLong); if (contractLst.Count > 0) { saleData.doTbt_DraftSaleContract = contractLst[0]; } else { return(null); } #endregion #region Check Authority bool hasAuthority = false; List <OfficeDataDo> officeLst = CommonUtil.dsTransData.dtOfficeData; if (saleData.doTbt_DraftSaleContract != null && officeLst.Count > 0) { foreach (OfficeDataDo office in officeLst) { if (office.OfficeCode == saleData.doTbt_DraftSaleContract.QuotationOfficeCode || office.OfficeCode == saleData.doTbt_DraftSaleContract.OperationOfficeCode) { hasAuthority = true; break; } } } if (hasAuthority == false) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0063); } #endregion #region Check Contract status if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.DRAFT && saleData.doTbt_DraftSaleContract.DraftSaleContractStatus != ApprovalStatus.C_APPROVE_STATUS_RETURNED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3100); } else if (mode == doDraftSaleContractData.SALE_CONTRACT_MODE.APPROVE) { if (saleData.doTbt_DraftSaleContract.DraftSaleContractStatus == ApprovalStatus.C_APPROVE_STATUS_APPROVED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3246); } else if (saleData.doTbt_DraftSaleContract.DraftSaleContractStatus == ApprovalStatus.C_APPROVE_STATUS_REJECTED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3244); } else if (saleData.doTbt_DraftSaleContract.DraftSaleContractStatus == ApprovalStatus.C_APPROVE_STATUS_RETURNED) { throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3245); } } #endregion #region Set Draft Sale E-mail saleData.doTbt_DraftSaleEmail = this.GetTbt_DraftSaleEmail(cond.QuotationTargetCodeLong); if (saleData.doTbt_DraftSaleEmail != null) { IEmployeeMasterHandler empHandler = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; List <tbm_Employee> emps = new List <tbm_Employee>(); foreach (tbt_DraftSaleEmail email in saleData.doTbt_DraftSaleEmail) { emps.Add(new tbm_Employee() { EmpNo = email.ToEmpNo }); } List <tbm_Employee> empList = empHandler.GetEmployeeList(emps); if (empList.Count > 0) { foreach (tbt_DraftSaleEmail email in saleData.doTbt_DraftSaleEmail) { foreach (tbm_Employee emp in empList) { if (emp.EmpNo == email.ToEmpNo) { email.EmailAddress = emp.EmailAddress; break; } } } } } #endregion #region Set Draft Sale Instrument saleData.doTbt_DraftSaleInstrument = this.GetTbt_DraftSaleInstrument(cond.QuotationTargetCodeLong); if (saleData.doTbt_DraftSaleInstrument.Count > 0) { InstrumentMappingList instMappingLst = new InstrumentMappingList(); instMappingLst.AddInstrument(saleData.doTbt_DraftSaleInstrument.ToArray()); IInstrumentMasterHandler ihandler = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; ihandler.InstrumentListMapping(instMappingLst); } #endregion #region Set Draft Sale Billing Target saleData.doTbt_DraftSaleBillingTarget = this.GetTbt_DraftSaleBillingTarget(cond.QuotationTargetCodeLong); #endregion #region Set Contract Customer ICustomerMasterHandler custhandler = ServiceContainer.GetService <ICustomerMasterHandler>() as ICustomerMasterHandler; if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.PurchaserCustCode) == false) { List <doCustomerWithGroup> custLst = custhandler.GetCustomerWithGroup(saleData.doTbt_DraftSaleContract.PurchaserCustCode); if (custLst.Count > 0) { saleData.doPurchaserCustomer = custLst[0]; } } if (CommonUtil.IsNullOrEmpty(saleData.doTbt_DraftSaleContract.RealCustomerCustCode) == false) { List <doCustomerWithGroup> custLst = custhandler.GetCustomerWithGroup(saleData.doTbt_DraftSaleContract.RealCustomerCustCode); if (custLst.Count > 0) { saleData.doRealCustomer = custLst[0]; } } #endregion #region Set Site ISiteMasterHandler shandler = ServiceContainer.GetService <ISiteMasterHandler>() as ISiteMasterHandler; List <doSite> siteLst = shandler.GetSite(saleData.doTbt_DraftSaleContract.SiteCode, saleData.doTbt_DraftSaleContract.RealCustomerCustCode); if (siteLst.Count > 0) { saleData.doSite = siteLst[0]; } #endregion doGetQuotationDataCondition qcond = new doGetQuotationDataCondition(); qcond.QuotationTargetCode = cond.QuotationTargetCodeLong; qcond.Alphabet = saleData.doTbt_DraftSaleContract.Alphabet;//cond.Alphabet; qcond.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; if (saleData.doTbt_DraftSaleContract.SaleProcessType == SaleProcessType.C_SALE_PROCESS_TYPE_ADD_SALE) { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_CONTRACT_CODE; } else { qcond.TargetCodeTypeCode = TargetCodeType.C_TARGET_CODE_TYPE_QTN_CODE; } qcond.ContractFlag = true; IQuotationHandler qhandler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; dsQuotationData qData = qhandler.GetQuotationData(qcond); if (qData != null) { if (qData.dtTbt_QuotationTarget.UpdateDate != null) { saleData.LastUpdateDateQuotationData = qData.dtTbt_QuotationTarget.UpdateDate.Value; } } } if (saleData != null) { if (saleData.doTbt_DraftSaleContract != null) { #region Set Product Name IProductMasterHandler mhandler = ServiceContainer.GetService <IProductMasterHandler>() as IProductMasterHandler; List <View_tbm_Product> pLst = mhandler.GetTbm_ProductByLanguage( saleData.doTbt_DraftSaleContract.ProductCode, saleData.doTbt_DraftSaleContract.ProductTypeCode); if (pLst.Count > 0) { saleData.doTbt_DraftSaleContract.ProductName = pLst[0].ProductName; } #endregion #region Set Misc Name MiscTypeMappingList miscLst = new MiscTypeMappingList(); miscLst.AddMiscType(saleData.doTbt_DraftSaleContract); miscLst.AddMiscType(saleData.doTbt_DraftSaleInstrument.ToArray()); ICommonHandler chandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; chandler.MiscTypeMappingList(miscLst); #endregion #region Set Employee Name EmployeeMappingList empLst = new EmployeeMappingList(); empLst.AddEmployee(saleData.doTbt_DraftSaleContract); IEmployeeMasterHandler emphandler = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; emphandler.EmployeeListMapping(empLst); #endregion } } return(saleData); } catch (Exception) { throw; } }
public ActionResult CMS410() { ObjectResultData res = new ObjectResultData(); try { CMS410_ScreenParameter param = GetScreenObject <CMS410_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strBillingTargetCode_short = param.BillingTargetCode; string strBillingTargetCode = cm.ConvertBillingTargetCode(strBillingTargetCode_short, CommonUtil.CONVERT_TYPE.TO_LONG); IBillingHandler handler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <dtTbt_BillingTargetForView> billingTargetData = handler.GetTbt_BillingTargetForView(strBillingTargetCode, MiscType.C_CUST_TYPE); ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (billingTargetData != null) { if (billingTargetData.Count > 0) { //Language mapping CommonUtil.MappingObjectLanguage <dtTbt_BillingTargetForView>(billingTargetData); //Misc mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(billingTargetData.ToArray <dtTbt_BillingTargetForView>()); handlerCommon.MiscTypeMappingList(miscMapping); ViewBag.BillingTargetCode = strBillingTargetCode_short; ViewBag.txtBillingTargetCode = strBillingTargetCode_short; ViewBag.txtBillingOffice = CommonUtil.TextCodeName(billingTargetData[0].BillingOfficeCode, billingTargetData[0].OfficeName); ViewBag.txtCustomerType = CommonUtil.TextCodeName(billingTargetData[0].CustTypeCode, billingTargetData[0].CustTypeName); ViewBag.txtNameEN = billingTargetData[0].FullNameEN; ViewBag.txtBranchNameEN = billingTargetData[0].BranchNameEN; ViewBag.txtAddressEN = billingTargetData[0].AddressEN; ViewBag.txtNameLC = billingTargetData[0].FullNameLC; ViewBag.txtBranchNameLC = billingTargetData[0].BranchNameLC; ViewBag.txtAddressLC = billingTargetData[0].AddressLC; ViewBag.txtNationality = billingTargetData[0].Nationality; ViewBag.txtPhoneNo = billingTargetData[0].PhoneNo; ViewBag.txtIDNo = billingTargetData[0].IDNo; ViewBag.txtBusinessType = billingTargetData[0].BusinessTypeName; ViewBag.txtContactPersonName = billingTargetData[0].ContactPersonName; ViewBag.txtMemo = billingTargetData[0].Memo; ViewBag.txtIssueInvoiceTiming = string.Format("{0} {1}", billingTargetData[0].IssueInvTimeName, billingTargetData[0].IssueInvMonth.HasValue ? billingTargetData[0].IssueInvMonth.Value.ToString() : "");; string IssueInvDate = string.Empty; if (billingTargetData[0].IssueInvDate.HasValue) { if (billingTargetData[0].IssueInvDate == 1) { IssueInvDate = string.Format("{0}st", billingTargetData[0].IssueInvDate.ToString()); } else if (billingTargetData[0].IssueInvDate == 2) { IssueInvDate = string.Format("{0}nd", billingTargetData[0].IssueInvDate.ToString()); } else { IssueInvDate = string.Format("{0}th", billingTargetData[0].IssueInvDate.ToString()); } } ViewBag.txtIssueInvoiceDate = IssueInvDate; ViewBag.txtInvoiceFormat = billingTargetData[0].InvFormatTypeName; ViewBag.txtSignatureType = billingTargetData[0].SignatureTypeName; ViewBag.txtShowPaymentDueDate = billingTargetData[0].ShowDueDateName; ViewBag.txtIssueTaxInvoiceReceiptTiming = billingTargetData[0].IssueReceiptTimingName; ViewBag.txtShowAutoTransferAccount = billingTargetData[0].ShowAccTypeName; ViewBag.txtAutoTransferWhtDeductionType = billingTargetData[0].WhtDeductionTypeName; ViewBag.txtDisplayLanguage = billingTargetData[0].DocLanguageName; ViewBag.txtPrintIssueDate = billingTargetData[0].ShowIssueDateName; ViewBag.txtSeparateInvoiceType = billingTargetData[0].SeparateInvTypeName; ViewBag.txtSupplementaryInvoiceAddress = billingTargetData[0].SuppleInvAddress; ViewBag.PayByChequeFlag = billingTargetData[0].PayByChequeFlag.HasValue == false ? false : billingTargetData[0].PayByChequeFlag.Value; ViewBag.PrintInvoiceWHTFlag = billingTargetData[0].ShowInvWHTFlag.HasValue == false ? false : billingTargetData[0].ShowInvWHTFlag.Value; ViewBag.txtRealBillingClientNameEN = billingTargetData[0].RealBillingClientNameEN; ViewBag.txtRealBillingClientAddressEN = billingTargetData[0].RealBillingClientAddressEN; ViewBag.txtRealBillingClientNameLC = billingTargetData[0].RealBillingClientNameLC; ViewBag.txtRealBillingClientAddressLC = billingTargetData[0].RealBillingClientAddressLC; } else { ViewBag.PayByChequeFlag = false; ViewBag.PrintInvoiceWHTFlag = false; } } return(View()); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Getting billing basic information /// </summary> /// <param name="BillingOCC"></param> /// <returns></returns> public ActionResult CMS420_LoadBillingBasicInformation(string BillingOCC) { ObjectResultData res = new ObjectResultData(); try { CMS420_ScreenParameter param = GetScreenObject <CMS420_ScreenParameter>(); CommonUtil cm = new CommonUtil(); string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); param.BillingOCC = BillingOCC; IViewBillingHandler viewBillingHandler = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler; IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); List <dtViewBillingBasic> viewBillingBasicData = viewBillingHandler.GetViewBillingBasic(strContractCode, BillingOCC, null, null, null, null); List <doTbt_MonthlyBillingHistoryList> monthlyBillingHistoryListData = billingHandler.GetBillingHistoryList(strContractCode, BillingOCC, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); for (int i = 0; i < viewBillingBasicData.Count(); i++) { viewBillingBasicData[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } for (int i = 0; i < monthlyBillingHistoryListData.Count(); i++) { monthlyBillingHistoryListData[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <object> result = new List <object>(); bool carefulFlag = false; string paymentMethod = "0"; if (viewBillingBasicData.Count > 0) { //Language mapping CommonUtil.MappingObjectLanguage <dtViewBillingBasic>(viewBillingBasicData); //Misc mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(viewBillingBasicData.ToArray <dtViewBillingBasic>()); handlerCommon.MiscTypeMappingList(miscMapping); carefulFlag = viewBillingBasicData[0].CarefulFlag.HasValue ? viewBillingBasicData[0].CarefulFlag.Value : false; paymentMethod = viewBillingBasicData[0].PaymentMethod; dtViewBillingBasic_ForView billingBasic = new dtViewBillingBasic_ForView() { BillingCode = string.Format("{0}-{1}", cm.ConvertContractCode(viewBillingBasicData[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT), viewBillingBasicData[0].BillingOCC), BillingOffice = CommonUtil.TextCodeName(viewBillingBasicData[0].BillingOfficeCode, viewBillingBasicData[0].OfficeName), DebtTracingOffice = CommonUtil.TextCodeName(viewBillingBasicData[0].DebtTracingOfficeCode, viewBillingBasicData[0].DebtTracingOfficeName), BillingTargetCode = cm.ConvertBillingTargetCode(viewBillingBasicData[0].BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT), PreviousBillingTargetCode = cm.ConvertBillingTargetCode(viewBillingBasicData[0].PreviousBillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT), CustomerType = viewBillingBasicData[0].CustTypeCodeName, BillingClientNameEN = viewBillingBasicData[0].FullNameEN, BillingClientBranchNameEN = viewBillingBasicData[0].BranchNameEN, BillingClientAddressEN = viewBillingBasicData[0].AddressEN, BillingClientNameLC = viewBillingBasicData[0].FullNameLC, BillingClientBranchNameLC = viewBillingBasicData[0].BranchNameLC, BillingClientAddressLC = viewBillingBasicData[0].AddressLC, MonthlyBillingAmount = viewBillingBasicData[0].TextTransferMonthlyBillingAmount, PaymentMethod = viewBillingBasicData[0].PaymentMethodName, BillingCycle = CommonUtil.TextNumeric(viewBillingBasicData[0].BillingCycle, 0), CreditTerm = CommonUtil.TextNumeric(viewBillingBasicData[0].CreditTerm), CalculationDailyFee = viewBillingBasicData[0].CalDailyFeeStatusName, LastBillingDate = CommonUtil.TextDate(viewBillingBasicData[0].LastBillingDate), ManagementCodeForSortDetails = viewBillingBasicData[0].SortingType, AdjustEndingDateOfBillingPeriod = CommonUtil.TextDate(viewBillingBasicData[0].AdjustEndDate), BillingFlag = viewBillingBasicData[0].StopBillingFlagCodeName, VATUnchargedBillingTarget = viewBillingBasicData[0].VATUnchargedFlag.HasValue ? viewBillingBasicData[0].VATUnchargedFlag.Value : false, BalanceOfDepositFee = viewBillingBasicData[0].TextTransferBalanceDeposit, MonthlyFeeBeforeStop = viewBillingBasicData[0].TextTransferMonthlyFeeBeforeStop, ResultBasedMaintenanceBillingFlag = viewBillingBasicData[0].ResultBasedMaintenanceFlag.HasValue ? viewBillingBasicData[0].ResultBasedMaintenanceFlag.Value : false, LastPaymentConditionChangingDate = CommonUtil.TextDate(viewBillingBasicData[0].ChangeDate), RegisteringDateOfLastChanging = CommonUtil.TextDate(viewBillingBasicData[0].ChangeDate), ApproveNo = viewBillingBasicData[0].ApproveNo, DocumentReceiving = viewBillingBasicData[0].DocAuditResultName, AdjustmentType = viewBillingBasicData[0].AdjustType, AdjustBillingAmount = viewBillingBasicData[0].TextTransferAdjustBillingPeriodAmount, AdjustBillingPeriodStartDate = CommonUtil.TextDate(viewBillingBasicData[0].AdjustBillingPeriodStartDate), AdjustBillingPeriodEndDate = CommonUtil.TextDate(viewBillingBasicData[0].AdjustBillingPeriodEndDate) , IDNo = viewBillingBasicData[0].IDNo //Add by Jutarat A. on 12122013 }; result.Add(billingBasic); } else { result.Add(new dtViewBillingBasic_ForView()); } if (monthlyBillingHistoryListData.Count > 0) { doTbt_MonthlyBillingHistoryList_ForView billingHistory = new doTbt_MonthlyBillingHistoryList_ForView() { LastMonthlyBillingAmount = monthlyBillingHistoryListData[0].TextTransferMonthlyBillingAmount, LastDate = CommonUtil.TextDate(monthlyBillingHistoryListData[0].BillingStartDate), BillingAmountBeforeChanging1 = monthlyBillingHistoryListData.Count < 2 ? null : monthlyBillingHistoryListData[1].TextTransferMonthlyBillingAmount, DateBeforeChanging1 = monthlyBillingHistoryListData.Count < 2 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[1].BillingStartDate), BillingAmountBeforeChanging2 = monthlyBillingHistoryListData.Count < 3 ? null : monthlyBillingHistoryListData[2].TextTransferMonthlyBillingAmount, DateBeforeChanging2 = monthlyBillingHistoryListData.Count < 3 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[2].BillingStartDate), BillingAmountBeforeChanging3 = monthlyBillingHistoryListData.Count < 4 ? null : monthlyBillingHistoryListData[3].TextTransferMonthlyBillingAmount, DateBeforeChanging3 = monthlyBillingHistoryListData.Count < 4 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[3].BillingStartDate), BillingAmountBeforeChanging4 = monthlyBillingHistoryListData.Count < 5 ? null : monthlyBillingHistoryListData[4].TextTransferMonthlyBillingAmount, DateBeforeChanging4 = monthlyBillingHistoryListData.Count < 5 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[4].BillingStartDate), BillingAmountBeforeChanging5 = monthlyBillingHistoryListData.Count < 6 ? null : monthlyBillingHistoryListData[5].TextTransferMonthlyBillingAmount, DateBeforeChanging5 = monthlyBillingHistoryListData.Count < 6 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[5].BillingStartDate) }; result.Add(billingHistory); } else { result.Add(new doTbt_MonthlyBillingHistoryList_ForView()); } result.Add(carefulFlag); result.Add(paymentMethod); res.ResultData = result.ToArray(); return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
public ActionResult CMS420() { ObjectResultData res = new ObjectResultData(); try { CMS420_ScreenParameter param = GetScreenObject <CMS420_ScreenParameter>(); CommonUtil cm = new CommonUtil(); ViewBag._ContractCode = param.ContractCode; ViewBag._BillingOCC = param.BillingOCC; string strContractCode = cm.ConvertContractCode(param.ContractCode, CommonUtil.CONVERT_TYPE.TO_LONG); ViewBag._CallerScreen = param.CallerScreenID; IViewBillingHandler viewBillingHandler = ServiceContainer.GetService <IViewBillingHandler>() as IViewBillingHandler; IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; ICommonHandler comHand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; List <doMiscTypeCode> tmpCurrencies = comHand.GetMiscTypeCodeList(new List <doMiscTypeCode>() { new doMiscTypeCode() { FieldName = MiscType.C_CURRENCT, ValueCode = "%" } }).ToList(); List <dtViewBillingOccList> viewBillingOccListData = viewBillingHandler.GetViewBillingOccList(strContractCode); List <dtViewBillingBasic> viewBillingBasicData = viewBillingHandler.GetViewBillingBasic(strContractCode, param.BillingOCC, null, null, null, null); List <doTbt_MonthlyBillingHistoryList> monthlyBillingHistoryListData = billingHandler.GetBillingHistoryList(strContractCode, param.BillingOCC, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); for (int i = 0; i < viewBillingOccListData.Count(); i++) { viewBillingOccListData[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } for (int i = 0; i < viewBillingBasicData.Count(); i++) { viewBillingBasicData[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } for (int i = 0; i < monthlyBillingHistoryListData.Count(); i++) { monthlyBillingHistoryListData[i].Currencies = new List <doMiscTypeCode>(tmpCurrencies); } ICommonHandler handlerCommon = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; ViewBag.IsSpecialCareful = "0"; ViewBag.txtVATUnchargedBillingTarget = false; ViewBag.txtResultBasedMaintenanceBillingFlag = false; if (viewBillingOccListData.Count > 0) { //Language mapping CommonUtil.MappingObjectLanguage <dtViewBillingOccList>(viewBillingOccListData); ViewBag.txtContractCode = cm.ConvertContractCode(viewBillingOccListData[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); } if (param.BillingOCC != null) { if (viewBillingBasicData.Count > 0) { //Language mapping CommonUtil.MappingObjectLanguage <dtViewBillingBasic>(viewBillingBasicData); //Misc mapping MiscTypeMappingList miscMapping = new MiscTypeMappingList(); miscMapping.AddMiscType(viewBillingBasicData.ToArray <dtViewBillingBasic>()); handlerCommon.MiscTypeMappingList(miscMapping); if (viewBillingBasicData[0].CarefulFlag.HasValue) { ViewBag.IsSpecialCareful = viewBillingBasicData[0].CarefulFlag.Value == true ? "1" : "0"; } ViewBag.IsPaymentMethod = viewBillingBasicData[0].PaymentMethod; ViewBag.txtBillingCode = string.Format("{0}-{1}", cm.ConvertContractCode(viewBillingBasicData[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT), viewBillingBasicData[0].BillingOCC); ViewBag.txtBillingOffice = CommonUtil.TextCodeName(viewBillingBasicData[0].BillingOfficeCode, viewBillingBasicData[0].OfficeName); ViewBag.txtDebtTracingOffice = CommonUtil.TextCodeName(viewBillingBasicData[0].DebtTracingOfficeCode, viewBillingBasicData[0].DebtTracingOfficeName); ViewBag.txtBillingTargetCode = cm.ConvertBillingTargetCode(viewBillingBasicData[0].BillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); ViewBag.txtPreviousBillingTargetCode = cm.ConvertBillingTargetCode(viewBillingBasicData[0].PreviousBillingTargetCode, CommonUtil.CONVERT_TYPE.TO_SHORT); ViewBag.txtCustomerType = viewBillingBasicData[0].CustTypeCodeName; ViewBag.txtBillingClientNameEN = viewBillingBasicData[0].FullNameEN; ViewBag.txtBillingClientBranchNameEN = viewBillingBasicData[0].BranchNameEN; ViewBag.txtBillingClientAddressEN = viewBillingBasicData[0].AddressEN; ViewBag.txtBillingClientNameLC = viewBillingBasicData[0].FullNameLC; ViewBag.txtBillingClientBranchNameLC = viewBillingBasicData[0].BranchNameLC; ViewBag.txtBillingClientAddressLC = viewBillingBasicData[0].AddressLC; ViewBag.txtMonthlyBillingAmount = viewBillingBasicData[0].TextTransferMonthlyBillingAmount; //ViewBag.txtMonthlyBillingAmount = CommonUtil.TextNumeric(viewBillingBasicData[0].MonthlyBillingAmount); ViewBag.txtPaymentMethod = viewBillingBasicData[0].PaymentMethodName; ViewBag.txtBillingCycle = CommonUtil.TextNumeric(viewBillingBasicData[0].BillingCycle, 0); ViewBag.txtCreditTerm = CommonUtil.TextNumeric(viewBillingBasicData[0].CreditTerm); ViewBag.txtCalculationDailyFee = viewBillingBasicData[0].CalDailyFeeStatusName; ViewBag.txtLastBillingDate = CommonUtil.TextDate(viewBillingBasicData[0].LastBillingDate); ViewBag.txtManagementCodeForSortDetails = viewBillingBasicData[0].SortingType; ViewBag.txtAdjustEndingDateOfBillingPeriod = CommonUtil.TextDate(viewBillingBasicData[0].AdjustEndDate); ViewBag.txtBillingFlag = viewBillingBasicData[0].StopBillingFlagCodeName; ViewBag.txtVATUnchargedBillingTarget = viewBillingBasicData[0].VATUnchargedFlag.HasValue ? viewBillingBasicData[0].VATUnchargedFlag.Value : false; ViewBag.txtBalanceOfDepositFee = viewBillingBasicData[0].TextTransferBalanceDeposit; //ViewBag.txtBalanceOfDepositFee = CommonUtil.TextNumeric(viewBillingBasicData[0].BalanceDeposit); ViewBag.txtMonthlyFeeBeforeStop = viewBillingBasicData[0].TextTransferMonthlyFeeBeforeStop; //ViewBag.txtMonthlyFeeBeforeStop = CommonUtil.TextNumeric(viewBillingBasicData[0].MonthlyFeeBeforeStop); ViewBag.txtResultBasedMaintenanceBillingFlag = viewBillingBasicData[0].ResultBasedMaintenanceFlag.HasValue ? viewBillingBasicData[0].ResultBasedMaintenanceFlag.Value : false; ViewBag.txtLastPaymentConditionChangingDate = CommonUtil.TextDate(viewBillingBasicData[0].ChangeDate); ViewBag.txtRegisteringDateOfLastChanging = CommonUtil.TextDate(viewBillingBasicData[0].ChangeDate); ViewBag.txtApproveNo = viewBillingBasicData[0].ApproveNo; ViewBag.txtDocumentReceiving = viewBillingBasicData[0].DocAuditResultName; ViewBag.txtAdjustmentType = viewBillingBasicData[0].AdjustType; ViewBag.txtAdjustBillingAmount = viewBillingBasicData[0].TextTransferAdjustBillingPeriodAmount; //ViewBag.txtAdjustBillingAmount = CommonUtil.TextNumeric(viewBillingBasicData[0].AdjustBillingPeriodAmount); ViewBag.txtAdjustBillingPeriodStartDate = CommonUtil.TextDate(viewBillingBasicData[0].AdjustBillingPeriodStartDate); ViewBag.txtAdjustBillingPeriodEndDate = CommonUtil.TextDate(viewBillingBasicData[0].AdjustBillingPeriodEndDate); ViewBag.txtIDNo = viewBillingBasicData[0].IDNo; //Add by Jutarat A. on 12122013 } if (monthlyBillingHistoryListData != null) { if (monthlyBillingHistoryListData.Count > 0) { ViewBag.txtLastMonthlyBillingAmount = monthlyBillingHistoryListData[0].TextTransferMonthlyBillingAmount; ViewBag.txtLastDate = CommonUtil.TextDate(monthlyBillingHistoryListData[0].BillingStartDate); ViewBag.txtBillingAmountBeforeChanging1 = monthlyBillingHistoryListData.Count < 2 ? null : monthlyBillingHistoryListData[1].TextTransferMonthlyBillingAmount; ViewBag.txtDateBeforeChanging1 = monthlyBillingHistoryListData.Count < 2 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[1].BillingStartDate); ViewBag.txtBillingAmountBeforeChanging2 = monthlyBillingHistoryListData.Count < 3 ? null : monthlyBillingHistoryListData[2].TextTransferMonthlyBillingAmount; ViewBag.txtDateBeforeChanging2 = monthlyBillingHistoryListData.Count < 3 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[2].BillingStartDate); ViewBag.txtBillingAmountBeforeChanging3 = monthlyBillingHistoryListData.Count < 4 ? null : monthlyBillingHistoryListData[3].TextTransferMonthlyBillingAmount; ViewBag.txtDateBeforeChanging3 = monthlyBillingHistoryListData.Count < 4 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[3].BillingStartDate); ViewBag.txtBillingAmountBeforeChanging4 = monthlyBillingHistoryListData.Count < 5 ? null : monthlyBillingHistoryListData[4].TextTransferMonthlyBillingAmount; ViewBag.txtDateBeforeChanging4 = monthlyBillingHistoryListData.Count < 5 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[4].BillingStartDate); ViewBag.txtBillingAmountBeforeChanging5 = monthlyBillingHistoryListData.Count < 6 ? null : monthlyBillingHistoryListData[5].TextTransferMonthlyBillingAmount; ViewBag.txtDateBeforeChanging5 = monthlyBillingHistoryListData.Count < 6 ? null : CommonUtil.TextDate(monthlyBillingHistoryListData[5].BillingStartDate); } } } //Finding service type code if (string.IsNullOrEmpty(strContractCode) == false) { //Rental IRentralContractHandler handlerR = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; List <tbt_RentalContractBasic> dtRentalContract = handlerR.GetTbt_RentalContractBasic(strContractCode, null); if (dtRentalContract.Count > 0) { param.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_RENTAL; ViewBag.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_RENTAL; ViewBag.ProductTypeCode = dtRentalContract[0].ProductTypeCode; } else { // Sale ISaleContractHandler handlerS = ServiceContainer.GetService <ISaleContractHandler>() as ISaleContractHandler; List <tbt_SaleBasic> dtSaleContract = handlerS.GetTbt_SaleBasic(strContractCode, null, true); if (dtSaleContract.Count > 0) { param.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; ViewBag.ServiceTypeCode = ServiceType.C_SERVICE_TYPE_SALE; ViewBag.ProductTypeCode = dtSaleContract[0].ProductTypeCode; } } } return(View()); } catch (Exception ex) { res.AddErrorMessage(ex); return(Json(res)); } }
/// <summary> /// Search incident by role when change mode to "Admistrator List Mode", "Correspondent List Mode", "Office List Mode", or "Chief List Mode" /// </summary> /// <param name="conditionByRole"></param> /// <returns></returns> public ActionResult CTS310_searchByRole(SearchIncidentListByRoleCondition conditionByRole) { ObjectResultData res = new ObjectResultData(); try { doIncidentListByRole condition = new doIncidentListByRole(); condition.incidentRole = conditionByRole.strIncidentRole; condition.incidentStatus = conditionByRole.strIncidentStatus; condition.empNo = CommonUtil.dsTransData.dtUserData.EmpNo; if (conditionByRole.intAddDate.HasValue && conditionByRole.intAddDate.Value != 0) { condition.dueDate = System.DateTime.Now.AddDays(conditionByRole.intAddDate.Value); } IIncidentHandler hand = ServiceContainer.GetService <IIncidentHandler>() as IIncidentHandler; List <dtIncidentList> incidentList = hand.GetIncidentListByRole(condition); CommonUtil.MappingObjectLanguage <dtIncidentList>(incidentList); MiscTypeMappingList miscMapList = new MiscTypeMappingList(); miscMapList.AddMiscType(incidentList.ToArray()); ICommonHandler comh = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; comh.MiscTypeMappingList(miscMapList); List <tbs_IncidentPermissionConfiguration> permissions = hand.GetTbs_IncidentPermissionConfiguration("," + conditionByRole.strIncidentRole + ","); bool canViewConfidential = false; foreach (var permission in permissions) { if (permission.ViewConfidentialIncidentFlag.HasValue && permission.ViewConfidentialIncidentFlag.Value) { canViewConfidential = true; break; } } CTS310_ScreenParameter param = GetScreenObject <CTS310_ScreenParameter>(); foreach (var incident in incidentList) { if (String.IsNullOrEmpty(incident.IncidentNo)) { incident.IncidentNo = CommonUtil.GetLabelFromResource("Contract", "CTS310", "lblNA"); } if (incident.DueDateDeadLine.HasValue) { incident.DueDateDeadLine = new DateTime(incident.DueDateDeadLine.Value.Year, incident.DueDateDeadLine.Value.Month, incident.DueDateDeadLine.Value.Day, 23, 59, 59); if (incident.DueDateTime.HasValue) { incident.DueDateDeadLine = new DateTime(incident.DueDateDeadLine.Value.Year, incident.DueDateDeadLine.Value.Month, incident.DueDateDeadLine.Value.Day, incident.DueDateTime.Value.Hours, incident.DueDateTime.Value.Minutes, incident.DueDateTime.Value.Seconds); } } if (CommonUtil.IsNullOrEmpty(incident.IncidentNo)) { incident.IncidentNo = incident.IncidentID.ToString(); } //Midify by Jutarat A. on 04032013 //incident.canViewConfidential = param.isAdmin || (!incident.ConfidentialFlag.Value) || canViewConfidential; bool blConfidentialFlag = incident.ConfidentialFlag == null ? false : incident.ConfidentialFlag.Value; incident.canViewConfidential = param.isAdmin || (!blConfidentialFlag) || canViewConfidential; //End Modify setColStyle(incident); } string xml = CommonUtil.ConvertToXml <dtIncidentList>(incidentList, "Contract\\CTS310", CommonUtil.GRID_EMPTY_TYPE.SEARCH); res.ResultData = xml; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult QUS010_XML(QUS010_SearchQuotation Cond) { QUS010_ScreenParameter param = GetScreenObject <QUS010_ScreenParameter>(); string xmlPath = "Quotation\\QUS010"; if (param.IsPopup == false) // plain screen { xmlPath = "Quotation\\QUS010_nonSel"; } ObjectResultData res = new ObjectResultData(); res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; List <View_dtSearchQuotationListResult> dtSearchQuo = new List <View_dtSearchQuotationListResult>(); try { ValidatorUtil.BuildErrorMessage(res, this, new object[] { Cond }); if (res.IsError) { res.ResultData = CommonUtil.ConvertToXml <View_dtSearchQuotationListResult>(dtSearchQuo, xmlPath, CommonUtil.GRID_EMPTY_TYPE.SEARCH); return(Json(res)); } if (Cond.QuotationDateFrom != null && Cond.QuotationDateTo != null) { if (DateTime.Compare(Convert.ToDateTime(Cond.QuotationDateFrom), Convert.ToDateTime(Cond.QuotationDateTo)) > 0) { res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; res.AddErrorMessage(MessageUtil.MODULE_QUOTATION, MessageUtil.MessageList.MSG2001, null, new string[] { "QuotationDateFrom", "QuotationDateTo" }); return(Json(res)); } } CommonUtil ComU = new CommonUtil(); Cond.QuotationTargetCode = ComU.ConvertQuotationTargetCode(Cond.QuotationTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); Cond.ContractTargetCode = ComU.ConvertCustCode(Cond.ContractTargetCode, CommonUtil.CONVERT_TYPE.TO_LONG); Cond.SiteCode = ComU.ConvertSiteCode(Cond.SiteCode, CommonUtil.CONVERT_TYPE.TO_LONG); if (!(param.CallerScreenID == ScreenID.C_SCREEN_ID_FN99 || param.CallerScreenID == ScreenID.C_SCREEN_ID_FQ99)) { Cond.ServiceTypeCode = null; Cond.TargetCodeTypeCode = null; } Cond.ContractTransferStatus = param.strContractTransferStatus; IQuotationHandler handler = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler; List <dtSearchQuotationListResult> lst = handler.SearchQuotationList(Cond); dtSearchQuo = CommonUtil.ClonsObjectList <dtSearchQuotationListResult, View_dtSearchQuotationListResult>(lst); CommonUtil.MappingObjectLanguage <View_dtSearchQuotationListResult>(dtSearchQuo); ICommonHandler hand = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; MiscTypeMappingList lstMiscMap = new MiscTypeMappingList(); lstMiscMap.AddMiscType(dtSearchQuo.ToArray()); hand.MiscTypeMappingList(lstMiscMap); res.ResultData = CommonUtil.ConvertToXml <View_dtSearchQuotationListResult>(dtSearchQuo, xmlPath, CommonUtil.GRID_EMPTY_TYPE.SEARCH); } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }