public IHttpActionResult Edit(RenewalLegalApproval entity)
 {
     return(Ok(new ProjectEditResult
     {
         TaskUrl = entity.Edit()
     }));
 }
示例#2
0
        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);
        }
示例#3
0
        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))
            }));
        }
        public IHttpActionResult InitPage(string projectId, string id = null)
        {
            var dto = RenewalLegalApproval.InitPage(projectId, id);

            return(Ok(dto));
        }