//Add MA By Pachara S. 29032017 public void CMS030_DownloadCTR950CsvReport(DateTime?GenerateDateFrom, DateTime?GenerateDateTo) { ObjectResultData res = new ObjectResultData(); IContractHandler contractHandler = ServiceContainer.GetService <IContractHandler>() as IContractHandler; var datas = contractHandler.GetUnreceivedContractDocuemntCTR095(GenerateDateFrom, GenerateDateTo); MemoryStream csv = CSVCreator.CreateCSVSteam <dtUnreceivedContractDocuemntCTR095>(datas, "Common\\CMS030_CTR095Csv"); string fName = null; if (GenerateDateFrom != null && GenerateDateTo != null) { fName = string.Format("UnreceivedContractDocuemnt_{0}-{1}.csv", GenerateDateFrom.Value.ToString("yyyyMMdd"), GenerateDateTo.Value.ToString("yyyyMMdd")); } if (GenerateDateFrom == null && GenerateDateTo == null) { fName = string.Format("UnreceivedContractDocuemnt.csv"); } if (GenerateDateFrom == null && GenerateDateTo != null) { fName = string.Format("UnreceivedContractDocuemnt_-{0}.csv", GenerateDateTo.Value.ToString("yyyyMMdd")); } if (GenerateDateFrom != null && GenerateDateTo == null) { fName = string.Format("UnreceivedContractDocuemnt_{0}-.csv", GenerateDateFrom.Value.ToString("yyyyMMdd")); } this.DownloadCSVFile(fName, csv.ToArray()); }
public ContractCreationTransactionProcessor( IGetCode getCodeProxy, IContractHandler contractHandler, ITransactionHandler transactionHandler) { _getCodeProxy = getCodeProxy; _contractHandler = contractHandler; _transactionHandler = transactionHandler; }
public ContractCreationTransactionProcessor( IWeb3 web3, IContractHandler contractHandler, ITransactionHandler transactionHandler) { _getCodeProxy = web3.Eth.GetCode; _contractHandler = contractHandler; _transactionHandler = transactionHandler; }
public ContractTransactionProcessor( IWeb3 web3, IVmStackErrorChecker vmStackErrorChecker, IContractHandler contractHandler, ITransactionHandler transactionHandler, ITransactionVMStackHandler transactionVmStackHandler) { _web3 = web3; _vmStackErrorChecker = vmStackErrorChecker; _contractHandler = contractHandler; _transactionHandler = transactionHandler; _transactionVmStackHandler = transactionVmStackHandler; }
public ContractTransactionProcessor( IGetTransactionVMStack vmStackProxy, IVmStackErrorChecker vmStackErrorChecker, IContractHandler contractHandler, ITransactionHandler transactionHandler, ITransactionVMStackHandler transactionVmStackHandler) { _vmStackProxy = vmStackProxy; _vmStackErrorChecker = vmStackErrorChecker; _contractHandler = contractHandler; _transactionHandler = transactionHandler; _transactionVmStackHandler = transactionVmStackHandler; }
/// <summary> /// To check whether all contract have the same site /// </summary> /// <param name="contracts"></param> /// <returns></returns> public bool IsSameSite(List <string> contracts) { bool bSameSite = true; try { if (contracts != null & contracts.Count > 1) { //Prepare ContarctCode data StringBuilder sb = new StringBuilder(""); String contractCodeList = string.Empty; foreach (string contract in contracts) { sb.AppendFormat("\'{0}\',", contract); } if (sb.Length > 0) { contractCodeList = sb.Remove(sb.Length - 1, 1).ToString(); } //1. Get site of rental contract & 2. Get site of sale contract IContractHandler hand = ServiceContainer.GetService <IContractHandler>() as IContractHandler; List <dsGetSiteContractList> list = hand.GetSiteContractList(contractCodeList, FlagType.C_FLAG_ON); //3. Check site of all contract codes if (list != null && list.Count > 0) { string strSite = list[0].SiteCode; foreach (dsGetSiteContractList site in list) { if (site.SiteCode != strSite) { bSameSite = false; return(bSameSite); } } } } } catch (Exception) { throw; } return(bSameSite); }
///<summary> ///Purpose : Get product type (How does the system performs if the quotation prefix is null) ///Parameters: strProductTypeCode = 7 ///Expected : MSG3022: Cannot generate the contract code. Contract prefix does not exist. ///</summary> public string Case2() { IContractHandler target = ServiceContainer.GetService <IContractHandler>() as IContractHandler; string strProductTypeCode = "7"; string expected = "MSG3022"; string actual; try { actual = target.GenerateContractCode(strProductTypeCode); } catch (ApplicationErrorException ex) { actual = ex.ErrorResult.Message.Code; } catch (Exception ex) { actual = ex.StackTrace; } return(string.Format(RESULT_FORMAT, 2, expected, actual, CompareResult_String(expected, actual))); }
///<summary> ///Purpose : Generate contract code for maintenane ///Parameters: strProductTypeCode = 6 ///Expected : Return contract code that is MA000000006x. ///</summary> public string Case9() { IContractHandler target = ServiceContainer.GetService <IContractHandler>() as IContractHandler; string strProductTypeCode = "6"; string expected = "MA000000006x"; string actual; string com_actual = string.Empty; try { actual = target.GenerateContractCode(strProductTypeCode); com_actual = actual.Substring(0, actual.Length - 1) + "x"; } catch (ApplicationErrorException ex) { actual = ex.ErrorResult.Message.Code; } catch (Exception ex) { actual = ex.StackTrace; } return(string.Format(RESULT_FORMAT, 9, expected, actual, CompareResult_String(expected, com_actual))); }
public doBatchProcessResult WorkProcess(string UserId, DateTime BatchDate) { IContractHandler handler = ServiceContainer.GetService <IContractHandler>() as IContractHandler; return(handler.SendNotifyEmailForChangeFee(UserId, BatchDate)); }
/// <summary> /// To check maintenance target contract /// </summary> /// <param name="strContractCode"></param> /// <param name="strQuotationTargetCode"></param> /// <returns></returns> public doContractHeader CheckMaintenanceTargetContract(string strContractCode, string strQuotationTargetCode) { doContractHeader headerDo = new doContractHeader(); try { //1. Get rental contract & 2. Get sale contract IContractHandler hand = ServiceContainer.GetService <IContractHandler>() as IContractHandler; List <dtGetMaintenanceTargetContract> contractList = hand.GetMaintenanceTargetContract(strContractCode, FlagType.C_FLAG_ON); //6. Check contract data if (contractList != null && contractList.Count > 0) { CommonUtil cmm = new CommonUtil(); string contractCode = cmm.ConvertContractCode(strContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); string strProductTypeCode = contractList[0].ProductTypeCode; string strContractStatus = (contractList[0].ContractStatus != null) ? contractList[0].ContractStatus.Trim() : contractList[0].ContractStatus; if (strProductTypeCode != ProductType.C_PROD_TYPE_SALE && strProductTypeCode != ProductType.C_PROD_TYPE_AL && strProductTypeCode != ProductType.C_PROD_TYPE_ONLINE && strProductTypeCode != ProductType.C_PROD_TYPE_RENTAL_SALE) { throw ApplicationErrorException.ThrowErrorException( MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3118, new string[] { contractCode }); } if (CommonUtil.dsTransData.dtTransHeader.ScreenID != ScreenID.C_SCREEN_ID_QTN_DETAIL) { if (strContractStatus == ContractStatus.C_CONTRACT_STATUS_BEF_START) { throw ApplicationErrorException.ThrowErrorException( MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3119, new string[] { contractCode }); } } if (strContractStatus == ContractStatus.C_CONTRACT_STATUS_STOPPING) { throw ApplicationErrorException.ThrowErrorException( MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3044, new string[] { contractCode }); } if (strContractStatus == ContractStatus.C_CONTRACT_STATUS_CANCEL || strContractStatus == ContractStatus.C_CONTRACT_STATUS_END) { throw ApplicationErrorException.ThrowErrorException( MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3105, new string[] { contractCode }); } if (strContractStatus == ContractStatus.C_CONTRACT_STATUS_FIXED_CANCEL) { throw ApplicationErrorException.ThrowErrorException( MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3116, new string[] { contractCode }); } List <tbt_RelationType> relationTypeList = base.CheckRelationType(strContractCode , ContractStatus.C_CONTRACT_STATUS_END , ContractStatus.C_CONTRACT_STATUS_CANCEL , ContractStatus.C_CONTRACT_STATUS_FIXED_CANCEL , strQuotationTargetCode , null); // , (strProductTypeCode == ProductType.C_PROD_TYPE_SALE? RelationType.C_RELATION_TYPE_SALE : RelationType.C_RELATION_TYPE_MA)); if (relationTypeList != null && relationTypeList.Count > 0) { CommonUtil c = new CommonUtil(); /* --- Merge --- */ /* throw ApplicationErrorException.ThrowErrorException( * MessageUtil.MODULE_CONTRACT, * MessageUtil.MessageList.MSG3120, * c.ConvertContractCode(strContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT), * c.ConvertContractCode(relationTypeList[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT) * ); */ throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_CONTRACT, MessageUtil.MessageList.MSG3120, contractCode, c.ConvertContractCode(relationTypeList[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT)); /* ------------- */ } //7. Map dtContractData to doContractHeader contractList = CommonUtil.ConvertObjectbyLanguage <dtGetMaintenanceTargetContract, dtGetMaintenanceTargetContract>(contractList, "ProductName"); headerDo.ContractCode = contractList[0].ContractCode; headerDo.CreateDate = contractList[0].CreateDate; headerDo.ProductCode = contractList[0].ProductCode; headerDo.ProductName = contractList[0].ProductName; headerDo.ProductNameEN = contractList[0].ProductNameEN; headerDo.ProductNameJP = contractList[0].ProductNameJP; headerDo.ProductNameLC = contractList[0].ProductNameLC; headerDo.ProductTypeCode = contractList[0].ProductTypeCode; /* --- Merge --- */ headerDo.SiteCode = contractList[0].SiteCode; /* ------------- */ } else { CommonUtil c = new CommonUtil(); throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0105, c.ConvertContractCode(strContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT)); } } catch (Exception) { throw; } return(headerDo); }
public ActionResult CTP060_UpdateEmailContentOfNotifyEmail() { ObjectResultData res = new ObjectResultData(); IContractHandler conHandler = ServiceContainer.GetService <IContractHandler>() as IContractHandler; IRentralContractHandler rentalConHandler = ServiceContainer.GetService <IRentralContractHandler>() as IRentralContractHandler; IMasterHandler masterHandler = ServiceContainer.GetService <IMasterHandler>() as IMasterHandler; IEmployeeMasterHandler empMasterHandler = ServiceContainer.GetService <IEmployeeMasterHandler>() as IEmployeeMasterHandler; IBillingMasterHandler billingmasterhandler = ServiceContainer.GetService <IBillingMasterHandler>() as IBillingMasterHandler; IOfficeMasterHandler officehandler = ServiceContainer.GetService <IOfficeMasterHandler>() as IOfficeMasterHandler; IBillingHandler billinghandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; List <tbm_Customer> dtCustomer; List <doGetTbm_Site> dtSite; List <tbm_Employee> dtEmployee; decimal?contractFeeBeforeChange; decimal?ChangeContractFee; try { CommonUtil comUtil = new CommonUtil(); doNotifyChangeFeeContract doNotifyEmail = new doNotifyChangeFeeContract(); List <tbt_ContractEmail> updateContractEmailList = new List <tbt_ContractEmail>(); using (TransactionScope scope = new TransactionScope()) { List <tbt_ContractEmail> contractEmailList = conHandler.GetUnsentNotifyEmail(); foreach (tbt_ContractEmail data in contractEmailList) { List <tbt_BillingBasic> doBillingBasic = billinghandler.GetTbt_BillingBasic(data.ContractCode, "01"); List <tbt_BillingTarget> doBillingTarget = billinghandler.GetTbt_BillingTarget(doBillingBasic[0].BillingTargetCode, null, null); dsRentalContractData dsRentalContract = rentalConHandler.GetEntireContract(data.ContractCode, data.OCC); if (dsRentalContract.dtTbt_RentalSecurityBasic[0].ReturnToOriginalFeeDate != null) { var operationOfficeDat = officehandler.GetTbm_Office(dsRentalContract.dtTbt_RentalContractBasic[0].OperationOfficeCode); var billingOfficeDat = officehandler.GetTbm_Office(doBillingTarget[0].BillingOfficeCode); EmailTemplateUtil mailUtil = new EmailTemplateUtil(EmailTemplateName.C_EMAIL_TEMPLATE_NAME_CHANGE_FEE); dtCustomer = masterHandler.GetTbm_Customer(dsRentalContract.dtTbt_RentalContractBasic[0].ContractTargetCustCode); dtSite = masterHandler.GetTbm_Site(dsRentalContract.dtTbt_RentalContractBasic[0].SiteCode); dtEmployee = empMasterHandler.GetTbm_Employee(data.CreateBy); contractFeeBeforeChange = rentalConHandler.GetContractFeeBeforeChange(dsRentalContract.dtTbt_RentalContractBasic[0].ContractCode, dsRentalContract.dtTbt_RentalSecurityBasic[0].OCC, dsRentalContract); doNotifyEmail.ContractCode = comUtil.ConvertContractCode(dsRentalContract.dtTbt_RentalContractBasic[0].ContractCode, CommonUtil.CONVERT_TYPE.TO_SHORT); doNotifyEmail.ContractTargetNameEN = dtCustomer[0].CustFullNameEN; doNotifyEmail.ContractTargetNameLC = dtCustomer[0].CustFullNameLC; doNotifyEmail.SiteNameEN = dtSite[0].SiteNameEN; doNotifyEmail.SiteNameLC = dtSite[0].SiteNameLC; doNotifyEmail.ChangeDateOfContractFee = CommonUtil.TextDate(dsRentalContract.dtTbt_RentalSecurityBasic[0].ChangeImplementDate); doNotifyEmail.ContractFeeBeforeChange = CommonUtil.TextNumeric(contractFeeBeforeChange); if (dsRentalContract.dtTbt_RentalContractBasic[0].ContractStatus == ContractStatus.C_CONTRACT_STATUS_STOPPING) { ChangeContractFee = dsRentalContract.dtTbt_RentalSecurityBasic[0].ContractFeeOnStop; } else { ChangeContractFee = dsRentalContract.dtTbt_RentalSecurityBasic[0].OrderContractFee; } doNotifyEmail.ContractFeeAfterChange = CommonUtil.TextNumeric(ChangeContractFee); doNotifyEmail.ReturnToOriginalFeeDate = CommonUtil.TextDate(dsRentalContract.dtTbt_RentalSecurityBasic[0].ReturnToOriginalFeeDate); doNotifyEmail.OperationOfficeEN = operationOfficeDat[0].OfficeNameEN; doNotifyEmail.OperationOfficeLC = operationOfficeDat[0].OfficeNameLC; doNotifyEmail.RegisterChangeEmpNameEN = dtEmployee[0].EmpFirstNameEN + ' ' + dtEmployee[0].EmpLastNameEN; doNotifyEmail.RegisterChangeEmpNameLC = dtEmployee[0].EmpFirstNameLC + ' ' + dtEmployee[0].EmpLastNameLC; doNotifyEmail.BillingOfficeEN = billingOfficeDat[0].OfficeNameEN; doNotifyEmail.BillingOfficeLC = billingOfficeDat[0].OfficeNameLC; var mailTemplate = mailUtil.LoadTemplate(doNotifyEmail); data.EmailContent = mailTemplate.TemplateContent; tbt_ContractEmail conEmailTemp = CommonUtil.CloneObject <tbt_ContractEmail, tbt_ContractEmail>(data); updateContractEmailList.Add(conEmailTemp); } } if (updateContractEmailList != null && updateContractEmailList.Count > 0) { conHandler.UpdateTbt_ContractEmail(updateContractEmailList); } scope.Complete(); } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }