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 })); }
protected static BaseWFEntity GetEmptyWorkflowEntity(string flowCode) { BaseWFEntity wfEntity = null; switch (flowCode) { case FlowCode.MajorLease: wfEntity = new MajorLeaseInfo(); wfEntity.IsMainProject = true; break; case FlowCode.MajorLease_LegalReview: wfEntity = new MajorLeaseLegalReview(); break; case FlowCode.MajorLease_FinanceAnalysis: wfEntity = new MajorLeaseFinancAnalysis(); break; case FlowCode.MajorLease_ConsInfo: wfEntity = new MajorLeaseConsInfo(); break; case FlowCode.MajorLease_Package: wfEntity = new MajorLeaseChangePackage(); break; case FlowCode.MajorLease_ConsInvtChecking: wfEntity = new MajorLeaseConsInvtChecking(); break; case FlowCode.MajorLease_GBMemo: wfEntity = new MajorLeaseGBMemo(); break; case FlowCode.Closure: wfEntity = new ClosureInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Closure_ClosurePackage: wfEntity = new ClosurePackage(); break; case FlowCode.Closure_ClosureTool: wfEntity = new ClosureTool(); break; case FlowCode.Closure_ConsInvtChecking: wfEntity = new ClosureConsInvtChecking(); break; case FlowCode.Closure_LegalReview: wfEntity = new ClosureLegalReview(); break; case FlowCode.Closure_WOCheckList: wfEntity = new ClosureWOCheckList(); break; case FlowCode.Closure_ExecutiveSummary: wfEntity = new ClosureExecutiveSummary(); break; case FlowCode.TempClosure: wfEntity = new TempClosureInfo(); wfEntity.IsMainProject = true; break; case FlowCode.TempClosure_LegalReview: wfEntity = new TempClosureLegalReview(); break; case FlowCode.TempClosure_ClosurePackage: wfEntity = new TempClosurePackage(); break; case FlowCode.Rebuild: wfEntity = new RebuildInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Rebuild_LegalReview: wfEntity = new RebuildLegalReview(); break; case FlowCode.Rebuild_FinanceAnalysis: wfEntity = new RebuildFinancAnalysis(); break; case FlowCode.Rebuild_ConsInfo: wfEntity = new RebuildConsInfo(); break; case FlowCode.Rebuild_Package: wfEntity = new RebuildPackage(); break; case FlowCode.Rebuild_ConsInvtChecking: wfEntity = new RebuildConsInvtChecking(); break; case FlowCode.Rebuild_GBMemo: wfEntity = new GBMemo(); break; case FlowCode.Renewal: wfEntity = new RenewalInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Renewal_Letter: wfEntity = new RenewalLetter(); break; case FlowCode.Renewal_LLNegotiation: wfEntity = new RenewalLLNegotiation(); break; case FlowCode.Renewal_ConsInfo: wfEntity = new RenewalConsInfo(); break; case FlowCode.Renewal_Tool: wfEntity = new RenewalTool(); break; case FlowCode.Renewal_Analysis: wfEntity = new RenewalAnalysis(); break; case FlowCode.Renewal_ClearanceReport: wfEntity = new RenewalClearanceReport(); break; case FlowCode.Renewal_ConfirmLetter: wfEntity = new RenewalConfirmLetter(); break; case FlowCode.Renewal_LegalApproval: wfEntity = new RenewalLegalApproval(); break; case FlowCode.Renewal_Package: wfEntity = new RenewalPackage(); break; case FlowCode.Renewal_GBMemo: wfEntity = new RenewalGBMemo(); break; case FlowCode.Reimage: wfEntity = new ReimageInfo(); wfEntity.IsMainProject = true; break; case FlowCode.Reimage_ConsInfo: wfEntity = new ReimageConsInfo(); break; case FlowCode.Reimage_Summary: wfEntity = new ReimageSummary(); break; case FlowCode.Reimage_Package: wfEntity = new ReimagePackage(); break; case FlowCode.Reimage_ConsInvtChecking: wfEntity = new ReimageConsInvtChecking(); break; case FlowCode.Reimage_GBMemo: wfEntity = new ReimageGBMemo(); break; } return(wfEntity); }
public IHttpActionResult GetTaskWorks(int pageIndex, int pageSize, string userCode) { try { var queryString = HttpContext.Current.Request.QueryString; IQueryable <TaskWork> result = TaskWork.GetUseableTaskWork(); if (queryString["Status"] != null) { var status = (TaskWorkStatus)int.Parse(queryString["Status"]); if (status == TaskWorkStatus.Finished) { result = result.Where(c => (c.Status == status || c.Status == TaskWorkStatus.K2ProcessApproved || c.Status == TaskWorkStatus.K2ProcessDeclined) && c.ReceiverAccount == userCode); } else { result = result.Where(c => (c.Status == status) && c.ReceiverAccount == userCode); result = ClosureTool.FilterTaskWork(result); } } var skipSize = pageSize * (pageIndex - 1); string title = queryString["Title"]; if (!string.IsNullOrEmpty(title)) { result = result.Where(c => c.Title.Contains(title)); } string sourceCode = queryString["SourceCode"]; if (!string.IsNullOrEmpty(sourceCode)) { result = result.Where(c => c.SourceCode == sourceCode); } var storeCode = queryString["StoreCode"]; if (!string.IsNullOrEmpty(storeCode)) { result = result.Where(e => e.StoreCode == storeCode); } var storeName = queryString["StoreName"]; if (!string.IsNullOrEmpty(storeName)) { var storeList = StoreBasicInfo.Search(e => e.NameENUS.Contains(storeName) || e.NameZHCN.Contains(storeName)) .Select(e => e.StoreCode).ToList(); if (storeList.Any()) { result = result.Where(e => storeList.Contains(e.StoreCode)); } } int totalItems = result.Count(); var list = new List <TaskWork>(); if (queryString["Status"] != null && queryString["Status"] == "2") { list = result.OrderByDescending(c => c.FinishTime).Skip(skipSize) .Take(pageSize).ToList(); } else { list = result.OrderByDescending(c => c.CreateTime).Skip(skipSize) .Take(pageSize).ToList(); } foreach (var taskWork in list) { var operators = TaskWork.GetOperators(taskWork.TypeCode, taskWork.RefID); var taskWorkOperator = operators.FirstOrDefault(e => e.Code == ClientCookie.UserCode); taskWork.OperateMsg = taskWorkOperator != null ? taskWorkOperator.OperateMsgZHCN : string.Empty; if (taskWork.ProcInstID.HasValue && !string.IsNullOrEmpty(taskWork.RefID) && taskWork.Url.ToLower().IndexOf(taskWork.RefID.ToLower()) < 0) { taskWork.Url = string.Format("{0}&projectId={1}", taskWork.Url, taskWork.RefID); } } return(Ok(new PagedDataSource(totalItems, list.ToArray()))); } catch (Exception ex) { Log4netHelper.WriteError(JsonConvert.SerializeObject(ex)); throw ex; } }
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 Send(PostClosureMemoModel model) { var actor = ProjectUsers.GetProjectUser(model.Entity.ProjectId, ProjectUserRoleCode.AssetActor); using (TransactionScope tranScope = new TransactionScope()) { Save(model.Entity); ClosureTool closureTool = ClosureTool.FirstOrDefault(ct => ct.ProjectId == model.Entity.ProjectId); string compensationAwards = ""; string compensation = "暂无数据"; if (closureTool != null && closureTool.Compensation.HasValue) { compensationAwards = closureTool.Compensation.Value > 0 ? "Yes" : "No"; compensation = closureTool.Compensation.Value.ToString("N"); } Dictionary <string, string> pdfData = new Dictionary <string, string>(); pdfData.Add("WorkflowName", "Closure"); pdfData.Add("ProjectID", model.Entity.ProjectId); pdfData.Add("RegionNameENUS", model.Entity.RegionNameENUS); pdfData.Add("RegionNameZHCN", model.Entity.RegionNameZHCN); pdfData.Add("MarketNameENUS", model.Entity.MarketNameENUS); pdfData.Add("MarketNameZHCN", model.Entity.MarketNameZHCN); pdfData.Add("ProvinceNameENUS", model.Entity.ProvinceNameENUS); pdfData.Add("ProvinceNameZHCN", model.Entity.ProvinceNameZHCN); pdfData.Add("CityNameENUS", model.Entity.CityNameENUS); pdfData.Add("CityNameZHCN", model.Entity.CityNameZHCN); pdfData.Add("StoreNameENUS", model.Entity.StoreNameENUS); pdfData.Add("StoreNameZHCN", model.Entity.StoreNameZHCN); pdfData.Add("StoreAddressENUS", model.Entity.StoreAddressENUS); pdfData.Add("StoreAddressZHCN", model.Entity.StoreAddressZHCN); pdfData.Add("USCode", model.Entity.USCode); pdfData.Add("OpenDate", model.Entity.OpenDate.Value.ToString("yyyy-MM-dd")); pdfData.Add("ClosureDate", model.Entity.ClosureDate.Value.ToString("yyyy-MM-dd")); pdfData.Add("ClosureNature", model.Entity.ClosureNature.ToString()); if (model.Entity.BecauseOfReimaging.HasValue) { pdfData.Add("BecauseOfReimaging", model.Entity.BecauseOfReimaging.Value ? "Yes" : "No"); } else { pdfData.Add("BecauseOfReimaging", ""); } if (model.Entity.BecauseOfRemodel.HasValue) { pdfData.Add("BecauseOfRemodel", model.Entity.BecauseOfRemodel.Value ? "Yes" : "No"); } else { pdfData.Add("BecauseOfRemodel", ""); } if (model.Entity.BecauseOfDespute.HasValue) { pdfData.Add("BecauseOfDespute", model.Entity.BecauseOfDespute.Value ? "Yes" : "No"); } else { pdfData.Add("BecauseOfDespute", ""); } if (model.Entity.BecauseOfRedevelopment.HasValue) { pdfData.Add("BecauseOfRedevelopment", model.Entity.BecauseOfRedevelopment.Value ? "Yes" : "No"); } else { pdfData.Add("BecauseOfRedevelopment", ""); } if (model.Entity.BecauseOfPlanedClosure.HasValue) { pdfData.Add("BecauseOfPlanedClosure", model.Entity.BecauseOfPlanedClosure.Value ? "Yes" : "No"); } else { pdfData.Add("BecauseOfPlanedClosure", ""); } if (model.Entity.BecauseOfRebuild.HasValue) { pdfData.Add("BecauseOfRebuild", model.Entity.BecauseOfRebuild.Value ? "Yes" : "No"); } else { pdfData.Add("BecauseOfRebuild", ""); } pdfData.Add("BecauseOfOthers", model.Entity.BecauseOfOthers); if (model.Entity.PermanentCloseOpportunity.HasValue) { pdfData.Add("PermanentCloseOpportunity", model.Entity.PermanentCloseOpportunity.Value ? "Yes" : "No"); } else { pdfData.Add("PermanentCloseOpportunity", ""); } if (model.Entity.HasRelocationPlan.HasValue) { pdfData.Add("HasRelocationPlan", model.Entity.HasRelocationPlan.Value ? "Yes" : "No"); } else { pdfData.Add("HasRelocationPlan", ""); } pdfData.Add("PipelineName", model.Entity.PipelineName); pdfData.Add("CompensationAwarded", compensationAwards); pdfData.Add("Compensation", compensation); string pdfPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.ClosureMemo, pdfData, null); EmailSendingResultType result; //邮件模板中的数据 Dictionary <string, string> bodyValues = new Dictionary <string, string>(); //邮件内容中的键值对 //bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人 bodyValues.Add("StoreCode", model.Entity.USCode); bodyValues.Add("StoreName", model.Entity.StoreNameENUS); bodyValues.Add("Actor", actor.RoleNameENUS); ////--呈递人 bodyValues.Add("WorkflowName", Constants.Closure_Memo); ////--流程名称 bodyValues.Add("ProjectName", Constants.Closure); //项目名称 var webRootUrl = ConfigurationManager.AppSettings["webHost"]; var viewPage = string.Format("{0}Closure/Main#/ClosureMemo/ClosureMemoView?projectId={1}", webRootUrl, model.Entity.ProjectId); bodyValues.Add("FormUrl", viewPage); //调用邮件服务发送邮件 using (EmailServiceClient client = new EmailServiceClient()) { EmailMessage message = new EmailMessage(); StringBuilder sbTo = new StringBuilder(); Dictionary <string, string> attachments = new Dictionary <string, string>(); foreach (Employee emp in model.Receivers) { if (sbTo.Length > 0) { sbTo.Append(";"); } if (!string.IsNullOrEmpty(emp.Mail)) { sbTo.Append(emp.Mail); } } if (sbTo.Length > 0) { sbTo.Append(";"); } message.EmailBodyValues = bodyValues; attachments.Add(pdfPath, model.Entity.USCode + " " + FlowCode.Closure_Memo + ".pdf"); message.AttachmentsDict = attachments; message.To = sbTo.ToString(); message.TemplateCode = EmailTemplateCode.GBMemoNotification; result = client.SendNotificationEmail(message); } if (!result.Successful) { return(BadRequest(result.ErrorMessage + " " + pdfPath)); } //store关闭不在这里设置,需要判断project状态和closuredata //var store = StoreBasicInfo.GetStorInfo(model.Entity.USCode); //store.StoreStatus = "suoya301003"; //store.statusName = "Closed"; //store.Update(); if (model.Entity.ClosureNature == ClosureNatureType.Permanent) { //选项为永久关闭并且发送成功后关闭任务 McdAMEntities _db = new McdAMEntities(); var task = _db.TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.Status == 0 && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_Memo && e.RefID == model.Entity.ProjectId); if (task != null) { task.Status = TaskWorkStatus.K2ProcessApproved; task.FinishTime = DateTime.Now; task.Url = SiteInfo.GetProjectViewPageUrl(FlowCode.Closure_Memo, task.RefID); //var enableExecutiveSummary = handler.EnableExecutiveSummary(entity.ProjectId.Value); _db.TaskWork.Attach(task); _db.Entry(task).State = EntityState.Modified; _db.SaveChanges(); ProjectInfo.FinishNode(model.Entity.ProjectId, FlowCode.Closure_Memo, NodeCode.Closure_ClosureMemo_Input); ProjectInfo.FinishNode(model.Entity.ProjectId, FlowCode.Closure_Memo, NodeCode.Closure_ClosureMemo_SendMemo, ProjectStatus.Finished); #region Memo完成后,设定计划任务 var closureConsInvtChecking = new ClosureConsInvtChecking(); closureConsInvtChecking.GenerateConsInvtCheckingTask(model.Entity.ProjectId); if (model.Entity.ClosureDate.HasValue) { ScheduleLog.UpdateStoreStatusSchedule(model.Entity.USCode, model.Entity.ProjectId, model.Entity.ClosureDate.Value, ClientCookie.UserCode); } #endregion } ProjectInfo.CompleteMainIfEnable(model.Entity.ProjectId); } tranScope.Complete(); return(Ok()); } }
public IHttpActionResult UploadClosureWOCheckListTemplate(string projectid) { var request = HttpContext.Current.Request; var fileCollection = request.Files; if (fileCollection.Count > 0) { _refId = GetRefId(projectid, ClosureWOCheckList.TableName); if (_refId.HasValue) { var file = fileCollection[0]; var fileExtension = Path.GetExtension(file.FileName); var name = _refId.Value.ToString() + "WriteOff"; var fileName = string.Format(@"{0}UploadFiles/{1}{2}", HttpContext.Current.Server.MapPath("~/"), name, fileExtension); file.SaveAs(fileName); if (!IsMeetVersion(ExcelDataInputType.ClosureWOCheckList.ToString(), fileName)) { PluploadHandler.WriteErrorMsg("上传的是非标准模板,请下载标准模板再上传"); } var fileInfo = new FileInfo(fileName); var importDirector = new ExcelDataImportDirector(fileInfo, ExcelDataImportType.ClosureWOCheckList); decimal RE_NBV = 0; decimal.TryParse(importDirector.GetCellValue(9, "E"), out RE_NBV); decimal LHI_NBV = 0; decimal.TryParse(importDirector.GetCellValue(10, "E"), out LHI_NBV); decimal ESSD_NBV = 0; decimal.TryParse(importDirector.GetCellValue(11, "E"), out ESSD_NBV); decimal Equipment_Transfer = 0; decimal.TryParse(importDirector.GetCellValue(16, "E"), out Equipment_Transfer); importDirector.FillEntityEvent += FillClosureWOCheckList; using (TransactionScope scope = new TransactionScope()) { importDirector.ParseAndImport(); AddUpdateAttachment(name + fileExtension, ClosureWOCheckList.TableName, "Template", fileCollection); var currentNode = NodeInfo.GetCurrentNode(projectid, FlowCode.Closure_WOCheckList); var newNode = NodeInfo.GetNodeInfo(NodeCode.Closure_WOCheckList_ResultUpload); if (newNode.Sequence > currentNode.Sequence) { ProjectInfo.FinishNode(projectid, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_DownLoadTemplate); ProjectInfo.FinishNode(projectid, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_WriteOffData); ProjectInfo.FinishNode(projectid, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_ResultUpload); } scope.Complete(); } if (_woCheckList != null) { var closureToolHandler = new ClosureTool(); var oldRE_NBV = _woCheckList.RE_NBV ?? 0; var oldLHI_NBV = _woCheckList.LHI_NBV ?? 0; var oldESSD_NBV = _woCheckList.ESSD_NBV ?? 0; var oldEquipmentTransfer = _woCheckList.EquipmentTransfer ?? 0; if ((RE_NBV != oldRE_NBV) || (LHI_NBV != oldLHI_NBV) || (ESSD_NBV != oldESSD_NBV) || (Equipment_Transfer != oldEquipmentTransfer)) { var __woCheckList = ClosureWOCheckList.FirstOrDefault(e => e.Id.ToString().Equals(_woCheckList.Id.ToString())); if (__woCheckList != null) { __woCheckList.RefreshClosureTool = true; __woCheckList.Update(); } //var closureToolController = new ClosureToolController(); //var toolEntity = ClosureTool.Get(projectid); //if (toolEntity != null) //{ // //判断是否满足生成closureTools的条件 // if (toolEntity.EnableReGenClosureTool()) // { // closureToolController.GenClosureTool(toolEntity.Id, toolEntity.UserAccount, toolEntity.UserNameZHCN, toolEntity.UserNameENUS); // closureToolController.CallClosureTool(toolEntity.Id); // //通知Finance Specialist和Asset Actor // var closureInfo = ClosureInfo.FirstOrDefault(i => i.ProjectId == projectid); // List<string> receiverList = new List<string>(); // receiverList.Add(closureInfo.AssetActorAccount); // receiverList.Add(closureInfo.FinanceAccount); // var notificationMsg = new NotificationMsg() // { // FlowCode = FlowCode.Closure_WOCheckList, // ProjectId = projectid, // SenderCode = ClientCookie.UserCode, // Title = "由于WO Tool数据发生变化,Closure Tool文件已自动更新", // RefId = _woCheckList.Id, // UsCode = _woCheckList.USCode, // IsSendEmail = false, // ReceiverCodeList = receiverList // }; // Notification.Send(notificationMsg); // } //} } } } } return(Ok()); }
/// <summary> /// 提交Closure /// </summary> /// <param name="entity"></param> /// <returns></returns> public IHttpActionResult PostClosure(ClosureInfo entity) { using (TransactionScope tranScope = new TransactionScope()) { // bll.BeginTransAction(); // try // { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (entity.ClosureReasonCode != "Others") { entity.ClosureReasonRemark = string.Empty; } if (entity.Id == new Guid()) { entity.Id = Guid.NewGuid(); entity.CreateDate = DateTime.Now; entity.ProjectId = ProjectInfo.CreateMainProject(FlowCode.Closure, entity.USCode, NodeCode.Start, entity.CreateUserAccount); ClosureInfo.Add(entity); } else { ClosureInfo.Update(entity); } // bll.Commit(); //} //catch (Exception ex) //{ // bll.Rollback(); // return BadRequest(ex.Message); //} var usersList = new List <ProjectUsers>(); var assetActor = GetClosureUsers(ProjectUserRoleCode.AssetActor, ProjectUserRoleCode.AssetActor, ProjectUserRoleCode.AssetActor, entity.AssetActorAccount, entity.AssetActorNameENUS, entity.AssetActorNameZHCN, entity.ProjectId); usersList.Add(assetActor); var assetRep = GetClosureUsers(ProjectUserRoleCode.AssetRep, ProjectUserRoleCode.AssetRep, ProjectUserRoleCode.AssetRep, entity.AssetRepAccount, entity.AssetRepNameENUS, entity.AssetRepNameZHCN, entity.ProjectId); usersList.Add(assetRep); var finance = GetClosureUsers(ProjectUserRoleCode.Finance, ProjectUserRoleCode.Finance, ProjectUserRoleCode.Finance, entity.FinanceAccount, entity.FinanceNameENUS, entity.FinanceNameZHCN, entity.ProjectId); usersList.Add(finance); var Legal = GetClosureUsers(ProjectUserRoleCode.Legal, ProjectUserRoleCode.Legal, ProjectUserRoleCode.Legal, entity.LegalAccount, entity.LegalNameENUS, entity.LegalNameZHCN, entity.ProjectId); usersList.Add(Legal); var PM = GetClosureUsers(ProjectUserRoleCode.PM, ProjectUserRoleCode.PM, ProjectUserRoleCode.PM, entity.PMAccount, entity.PMNameZHCN, entity.PMNameENUS, entity.ProjectId); usersList.Add(PM); var assertMgr = GetClosureUsers(ProjectUserRoleCode.AssetManager, ProjectUserRoleCode.AssetManager, ProjectUserRoleCode.AssetManager, entity.AssetManagerAccount, entity.AssetManagerNameENUS, entity.AssetManagerNameZHCN, entity.ProjectId); usersList.Add(assertMgr); var cm = GetClosureUsers(ProjectUserRoleCode.CM, ProjectUserRoleCode.CM, ProjectUserRoleCode.CM, entity.CMAccount, entity.CMNameENUS, entity.CMNameZHCN, entity.ProjectId); usersList.Add(cm); if (entity.NecessaryNoticeUserList != null && entity.NecessaryNoticeUserList.Count > 0) { usersList.AddRange(entity.NecessaryNoticeUserList.Select( user => GetClosureUsers(ProjectUserRoleCode.View, ProjectUserRoleCode.View, ProjectUserRoleCode.View, user.Code, user.NameENUS, user.NameZHCN, entity.ProjectId))); } if (entity.NoticeUserList != null && entity.NoticeUserList.Count > 0) { usersList.AddRange(entity.NoticeUserList.Select( user => GetClosureUsers(ProjectUserRoleCode.View, ProjectUserRoleCode.View, ProjectUserRoleCode.View, user.Code, user.NameENUS, user.NameZHCN, entity.ProjectId))); } ProjectUsers.Add(usersList.ToArray()); SendRemind(entity); SendWorkTaskAndEmail(entity); //初始化项目信息 ProjectInfo.CreateSubProject(FlowCode.Closure_WOCheckList, entity.ProjectId, entity.USCode, NodeCode.Start, PM.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Closure_LegalReview, entity.ProjectId, entity.USCode, NodeCode.Start, assetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Closure_ClosureTool, entity.ProjectId, entity.USCode, NodeCode.Start, finance.UserAccount); var store = StoreBasicInfo.GetStorInfo(entity.USCode); var closureTool = new ClosureTool(); closureTool.Id = Guid.NewGuid(); closureTool.ProjectId = entity.ProjectId; closureTool.IsHistory = false; closureTool.IsOptionOffered = entity.IsRelocation(); closureTool.PipelineName = store.PipelineNameENUS; closureTool.RelocationPipelineID = store.PipelineID; closureTool.Add(); var woCheckList = new ClosureWOCheckList { Id = Guid.NewGuid(), ProjectId = entity.ProjectId, CreateTime = DateTime.Now, CreateUserAccount = ClientCookie.UserCode, CreateUserName = ClientCookie.UserNameENUS, IsHistory = false }; woCheckList.Add(); var legalReview = new ClosureLegalReview { Id = Guid.NewGuid(), ProjectId = entity.ProjectId, CreateTime = DateTime.Now, CreateUserAccount = ClientCookie.UserCode, CreateUserName = ClientCookie.UserNameENUS, IsHistory = false }; legalReview.Add(); var executiveSummary = new ClosureExecutiveSummary { Id = Guid.NewGuid(), ProjectId = entity.ProjectId, CreateTime = DateTime.Now, CreatorAccount = ClientCookie.UserCode, CreatorName = ClientCookie.UserNameENUS, IsHistory = false }; executiveSummary.Add(); //var package = new ClosurePackage //{ // Id = Guid.NewGuid(), // ProjectId = entity.ProjectId, // CreateTime = DateTime.Now, // CreateUserAccount = ClientCookie.UserCode, // IsHistory = false //}; //package.Add(); var projectContractInfo = ProjectContractInfo.GetContractWithHistory(entity.ProjectId).Current; projectContractInfo.Add(); ProjectInfo.CreateSubProject(FlowCode.Closure_ExecutiveSummary, entity.ProjectId, entity.USCode, NodeCode.Start, assetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Closure_ClosurePackage, entity.ProjectId, entity.USCode, NodeCode.Start, assetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Closure_ConsInvtChecking, entity.ProjectId, entity.USCode, NodeCode.Start, entity.PMAccount); ProjectInfo.CreateSubProject(FlowCode.Closure_ContractInfo, entity.ProjectId, entity.USCode, NodeCode.Start, entity.CreateUserAccount); ProjectInfo.CreateSubProject(FlowCode.Closure_Memo, entity.ProjectId, entity.USCode, NodeCode.Start, entity.CreateUserAccount); ProjectNode.GenerateOnCreate(FlowCode.Closure, entity.ProjectId); try { //bllActionLog.Add(new ActionLog //{ // Id = Guid.NewGuid(), // ProjectId = entity.ProjectId, // Action = ActionType.Submit, // CreateTime = DateTime.Now, // Operator = entity.CreateUserAccount, // OperatorENUS = entity.CreateUserNameENUS, // OperatorZHCN = entity.CreateUserNameZHCN, // Remark = "", // OperatorTitle = "创建流程" //}); tranScope.Complete(); //bll.GetDb().SaveChanges(); } catch (DbEntityValidationException dbEx) { tranScope.Dispose(); } return(Ok(entity)); } }
public IHttpActionResult RecallProject(PostSimpleWorkflowData postData) { ApiProxy.SetCookies(Request.RequestUri.Host, HttpContext.Current.Request.Cookies); var rootPath = string.Concat(HttpContext.Current.Request.Url.Scheme, @"://", HttpContext.Current.Request.Url.Authority, HttpContext.Current.Request.ApplicationPath); switch (postData.FlowCode) { #region Closure case FlowCode.Closure_WOCheckList: { var entity = ClosureWOCheckList.Get(postData.ProjectId); entity.Comments = postData.ProjectComment; var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity)); ApiProxy.Call(rootPath + "api/ClosureWOCheckList/Recall", "POST", null, postDataBytes); } break; case FlowCode.Closure_LegalReview: { var entity = ClosureLegalReview.Get(postData.ProjectId); entity.Comments = postData.ProjectComment; var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity)); ApiProxy.Call(rootPath + "api/LegalReview/Recall", "POST", null, postDataBytes); } break; case FlowCode.Closure_ClosurePackage: { var entity = ClosurePackage.Get(postData.ProjectId); entity.Comments = postData.ProjectComment; var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity)); ApiProxy.Call(rootPath + "api/ClosurePackage/Recall", "POST", null, postDataBytes); } break; case FlowCode.Closure_ConsInvtChecking: { var entity = ClosureConsInvtChecking.Get(postData.ProjectId); entity.Comments = postData.ProjectComment; var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity)); ApiProxy.Call(rootPath + "api/ClosureConsInvtChecking/Recall", "POST", null, postDataBytes); } break; case FlowCode.Closure_ClosureTool: { var entity = ClosureTool.Get(postData.ProjectId); entity.Comments = postData.ProjectComment; var postDataBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(entity)); ApiProxy.Call(rootPath + "api/closureTool/Recall", "POST", null, postDataBytes); } break; #endregion Closure default: var wfEntity = BaseWFEntity.GetWorkflowEntity(postData.ProjectId, postData.FlowCode); wfEntity.Recall(postData.ProjectComment); break; } return(Ok()); }
//private string GetCellValue(decimal? val) //{ // string result = string.Empty; // if (val.HasValue) // { // result = val.Value.ToString("f2"); // } // return result; //} public override void Input(OfficeOpenXml.ExcelWorksheet worksheet, ExcelInputDTO inputInfo) { var closureInfo = ClosureInfo.GetByProjectId(inputInfo.ProjectId); var storeInfo = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == closureInfo.USCode); var storeContract = StoreContractInfo.Get(storeInfo.StoreCode); ClosureTool closureTool = ClosureTool.Get(inputInfo.ProjectId); //ClosureWOCheckList closureWoCheckList = ClosureWOCheckList.Get(inputInfo.ProjectId); worksheet.Cells["B2"].Value = storeInfo.Market; worksheet.Cells["B3"].Value = storeInfo.StoreCode; worksheet.Cells["B4"].Value = storeInfo.NameZHCN; worksheet.Cells["B5"].Value = storeInfo.OpenDate.ToString("yyyy-MM-dd"); if (storeContract != null) { worksheet.Cells["B6"].Value = storeContract.PartyAFullName; worksheet.Cells["B7"].Value = storeContract.EndDate.HasValue ? storeContract.EndDate.Value.ToString("yyyy-MM-dd") : ""; } worksheet.Cells["B8"].Value = closureInfo.ClosureTypeNameZHCN; if (closureInfo.ActualCloseDate != null) { worksheet.Cells["B9"].Value = closureInfo.ActualCloseDate.Value.ToString("yyyy-MM-dd"); } worksheet.Cells["B10"].Value = closureTool.Product_Sales_RMB_Adjustment; worksheet.Cells["B11"].Value = closureTool.PAC_RMB_Adjustment; worksheet.Cells["B12"].Value = closureTool.Rent_RMB_Adjustment; worksheet.Cells["B13"].Value = closureTool.DepreciationLHI_RMB_Adjustment; worksheet.Cells["B14"].Value = closureTool.InterestLHI_RMB_Adjustment; //INTEREST LHI // worksheet.Cells[15, 2].Value = closureTool..ToString(); worksheet.Cells["B15"].Value = closureTool.ServiceFee_RMB_Adjustment; worksheet.Cells["B16"].Value = closureTool.Accounting_RMB_Adjustment; worksheet.Cells["B17"].Value = closureTool.Accounting_RMB_Adjustment; worksheet.Cells["B18"].Value = closureTool.TaxesLicenses_RMB_Adjustment; worksheet.Cells["B19"].Value = closureTool.Depreciation_ESSD_RMB_Adjustment; worksheet.Cells["B20"].Value = closureTool.Interest_ESSD_RMB_Adjustment; worksheet.Cells["B21"].Value = closureTool.OtherIncExp_RMB_Adjustment; worksheet.Cells["B22"].Value = closureTool.NonProduct_Sales_RMB_Adjustment; worksheet.Cells["B23"].Value = closureTool.NonProduct_Costs_RMB_Adjustment; worksheet.Cells["B24"].Value = closureTool.CompSalesMacket_Adjustment; worksheet.Cells["B25"].Value = closureTool.CompCG_Adjustment; worksheet.Cells["B26"].Value = closureTool.CompCGMacket_Adjustment; worksheet.Cells["B27"].Value = closureTool.PACMarket_Adjustment; worksheet.Cells["B28"].Value = closureTool.SOIMarket_Adjustment; worksheet.Cells["B29"].Value = closureTool.TotalSales_TTMY1; worksheet.Cells["B30"].Value = closureTool.CompSales_TTMY1; worksheet.Cells["B31"].Value = closureTool.CompSales_Market_TTMY1; worksheet.Cells["B32"].Value = closureTool.CompGC_TTMY1; worksheet.Cells["B33"].Value = closureTool.CompGCMarket_TTMY1; worksheet.Cells["B34"].Value = closureTool.PAC_TTMY1; worksheet.Cells["B35"].Value = closureTool.PACMarket_TTMY1; worksheet.Cells["B36"].Value = closureTool.SOI_TTMY1; worksheet.Cells["B37"].Value = closureTool.SOIMarket_TTMY1; worksheet.Cells["B38"].Value = closureTool.CashFlow_TTMY1; worksheet.Cells["B39"].Value = closureTool.TotalSales_TTMY2; //sheet.Cells[36, 2].Value = closureTool.cashflow.ToString(); worksheet.Cells["B40"].Value = closureTool.CompSales_TTMY2; worksheet.Cells["B41"].Value = closureTool.CompSales_Market_TTMY2; worksheet.Cells["B42"].Value = closureTool.CompGC_TTMY2; worksheet.Cells["B43"].Value = closureTool.CompGCMarket_TTMY2; worksheet.Cells["B44"].Value = closureTool.PAC_TTMY2; worksheet.Cells["B45"].Value = closureTool.PACMarket_TTMY2; worksheet.Cells["B46"].Value = closureTool.SOI_TTMY2; worksheet.Cells["B47"].Value = closureTool.SOIMarket_TTMY2; worksheet.Cells["B48"].Value = closureTool.CashFlow_TTMY2; worksheet.Cells["B49"].Value = DateTime.Now.Year + " July"; var woEntity = ClosureWOCheckList.Get(closureTool.ProjectId); if (woEntity != null) { worksheet.Cells["B50"].Value = woEntity.RE_Original; worksheet.Cells["B51"].Value = woEntity.LHI_Original; worksheet.Cells["B52"].Value = woEntity.ESSD_Original; worksheet.Cells["B53"].Value = woEntity.RE_NBV; worksheet.Cells["B54"].Value = woEntity.LHI_NBV; worksheet.Cells["B55"].Value = woEntity.ESSD_NBV; worksheet.Cells["B56"].Value = woEntity.EquipmentTransfer; worksheet.Cells["B57"].Value = woEntity.ClosingCost; } var list = ClosureToolImpactOtherStore.Search(e => e.ClosureId == closureTool.Id).AsNoTracking().ToList(); if (list.Count > 0) { worksheet.Cells["B58"].Value = list[0].StoreCode; worksheet.Cells["B59"].Value = list[0].NameZHCN; worksheet.Cells["B60"].Value = list[0].ImpactSaltes; } if (list.Count > 1) { worksheet.Cells["B61"].Value = list[1].StoreCode; worksheet.Cells["B62"].Value = list[1].NameZHCN; worksheet.Cells["B63"].Value = list[1].ImpactSaltes; } worksheet.Cells["B64"].Value = closureTool.McppcoMargin; worksheet.Cells["B65"].Value = closureTool.MccpcoCashFlow; worksheet.Cells["B66"].Value = closureTool.Compensation; worksheet.Cells["B67"].Value = closureTool.CompAssumption; worksheet.Cells["B68"].Value = closureTool.CashflowGrowth; if (closureTool.IsOptionOffered.HasValue) { worksheet.Cells["B69"].Value = closureTool.IsOptionOffered.Value ? "Yes" : "No"; } worksheet.Cells["B70"].Value = closureTool.LeaseTerm; worksheet.Cells["B71"].Value = closureTool.Investment; worksheet.Cells["B72"].Value = closureTool.NPVRestaurantCashflows; if (closureTool.Yr1SOI != null) { worksheet.Cells["B73"].Value = closureTool.Yr1SOI; } if (closureTool.Yr1SOI != null) { worksheet.Cells["B74"].Value = closureTool.IRR; } if (closureTool.ConclusionComment != null) { worksheet.Cells["B76"].Value = closureTool.ConclusionComment; } }