public IHttpActionResult GetStoreDetails(string usCode, string eid) { //var resultStoreAllInfo = storeBll.GetStoreDetailsByEID(eid, usCode); var resultStoreAllInfo = StoreBasicInfo.GetStore(usCode); return(Ok(resultStoreAllInfo)); }
public IHttpActionResult GetOnline(string projectID) { var closure = ClosureInfo.GetByProjectId(projectID); var store = StoreBasicInfo.GetStore(closure.USCode); var toolEntity = ClosureTool.Get(closure.ProjectId); var woEntity = ClosureWOCheckList.Get(closure.ProjectId); List <StoreBEInfo> remoteBeList = new List <StoreBEInfo>(); List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>(); StoreBEInfo mds = null; StoreBEInfo mcCafe = null; StoreBEInfo hour24 = null; if (store.StoreBEInfoList.Count > 0) { foreach (var beInfo in store.StoreBEInfoList) { switch (beInfo.BETypeName) { case "Remote Kiosk": remoteBeList.Add(beInfo); break; case "Attach Kiosk": attachedBeList.Add(beInfo); break; case "MDS": mds = beInfo; break; case "McCafe": mcCafe = beInfo; break; case "24 Hour": hour24 = beInfo; break; } } } return(Ok(new { Store = store, ClosureTool = toolEntity, WOCheckList = woEntity, RemoteBeList = remoteBeList, AttachedBeList = attachedBeList, MDS = mds, McCafe = mcCafe, Hour24 = hour24 })); }
private string GenPrintReimageAttachment(ReimageInfo reimageInfo, ReimagePackage entity, PrintFileType fileType) { var storeInfo = StoreBasicInfo.GetStore(reimageInfo.USCode); StoreBasicInfo store = storeInfo.StoreBasicInfo; //生成Print文件 var printDic = new Dictionary <string, string>(); printDic.Add("WorkflowName", FlowCode.Reimage); printDic.Add("ProjectID", entity.ProjectId); printDic.Add("USCode", reimageInfo.USCode); printDic.Add("Region", store.RegionENUS); printDic.Add("Market", store.MarketENUS); printDic.Add("City", store.CityENUS); printDic.Add("AddressZHCN", store.AddressZHCN); printDic.Add("OpenDate", store.OpenDate.ToString("yyyy-MM-dd")); if (store.CloseDate.HasValue && store.CloseDate.Value.Year == 1900) { printDic.Add("ClosureDate", string.Empty); } else { printDic.Add("ClosureDate", store.CloseDate.HasValue ? (store.CloseDate.Value.ToString("yyyy-MM-dd")) : ""); } printDic.Add("AssetsManager", storeInfo.StoreDevelop.AssetMgrName); printDic.Add("AssetsRep", storeInfo.StoreDevelop.AssetRepName); printDic.Add("StoreAge", (DateTime.Now.Year - store.OpenDate.Year).ToString()); var currentLeaseENDYear = storeInfo.CurrentYear - int.Parse(storeInfo.StoreContractInfo.EndYear); printDic.Add("CurrentLeaseENDYear", currentLeaseENDYear.ToString()); printDic.Add("StoreNameEN", store.NameENUS); printDic.Add("StoreNameCN", store.NameENUS); var RmgSummaryentity = ReimageSummary.FirstOrDefault(e => e.ProjectId.Equals(entity.ProjectId) && e.IsHistory == false); var financialPreanalysis = FinancialPreanalysis.FirstOrDefault(e => e.RefId.Equals(RmgSummaryentity.Id)); printDic.Add("SalesBuildingInvestment", financialPreanalysis.SalesBuildingInvestment); printDic.Add("NoneSalesBuildingInvst", financialPreanalysis.NoneSalesBuildingInvst); printDic.Add("TTMSales", financialPreanalysis.TTMSales.HasValue ? Math.Round(financialPreanalysis.TTMSales.Value, 2).ToString() : string.Empty); var reimage = ReimageConsInfo.GetConsInfo(entity.ProjectId, ""); ReinvestmentCost reinCost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimage.Id); printDic.Add("TotalReinvestmentNorm", reinCost.TotalReinvestmentNorm); printDic.Add("TotalSalesInc", financialPreanalysis.TotalSalesInc); printDic.Add("ROI", financialPreanalysis.ROI); ////printDic.Add("SalesInc", financialPreanalysis.ROI); printDic.Add("PaybackYears", financialPreanalysis.PaybackYears); printDic.Add("StoreCM", financialPreanalysis.StoreCM); printDic.Add("EstimatedWriteOffCost", financialPreanalysis.EstimatedWriteOffCost); printDic.Add("MarginInc", financialPreanalysis.MarginInc); printDic.Add("ISDWIP", financialPreanalysis.ISDWIP); printDic.Add("CurrStorePricingTier", financialPreanalysis.CurrentPriceTier); printDic.Add("SPTAR", financialPreanalysis.SPTAR); //Submission and Approval Records - 只显示通过意见 List <SubmissionApprovalRecord> recordList = new List <SubmissionApprovalRecord>(); //Submission and Approval Records Details — 所有意见 List <SubmissionApprovalRecord> recordDetailList = new List <SubmissionApprovalRecord>(); ProjectComment projectCommentBll = new ProjectComment(); ProjectCommentCondition condition = new ProjectCommentCondition(); var package = ReimagePackage.Get(entity.ProjectId); condition.RefTableName = ReimagePackage.TableName; condition.RefTableId = entity.Id; condition.SourceCode = FlowCode.Reimage; var commentList = VProjectComment.SearchVListForPDF(condition); var commentDetailList = VProjectComment.SearchVList(condition); SubmissionApprovalRecord record = null; foreach (var item in commentList) { record = new SubmissionApprovalRecord(); record.ActionName = item.ActionDesc; if (item.CreateTime != null) { record.OperationDate = item.CreateTime.Value; } record.OperatorID = item.UserAccount; record.OperatorName = item.UserNameENUS; record.OperatorTitle = item.PositionName; record.Comments = item.Content; recordList.Add(record); } foreach (var item in commentDetailList) { record = new SubmissionApprovalRecord(); record.ActionName = item.ActionDesc; if (item.CreateTime != null) { record.OperationDate = item.CreateTime.Value; } record.OperatorID = item.UserAccount; record.OperatorName = item.UserNameENUS; record.OperatorTitle = item.PositionName; record.Comments = item.Content; recordDetailList.Add(record); } string result = string.Empty; if (fileType == PrintFileType.Pdf) { result = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList); } else { result = HtmlConversionUtility.ConvertToImage(HtmlTempalteType.Reimage, printDic, recordList, recordDetailList); } return(result); }
public IHttpActionResult DownLoadTemplate(string projectID) { var current = System.Web.HttpContext.Current; string path = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Executive_Summary_Template; string tempFilePath = current.Server.MapPath("~/") + "Temp\\" + Guid.NewGuid() + ".xlsx"; File.Copy(path, tempFilePath); var fileInfo = new FileInfo(tempFilePath); var excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ClosureExecutiveSummary); var closure = ClosureInfo.GetByProjectId(projectID); var store = StoreBasicInfo.GetStore(closure.USCode); var inputInfo = new ExcelInputDTO { StoreNameCN = store.StoreBasicInfo.NameZHCN, USCode = store.StoreBasicInfo.StoreCode, City = store.StoreBasicInfo.CityENUS, Market = store.StoreBasicInfo.MarketENUS, OpenDate = store.StoreBasicInfo.OpenDate, Floor = store.StoreSTLocation.Floor, TotalArea = store.StoreSTLocation.TotalArea, TotalSeatsNo = store.StoreSTLocation.TotalSeatsNo, BE = store.StoreBEInfoList.Count, RentType = store.StoreContractInfo.RentType, RentStructure = store.StoreContractInfo.RentStructure }; var leaseRecapID = StoreContractInfo.SearchByProject(projectID).FirstOrDefault().LeaseRecapID ?? 0; var storeAtt = StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).OrderByDescending(e => e.CreateDate).FirstOrDefault(); if (storeAtt != null) { inputInfo.LeasingTerm = store.StoreContractInfo.LeasePurchaseTerm; } if (store.StoreContractInfo.RentCommencementDate.HasValue) { inputInfo.RentCommencementDate = store.StoreContractInfo.RentCommencementDate.Value; } if (store.StoreContractInfo.EndDate.HasValue) { inputInfo.LeaseExpirationDate = store.StoreContractInfo.EndDate.Value; } var toolEntity = ClosureTool.Get(closure.ProjectId); if (toolEntity != null) { if (toolEntity.TotalSales_Adjustment_RMB != null) { inputInfo.TotalSales_TTM = string.Format("{0:f}", toolEntity.TotalSales_Adjustment_RMB); } if (toolEntity.CompSales_Adjustment != null) { inputInfo.SalesComp_TTM = string.Format("{0:f}", toolEntity.CompSales_Adjustment); } if (toolEntity.CompCG_Adjustment != null) { inputInfo.GCComp_TTM = string.Format("{0:f}", toolEntity.CompCG_Adjustment); } if (toolEntity.PAC_RMB_Adjustment != null) { inputInfo.PAC_TTM = string.Format("{0:f}", toolEntity.PAC_RMB_Adjustment); } if (toolEntity.SOI_Adjustment != null) { inputInfo.SOI_TTM = string.Format("{0:f}", toolEntity.SOI_Adjustment); } if (toolEntity.CashFlow_RMB_Adjustment != null) { inputInfo.CASHFLOW_TTM = string.Format("{0:f}", toolEntity.CashFlow_RMB_Adjustment); } if (toolEntity.TotalSales_TTMY1 != null) { inputInfo.TotalSales_TTMY1 = string.Format("{0:f}", toolEntity.TotalSales_TTMY1); } if (toolEntity.CompSales_TTMY1 != null) { inputInfo.CompSales_TTMY1 = string.Format("{0:f}", toolEntity.CompSales_TTMY1); } if (toolEntity.CompGC_TTMY1 != null) { inputInfo.CompGC_TTMY1 = string.Format("{0:f}", toolEntity.CompGC_TTMY1); } if (toolEntity.PAC_TTMY1 != null) { inputInfo.PAC_TTMY1 = string.Format("{0:f}", toolEntity.PAC_TTMY1); } if (toolEntity.SOI_TTMY1 != null) { inputInfo.SOI_TTMY1 = string.Format("{0:f}", toolEntity.SOI_TTMY1); } if (toolEntity.CashFlow_TTMY1 != null) { inputInfo.CashFlow_TTMY1 = string.Format("{0:f}", toolEntity.CashFlow_TTMY1); } if (toolEntity.TotalSales_TTMY2 != null) { inputInfo.TotalSales_TTMY2 = string.Format("{0:f}", toolEntity.TotalSales_TTMY2); } if (toolEntity.CompSales_TTMY2 != null) { inputInfo.CompSales_TTMY2 = string.Format("{0:f}", toolEntity.CompSales_TTMY2); } if (toolEntity.CompGC_TTMY2 != null) { inputInfo.CompGC_TTMY2 = string.Format("{0:f}", toolEntity.CompGC_TTMY2); } if (toolEntity.PAC_TTMY2 != null) { inputInfo.PAC_TTMY2 = string.Format("{0:f}", toolEntity.PAC_TTMY2); } if (toolEntity.SOI_TTMY2 != null) { inputInfo.SOI_TTMY2 = string.Format("{0:f}", toolEntity.SOI_TTMY2); } if (toolEntity.CashFlow_TTMY2 != null) { inputInfo.CashFlow_TTMY2 = string.Format("{0:f}", toolEntity.CashFlow_TTMY2); } List <StoreBEInfo> remoteBeList = new List <StoreBEInfo>(); List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>(); StoreBEInfo mds = null; StoreBEInfo mcCafe = null; StoreBEInfo hour24 = null; if (store.StoreBEInfoList.Count > 0) { foreach (var beInfo in store.StoreBEInfoList) { switch (beInfo.BETypeName) { case "Remote Kiosk": remoteBeList.Add(beInfo); break; case "Attached Kiosk": attachedBeList.Add(beInfo); break; case "MDS": mds = beInfo; break; case "McCafe": mcCafe = beInfo; break; case "24 Hour": hour24 = beInfo; break; } } } if (remoteBeList.Count > 0) { inputInfo.RemoteKiosk1_Status = remoteBeList[0].IsSingleContract == 1 ? "Yes" : "No"; inputInfo.RemoteKiosk1_OpenDate = remoteBeList[0].LaunchDate; if (remoteBeList.Count > 1) { inputInfo.RemoteKiosk2_Status = remoteBeList[1].IsSingleContract == 1 ? "Yes" : "No"; inputInfo.RemoteKiosk2_OpenDate = remoteBeList[1].LaunchDate; if (remoteBeList.Count > 2) { inputInfo.RemoteKiosk3_Status = remoteBeList[2].IsSingleContract == 1 ? "Yes" : "No"; inputInfo.RemoteKiosk3_OpenDate = remoteBeList[2].LaunchDate; } } } if (attachedBeList.Count > 0) { inputInfo.AttachedKiosk1_Status = attachedBeList[0].IsSingleContract == 1 ? "Yes" : "No"; inputInfo.AttachedKiosk1_OpenDate = attachedBeList[0].LaunchDate; if (attachedBeList.Count > 1) { inputInfo.AttachedKiosk2_Status = attachedBeList[1].IsSingleContract == 1 ? "Yes" : "No"; inputInfo.AttachedKiosk2_OpenDate = attachedBeList[1].LaunchDate; if (attachedBeList.Count > 2) { inputInfo.AttachedKiosk3_Status = attachedBeList[2].IsSingleContract == 1 ? "Yes" : "No"; inputInfo.AttachedKiosk3_OpenDate = attachedBeList[2].LaunchDate; } } } if (mds != null) { inputInfo.MDS_Status = mds.IsSingleContract == 1 ? "Yes" : "No"; inputInfo.MDS_OpenDate = mds.LaunchDate; } if (mcCafe != null) { inputInfo.McCafe_Status = mcCafe.IsSingleContract == 1 ? "Yes" : "No"; inputInfo.McCafe_OpenDate = mcCafe.LaunchDate; } if (hour24 != null) { inputInfo.TwentyFourHour_Status = hour24.IsSingleContract == 1 ? "Yes" : "No"; inputInfo.TwentyFourHour_OpenDate = hour24.LaunchDate; } var woEntity = ClosureWOCheckList.Get(closure.ProjectId); if (woEntity != null) { if (woEntity.LHI_NBV != null) { inputInfo.LHI_NBV = string.Format("{0:f}", woEntity.LHI_NBV); } if (woEntity.ESSD_NBV != null) { inputInfo.ESSD_NBV = string.Format("{0:f}", woEntity.ESSD_NBV); } if (woEntity.TotalCost_NBV != null) { inputInfo.TotalCost_NBV = string.Format("{0:f}", woEntity.TotalCost_NBV); } } } excelDirector.Input(inputInfo); current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + DataConverter.ToHexString(SiteFilePath.Executive_Summary_Template)); current.Response.ContentType = "application/octet-stream"; current.Response.WriteFile("" + tempFilePath + ""); current.Response.End(); return(Ok()); }
public IHttpActionResult GenExecutiveSummaty(ClosureExecutiveSummary entity) { if (!ClosureExecutiveSummary.Any(i => i.ProjectId == entity.ProjectId && i.IsHistory == false)) { if (entity.Id == Guid.Empty || entity.Id == null) { entity.Id = Guid.NewGuid(); } entity.CreateTime = DateTime.Now; entity.CreatorAccount = ClientCookie.UserCode; ClosureExecutiveSummary.Add(entity); } else { ClosureExecutiveSummary.Update(entity); } var current = System.Web.HttpContext.Current; string path = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Executive_Summary_Template; string internalFileName = Guid.NewGuid() + ".xlsx"; string filePath = SiteFilePath.UploadFiles_DIRECTORY + "\\" + internalFileName; File.Copy(path, filePath); var fileInfo = new FileInfo(filePath); var excelPMTDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ClosureExecutiveSummary); var closure = ClosureInfo.GetByProjectId(entity.ProjectId); var store = StoreBasicInfo.GetStore(closure.USCode); var inputInfo = new ExcelInputDTO { StoreNameCN = store.StoreBasicInfo.NameZHCN, USCode = store.StoreBasicInfo.StoreCode, City = store.StoreBasicInfo.CityENUS, Market = store.StoreBasicInfo.MarketENUS, OpenDate = store.StoreBasicInfo.OpenDate, Floor = store.StoreSTLocation.Floor, TotalArea = store.StoreSTLocation.TotalArea, TotalSeatsNo = store.StoreSTLocation.TotalSeatsNo, BE = store.StoreBEInfoList.Count, RentType = store.StoreContractInfo.RentType, RentStructure = store.StoreContractInfo.RentStructure, MiniMarket = entity.MiniMarket, StoreLocation = entity.StoreLocation, CurrentSituation = entity.CurrentSituation, NegotiationHistory = entity.NegotiationHistory, ProposedSolution = entity.ProposedSolution, SalesTransfer = entity.SalesTransfer }; var leaseRecapID = StoreContractInfo.SearchByProject(entity.ProjectId).FirstOrDefault().LeaseRecapID ?? 0; var storeAtt = StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).OrderByDescending(e => e.CreateDate).FirstOrDefault(); if (storeAtt != null) { inputInfo.LeasingTerm = store.StoreContractInfo.LeasePurchaseTerm; } if (store.StoreContractInfo.RentCommencementDate.HasValue) { inputInfo.RentCommencementDate = store.StoreContractInfo.RentCommencementDate.Value; } if (store.StoreContractInfo.EndDate.HasValue) { inputInfo.LeaseExpirationDate = store.StoreContractInfo.EndDate.Value; } var toolEntity = ClosureTool.Get(closure.ProjectId); if (toolEntity != null) { if (toolEntity.TotalSales_Adjustment_RMB != null) { inputInfo.TotalSales_TTM = string.Format("{0:f}", toolEntity.TotalSales_Adjustment_RMB); } if (toolEntity.CompSales_Adjustment != null) { inputInfo.SalesComp_TTM = string.Format("{0:f}", toolEntity.CompSales_Adjustment); } if (toolEntity.CompCG_Adjustment != null) { inputInfo.GCComp_TTM = string.Format("{0:f}", toolEntity.CompCG_Adjustment); } if (toolEntity.PAC_Adjustment != null) { inputInfo.PAC_TTM = string.Format("{0:f}", toolEntity.PAC_Adjustment); } if (toolEntity.SOI_Adjustment != null) { inputInfo.SOI_TTM = string.Format("{0:f}", toolEntity.SOI_Adjustment); } if (toolEntity.CashFlow_RMB_Adjustment != null) { inputInfo.CASHFLOW_TTM = string.Format("{0:f}", toolEntity.CashFlow_RMB_Adjustment); } if (toolEntity.TotalSales_TTMY1 != null) { inputInfo.TotalSales_TTMY1 = string.Format("{0:f}", toolEntity.TotalSales_TTMY1); } if (toolEntity.CompSales_TTMY1 != null) { inputInfo.CompSales_TTMY1 = string.Format("{0:f}", toolEntity.CompSales_TTMY1); } if (toolEntity.CompGC_TTMY1 != null) { inputInfo.CompGC_TTMY1 = string.Format("{0:f}", toolEntity.CompGC_TTMY1); } if (toolEntity.PAC_TTMY1 != null) { inputInfo.PAC_TTMY1 = string.Format("{0:f}", toolEntity.PAC_TTMY1); } if (toolEntity.SOI_TTMY1 != null) { inputInfo.SOI_TTMY1 = string.Format("{0:f}", toolEntity.SOI_TTMY1); } if (toolEntity.CashFlow_TTMY1 != null) { inputInfo.CashFlow_TTMY1 = string.Format("{0:f}", toolEntity.CashFlow_TTMY1); } if (toolEntity.TotalSales_TTMY2 != null) { inputInfo.TotalSales_TTMY2 = string.Format("{0:f}", toolEntity.TotalSales_TTMY2); } if (toolEntity.CompSales_TTMY2 != null) { inputInfo.CompSales_TTMY2 = string.Format("{0:f}", toolEntity.CompSales_TTMY2); } if (toolEntity.CompGC_TTMY2 != null) { inputInfo.CompGC_TTMY2 = string.Format("{0:f}", toolEntity.CompGC_TTMY2); } if (toolEntity.PAC_TTMY2 != null) { inputInfo.PAC_TTMY2 = string.Format("{0:f}", toolEntity.PAC_TTMY2); } if (toolEntity.SOI_TTMY2 != null) { inputInfo.SOI_TTMY2 = string.Format("{0:f}", toolEntity.SOI_TTMY2); } if (toolEntity.CashFlow_TTMY2 != null) { inputInfo.CashFlow_TTMY2 = string.Format("{0:f}", toolEntity.CashFlow_TTMY2); } List <StoreBEInfo> remoteBeList = new List <StoreBEInfo>(); List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>(); StoreBEInfo mds = null; StoreBEInfo mcCafe = null; StoreBEInfo hour24 = null; if (store.StoreBEInfoList.Count > 0) { foreach (var beInfo in store.StoreBEInfoList) { switch (beInfo.BETypeName) { case "Remote Kiosk": remoteBeList.Add(beInfo); break; case "Attach Kiosk": attachedBeList.Add(beInfo); break; case "MDS": mds = beInfo; break; case "McCafe": mcCafe = beInfo; break; case "24 Hour": hour24 = beInfo; break; } } } inputInfo.RemoteKiosk1_Status = "No"; inputInfo.RemoteKiosk2_Status = "No"; inputInfo.RemoteKiosk3_Status = "No"; inputInfo.AttachedKiosk1_Status = "No"; inputInfo.AttachedKiosk2_Status = "No"; inputInfo.AttachedKiosk3_Status = "No"; inputInfo.MDS_Status = "No"; inputInfo.McCafe_Status = "No"; inputInfo.TwentyFourHour_Status = "No"; if (remoteBeList.Count > 0) { inputInfo.RemoteKiosk1_Status = "Yes"; inputInfo.RemoteKiosk1_OpenDate = remoteBeList[0].LaunchDate; if (remoteBeList.Count > 1) { inputInfo.RemoteKiosk2_Status = "Yes"; inputInfo.RemoteKiosk2_OpenDate = remoteBeList[1].LaunchDate; if (remoteBeList.Count > 2) { inputInfo.RemoteKiosk3_Status = "Yes"; inputInfo.RemoteKiosk3_OpenDate = remoteBeList[2].LaunchDate; } } } if (attachedBeList.Count > 0) { inputInfo.AttachedKiosk1_Status = "Yes"; inputInfo.AttachedKiosk1_OpenDate = attachedBeList[0].LaunchDate; if (attachedBeList.Count > 1) { inputInfo.AttachedKiosk2_Status = "Yes"; inputInfo.AttachedKiosk2_OpenDate = attachedBeList[1].LaunchDate; if (attachedBeList.Count > 2) { inputInfo.AttachedKiosk3_Status = "Yes"; inputInfo.AttachedKiosk3_OpenDate = attachedBeList[2].LaunchDate; } } } if (mds != null) { inputInfo.MDS_Status = "Yes"; inputInfo.MDS_OpenDate = mds.LaunchDate; } if (mcCafe != null) { inputInfo.McCafe_Status = "Yes"; inputInfo.McCafe_OpenDate = mcCafe.LaunchDate; } if (hour24 != null) { inputInfo.TwentyFourHour_Status = "Yes"; inputInfo.TwentyFourHour_OpenDate = hour24.LaunchDate; } var woEntity = ClosureWOCheckList.Get(closure.ProjectId); if (woEntity != null) { if (woEntity.LHI_NBV != null) { inputInfo.LHI_NBV = string.Format("{0:f}", woEntity.LHI_NBV); } if (woEntity.ESSD_NBV != null) { inputInfo.ESSD_NBV = string.Format("{0:f}", woEntity.ESSD_NBV); } if (woEntity.TotalCost_NBV != null) { inputInfo.TotalCost_NBV = string.Format("{0:f}", woEntity.TotalCost_NBV); } } } excelPMTDirector.Input(inputInfo); Attachment att = Attachment.GetAttachment("ClosureExecutiveSummary", entity.Id.ToString(), "Template"); if (att == null) { att = new Attachment(); att.RefTableName = "ClosureExecutiveSummary"; att.RefTableID = entity.Id.ToString(); att.CreateTime = DateTime.Now; att.ID = Guid.NewGuid(); att.TypeCode = "Template"; att.CreatorID = ClientCookie.UserCode; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.Name = SiteFilePath.Executive_Summary_Template; att.InternalName = internalFileName; att.Extension = fileInfo.Extension; att.Length = Convert.ToInt32(fileInfo.Length); att.RequirementId = new Guid("79258ffb-c2ef-4eff-897d-ba8376c90071"); Attachment.Add(att); } else { att.CreateTime = DateTime.Now; att.CreatorID = ClientCookie.UserCode; att.CreatorNameENUS = ClientCookie.UserNameENUS; att.CreatorNameZHCN = ClientCookie.UserNameZHCN; att.Name = SiteFilePath.Executive_Summary_Template; att.InternalName = internalFileName; att.Extension = fileInfo.Extension; att.Length = Convert.ToInt32(fileInfo.Length); att.RequirementId = new Guid("79258ffb-c2ef-4eff-897d-ba8376c90071"); Attachment.Update(att); } ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_ExecutiveSummary, NodeCode.Closure_ExecutiveSummary_Generate); return(Ok()); }
public IHttpActionResult GetStoreDetail(string usCode) { var storeInfo = StoreBasicInfo.GetStore(usCode); return(Ok(new { storeInfo })); }
public IHttpActionResult GetStoreDetails(string usCode) { var resultStoreAllInfo = StoreBasicInfo.GetStore(usCode); return(Ok(resultStoreAllInfo)); }
public static List <EmailSendingResultType> SendPackageApprovalEmail(TempClosureInfo tempClosureInfo, TempClosurePackage entity, ApproveUsers approvers) { var project = ProjectInfo.Get(entity.ProjectId, FlowCode.TempClosure_ClosurePackage); var storeBasic = StoreBasicInfo.GetStorInfo(project.USCode); var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault(); var assetMgr = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager); var assetActor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor); var assetRep = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep); var results = new List <EmailSendingResultType>(); using (EmailServiceClient emailClient = new EmailServiceClient()) { List <SimpleEmployee> approveEmps = new List <SimpleEmployee> { approvers.MarketMgr, approvers.GM, approvers.MDD, approvers.FC, approvers.VPGM //approvers.MCCLAssetMgr, //approvers.MCCLAssetDtr }; if (approvers.RegionalMgr != null) { approveEmps.Add(approvers.RegionalMgr); } //邮件模板中的数据 Dictionary <string, string> bodyValues = new Dictionary <string, string>(); //邮件内容中的键值对 bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人 bodyValues.Add("StoreCode", storeBasic.StoreCode); bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN); bodyValues.Add("Actor", assetActor.UserNameENUS); ////--呈递人 //bodyValues.Add("WorkflowName", Constants.TempClosure_Package);////--流程名称 bodyValues.Add("ProjectName", Constants.TempClosure); //项目名称 var viewPage = string.Format("{0}/TempClosure/Main#/ClosurePackage/View/param?projectId={1}", HttpContext.Current.Request.Url.Authority, entity.ProjectId); bodyValues.Add("FormUrl", viewPage); Dictionary <string, string> templateFileds = new Dictionary <string, string>(); var flowInfo = FlowInfo.Get(FlowCode.TempClosure); templateFileds.Add("WorkflowName", flowInfo.NameENUS); templateFileds.Add("ProjectID", entity.ProjectId); templateFileds.Add("USCode", storeBasic.StoreCode); templateFileds.Add("City", storeBasic.CityZHCN); templateFileds.Add("Region", storeBasic.Region); templateFileds.Add("StoreNameEN", storeBasic.NameENUS); templateFileds.Add("Market", storeBasic.Market); templateFileds.Add("StoreNameCN", storeBasic.NameZHCN); templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString()); templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd")); var storeInfo = StoreBasicInfo.GetStore(project.USCode); if (!string.IsNullOrEmpty(storeInfo.StoreContractInfo.EndYear)) { templateFileds.Add("CurrentLeaseENDYear", (int.Parse(storeInfo.StoreContractInfo.EndYear) - storeInfo.CurrentYear).ToString()); } else { templateFileds.Add("CurrentLeaseENDYear", ""); } if (assetMgr != null) { templateFileds.Add("AssetsManager", assetMgr.UserNameENUS); } templateFileds.Add("AssetsActor", assetActor.UserNameENUS); templateFileds.Add("AssetsRep", assetRep.UserNameENUS); templateFileds.Add("ClosureDate", tempClosureInfo.ActualTempClosureDate.ToString("yyyy-MM-dd")); templateFileds.Add("LeaseExpireDate", tempClosureInfo.LeaseExpireDate.HasValue ? tempClosureInfo.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : ""); templateFileds.Add("ReOpenDate", tempClosureInfo.ActualReopenDate.ToString("yyyy-MM-dd")); templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(entity.RentReliefClause) ? "否" : "是"); templateFileds.Add("RentFreeStartDate", entity.RentReliefStartDate.HasValue ? entity.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : ""); templateFileds.Add("RentFreeEndDate", entity.RentReliefEndDate.HasValue ? entity.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : ""); templateFileds.Add("FreeRentTerm", entity.RentReliefClause); var approveRecords = ProjectComment.GetList("TempClosurePackage", entity.Id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord { OperatorID = pc.UserAccount, OperatorName = pc.UserNameENUS, OperatorTitle = pc.TitleNameENUS, OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now, ActionName = pc.ActivityName, Comments = pc.Content }).ToList(); string imgPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.TempClosure, templateFileds, approveRecords); approveEmps.ForEach(e => { EmailMessage email = new EmailMessage(); List <string> emailAddresses = new List <string> { e.Mail, "*****@*****.**", "*****@*****.**", "*****@*****.**" }; if (bodyValues.ContainsKey("ApproverName")) { bodyValues["ApproverName"] = e.NameENUS; } else { bodyValues.Add("ApproverName", e.NameENUS);//--提交人 } email.EmailBodyValues = bodyValues; email.To = string.Join(";", emailAddresses); email.Attachments = imgPath; //var result = emailClient.SendEmail(email); results.Add(new EmailSendingResultType()); }); approvers.NoticeUsers.ForEach(e => { EmailMessage email = new EmailMessage(); List <string> emailAddresses = new List <string> { e.Mail, "*****@*****.**", "*****@*****.**", "*****@*****.**" }; if (bodyValues.ContainsKey("ApproverName"))//--提交人 { bodyValues["ApproverName"] = e.NameENUS; } else { bodyValues.Add("ApproverName", e.NameENUS); } email.EmailBodyValues = bodyValues; email.To = string.Join(";", emailAddresses); email.Attachments = imgPath; //var result = emailClient.SendEmail(email); results.Add(new EmailSendingResultType()); }); } return(results); }
public EmailSendingResultType SendEmail(Guid id, string[] emailToEids, string workflowName, string projectID, string tableName) { var closureInfo = ClosureInfo.GetByProjectId(projectID); var store = StoreBasicInfo.GetStore(closureInfo.USCode); var storeBasic = store.StoreBasicInfo; EmailServiceClient emailClient = new EmailServiceClient(); var bllProjectComment = new ProjectComment(); EmailMessage email = new EmailMessage(); //邮件模板中的数据 Dictionary <string, string> bodyValues = new Dictionary <string, string>(); //邮件内容中的键值对 bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人 bodyValues.Add("WorkflowName", workflowName); bodyValues.Add("StoreCode", storeBasic.StoreCode); bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN); bodyValues.Add("Actor", closureInfo.AssetActorNameENUS);////--呈递人 var viewPage = string.Format("{0}/TempClosure/Main#/ClosurePackage/View/param?projectId={1}", HttpContext.Current.Request.Url.Authority, projectID); bodyValues.Add("FormUrl", viewPage); email.EmailBodyValues = bodyValues; Dictionary <string, string> templateFileds = new Dictionary <string, string>(); templateFileds.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.TempClosure, ClientCookie.Language)); templateFileds.Add("ProjectID", projectID); templateFileds.Add("USCode", storeBasic.StoreCode); templateFileds.Add("Region", storeBasic.Region); templateFileds.Add("StoreNameEN", storeBasic.NameENUS); templateFileds.Add("Market", storeBasic.Market); templateFileds.Add("StoreNameCN", storeBasic.NameZHCN); templateFileds.Add("City", storeBasic.CityZHCN); templateFileds.Add("StoreAge", ""); templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd")); var currentLeaseENDYear = store.CurrentYear - int.Parse(store.StoreContractInfo.EndYear); templateFileds.Add("CurrentLeaseENDYear", currentLeaseENDYear.ToString()); templateFileds.Add("AssetsManager", closureInfo.AssetManagerNameENUS); templateFileds.Add("AssetsActor", closureInfo.AssetActorNameENUS); templateFileds.Add("AssetsRep", closureInfo.AssetRepNameENUS); if (closureInfo.ActualCloseDate.HasValue && closureInfo.ActualCloseDate.Value.Year == 1900) { templateFileds.Add("ClosureDate", string.Empty); } else { templateFileds.Add("ClosureDate", closureInfo.ActualCloseDate.HasValue ? closureInfo.ActualCloseDate.Value.ToString("yyyy-MM-dd") : ""); } templateFileds.Add("ClosureType", closureInfo.ClosureTypeNameENUS); templateFileds.Add("LandlordName", ""); templateFileds.Add("LeaseExpireDate", ""); templateFileds.Add("OriginalCFNPV", ""); List <SubmissionApprovalRecord> approveRecords = new List <SubmissionApprovalRecord>(); if (id != new Guid()) { approveRecords = ProjectComment.GetList(tableName, id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord { OperatorID = pc.UserAccount, OperatorName = pc.UserNameENUS, OperatorTitle = pc.TitleNameENUS, OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now, ActionName = pc.ActivityName, Comments = pc.Content }).ToList(); } string imgPath = HtmlConversionUtility.ConvertToImage(HtmlTempalteType.Default, templateFileds, approveRecords); List <string> emailAddresses = Employee.Search(e => emailToEids.Contains(e.Code)).Select(e => e.Mail).ToList(); emailAddresses.Add("*****@*****.**"); emailAddresses.Add("*****@*****.**"); emailAddresses.Add("*****@*****.**"); //emailAddresses.Add("*****@*****.**"); email.To = string.Join(";", emailAddresses); email.Attachments = imgPath; //EmailSendingResultType result = emailClient.SendEmail(email); return(new EmailSendingResultType()); }