public IHttpActionResult GetById(string Id) { Guid _Id; if (!Guid.TryParse(Id, out _Id)) { return(Ok()); } var entity = ClosureWOCheckList.Get(_Id); if (entity != null) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId); entity.USCode = closureEntity.USCode; entity.UserAccount = ClientCookie.UserCode; } return(Ok(entity)); }
public IHttpActionResult GetConsInfo(string projectId, string entityId = "") { var entity = ReimageConsInfo.GetConsInfo(projectId, entityId); if (entity != null) { var condition = new ProjectCommentCondition(); condition.SourceCode = FlowCode.Reimage; condition.UserAccount = ClientCookie.UserCode; condition.RefTableId = entity.Id; condition.RefTableName = "ReimageConsInfo"; var comments = ProjectComment.SearchList(condition); if (comments != null && comments.Count > 0) { entity.ProjectComments = comments; var saveComment = comments.OrderByDescending(e => e.CreateTime) .FirstOrDefault(e => e.Status == ProjectCommentStatus.Save); if (saveComment != null) { entity.Comments = saveComment.Content; } } } return(Ok(entity)); }
public IHttpActionResult GetByProjectId(string projectId) { var entity = ClosureConsInvtChecking.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false); if (entity != null) { var closureInfo = ClosureInfo.GetByProjectId(projectId); entity.USCode = closureInfo.USCode; ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } if (string.IsNullOrEmpty(entity.PMSupervisor)) { var puser = ProjectUsers.FirstOrDefault(i => i.ProjectId == entity.ProjectId && i.RoleCode == ProjectUserRoleCode.CM); if (puser != null) { entity.PMSupervisor = puser.UserAccount; } } } return(Ok(entity)); }
public IHttpActionResult GetClosureCommers(string userAccount, string refTableName, Guid refTableId) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.SourceCode = FlowCode.Closure; condition.UserAccount = userAccount; condition.RefTableId = refTableId; ProjectComment.SearchList(condition); var list = _db.ProjectComment.Where(e => e.RefTableName == refTableName && e.RefTableId == refTableId && string.IsNullOrEmpty(e.Content) && e.SourceCode == "Closure").OrderByDescending(e => e.CreateTime); return(Ok(list)); }
/// <summary> /// Add By Kevin.Yao /// 2014-10-22 /// ClosurePackage-Package Attachment-For Print PDF /// </summary> /// <param name="condition"></param> /// <returns></returns> public static List <VProjectComment> SearchVListForPDF(ProjectCommentCondition condition) { var commentList = SearchVList(condition); //如果Package流程有Return/Recall操作,只取Return/Recall之后的意见 var undoComment = commentList.Where(i => i.Action == ProjectCommentAction.Return || i.Action == ProjectCommentAction.Recall).OrderByDescending(i => i.CreateTime); if (undoComment.Count() > 0) { var lastReturnTime = undoComment.ToArray()[0].CreateTime; commentList = commentList.Where(i => i.CreateTime > lastReturnTime).ToList(); } return(commentList.Where(i => i.Action == ProjectCommentAction.Approve || i.Action == ProjectCommentAction.Submit || i.Action == ProjectCommentAction.ReSubmit).ToList()); }
public static List <VProjectComment> SearchVList(ProjectCommentCondition condition) { var _db = PrepareDb(); IQueryable <VProjectComment> list = _db.VProjectComment.Where(d => true); if (!string.IsNullOrEmpty(condition.SourceCode)) { list = _db.VProjectComment .Where(d => d.SourceCode == condition.SourceCode); } if (condition.RefTableId != new Guid()) { list = list.Where(d => d.RefTableId == condition.RefTableId); } if (!string.IsNullOrEmpty(condition.Action)) { list = list.Where(d => d.Action == condition.Action); } if (!string.IsNullOrEmpty(condition.UserAccount)) { list = list.Where(d => d.UserAccount == condition.UserAccount); } if (!string.IsNullOrEmpty(condition.Content)) { list = list.Where(d => d.Content.Contains(condition.Content)); } if (condition.Status != ProjectCommentStatus.None) { switch (condition.Status) { case ProjectCommentStatus.Save: list = list.Where(d => d.Status == 0); break; case ProjectCommentStatus.Submit: list = list.Where(d => d.Status == 1); break; } } List <VProjectComment> resultList = list.ToList(); return(resultList); }
public void GetFullInfo(ClosureWOCheckList entity) { if (entity != null) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId); entity.USCode = closureEntity.USCode; entity.UserAccount = ClientCookie.UserCode; } }
public IHttpActionResult GetByProjectId(string projectId) { var entity = ClosureWOCheckList.Get(projectId); if (entity != null) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableId = entity.Id; condition.RefTableName = ClosureWOCheckList.TableName; condition.UserAccount = ClientCookie.UserCode; condition.Status = ProjectCommentStatus.Save; var commentList = ProjectComment.SearchList(condition); if (commentList != null && commentList.Count > 0) { entity.Comments = commentList[0].Content; } var closureEntity = ClosureInfo.GetByProjectId(entity.ProjectId); entity.USCode = closureEntity.USCode; entity.UserAccount = ClientCookie.UserCode; if (string.IsNullOrEmpty(entity.PMSupervisorAccount)) { var puser = ProjectUsers.FirstOrDefault(i => i.ProjectId == entity.ProjectId && i.RoleCode == ProjectUserRoleCode.CM); if (puser != null) { entity.PMSupervisorAccount = puser.UserAccount; } } // entity.Comments = GetCommers(entity); //string pmAccount = closureEntity.PMAccount; //entity.PMSupervisorAccount = userPositionHandler.GetReportToAccounts(pmAccount); //string[] accounts = {UserPositionHandler.IT,UserPositionHandler.MCCL_Construction_Mgr}; //var positionlist = userPositionHandler.SearchUserPosition(closureEntity.USCode,accounts); //string mcclApprover = userPositionHandler.GetAccounts(positionlist); //entity.MCCLApproverAccount = mcclApprover; } return(Ok(entity)); }
public ClosureLegalReview GetByProjectId(string projectId, string userAccount) { ClosureLegalReview entity = ClosureLegalReview.Get(projectId); if (entity != null) { ProjectCommentCondition condition = new ProjectCommentCondition(); condition.SourceCode = FlowCode.Closure; condition.UserAccount = userAccount; condition.RefTableId = entity.Id; condition.RefTableName = ClosureLegalReview.TableName; condition.Status = ProjectCommentStatus.Save; var comments = ProjectComment.SearchList(condition); if (comments != null && comments.Count > 0) { entity.Comments = comments[0].Content; } } return(entity); }
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 PreparePackDownload(string refTableName, string projectId) { string pdfPath = string.Empty; string refTableId = ProjectInfo.GetRefTableId(refTableName, projectId); Dictionary <string, string> templateFileds = new Dictionary <string, string>(); HtmlTempalteType templateType = HtmlTempalteType.Default; string flowName = string.Empty; string flowCode = string.Empty; switch (refTableName) { case "MajorLeaseChangePackage": { templateType = HtmlTempalteType.MajorLease; flowName = FlowCode.MajorLease; flowCode = FlowCode.MajorLease_Package; var majorLeaseChangePkg = MajorLeaseChangePackage.GetMajorPackageInfo(projectId); templateFileds = majorLeaseChangePkg.GetPrintTemplateFields(); } break; case "TempClosurePackage": { templateType = HtmlTempalteType.TempClosure; flowName = FlowCode.TempClosure; flowCode = FlowCode.TempClosure_ClosurePackage; var tempClosurePackage = TempClosurePackage.Get(projectId); if (tempClosurePackage == null) { tempClosurePackage = new TempClosurePackage(); tempClosurePackage.ProjectId = projectId; } templateFileds = tempClosurePackage.GetPrintTemplateFields(); } break; case "ReimagePackage": { var entity = ReimagePackage.GetReimagePackageInfo(projectId); templateType = HtmlTempalteType.Reimage; flowName = FlowCode.Reimage; flowCode = FlowCode.Reimage_Package; if (entity == null || entity.Id == Guid.Parse("00000000-0000-0000-0000-000000000000")) { entity = new ReimagePackage(); entity.ProjectId = projectId; } templateFileds = entity.GetPrintTemplateFields(); } break; case "RenewalLegalApproval": { templateType = HtmlTempalteType.RenewalLegalApproval; flowName = FlowCode.Renewal; flowCode = FlowCode.Renewal_LegalApproval; var legal = RenewalLegalApproval.Get(projectId); if (legal == null) { legal = new RenewalLegalApproval(); legal.ProjectId = projectId; } templateFileds = legal.GetPrintTemplateFields(); } break; case "RenewalPackage": { templateType = HtmlTempalteType.Renewal; flowName = FlowCode.Renewal; flowCode = FlowCode.Renewal_Package; var package = RenewalPackage.Get(projectId); if (package == null) { package = new RenewalPackage(); package.ProjectId = projectId; } templateFileds = package.GetPrintTemplateFields(); } break; case "ClosurePackage": { templateType = HtmlTempalteType.Default; flowName = FlowCode.Closure; flowCode = FlowCode.Closure_ClosurePackage; var closurePackage = ClosurePackage.Get(projectId); if (closurePackage == null) { closurePackage = new ClosurePackage(); closurePackage.ProjectId = projectId; } templateFileds = closurePackage.GetPrintTemplateFields(); } break; default: break; } List <Attachment> attachments = Attachment.GetAllAttachmentsIncludeRequire(refTableName, projectId, flowCode).Where(att => att.ID != Guid.Empty && (att.RequirementId.HasValue || att.TypeCode == "Cover")).ToList(); //Submission and Approval Records - 只显示通过意见 List <SubmissionApprovalRecord> recordList = new List <SubmissionApprovalRecord>(); //Submission and Approval Records Details — 所有意见 List <SubmissionApprovalRecord> recordDetailList = new List <SubmissionApprovalRecord>(); ProjectCommentCondition condition = new ProjectCommentCondition(); condition.RefTableName = refTableName; condition.RefTableId = Guid.Parse(refTableId); condition.Status = ProjectCommentStatus.Submit; var commentList = condition.RefTableId == Guid.Empty ? new List <VProjectComment>() : VProjectComment.SearchVListForPDF(condition); var commentDetailList = condition.RefTableId == Guid.Empty ? new List <VProjectComment>() : 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); } recordList = recordList.OrderBy(i => i.OperationDate).ToList(); 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); } recordDetailList = recordDetailList.OrderBy(i => i.OperationDate).ToList(); pdfPath = HtmlConversionUtility.HtmlConvertToPDF(templateType, templateFileds, recordList, recordDetailList); var pdfFileName = Path.GetFileName(pdfPath); var pdfExtension = Path.GetExtension(pdfPath); attachments.Add(new Attachment { InternalName = pdfFileName, Name = flowName + " Print", Extension = pdfExtension }); if (refTableName == "RenewalLegalApproval") { SaveRenewalLegalApprovalPDF("RenewalLegalApproval", projectId, new Guid("870BD738-A512-4B27-9FDB-C18058BFA817"), pdfPath); return(Ok()); } string packFileUrl = ZipHandle.ExeFiles(attachments); return(Ok(new { PackUrl = string.Concat("~/", "Temp/", Path.GetFileName(packFileUrl)) })); }