Esempio n. 1
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            using (var scope = new TransactionScope())
            {
                switch (status)
                {
                case TaskWorkStatus.K2ProcessApproved:
                    ProjectInfo.FinishNode(this.ProjectId, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_Approve, ProjectStatus.Finished);
                    //ProjectInfo.UpdateProjectStatus(this.ProjectId, FlowCode.Closure_WOCheckList, ProjectStatus.Finished);
                    //如果是从ClosurePackage Edit之后撤回Task的,添加ClosurePackage的Task
                    if (TaskWork.Count(i => i.RefID == task.RefID && i.TypeCode == FlowCode.Closure_ClosurePackage && i.Status == TaskWorkStatus.Cancel) > 0)
                    {
                        if (ProjectInfo.Any(e => e.ProjectId == task.RefID && e.Status == ProjectStatus.Finished && e.FlowCode == FlowCode.Closure_LegalReview))
                        {
                            var package = new ClosurePackage();
                            package.GeneratePackageTask(task.RefID);
                        }
                    }
                    //如果是从ExecutiveSummary Edit之后撤回Task的,添加ExecutiveSummary的Task
                    else if (TaskWork.Count(i => i.RefID == task.RefID && i.TypeCode == FlowCode.Closure_ExecutiveSummary && i.Status == TaskWorkStatus.Cancel) > 0)
                    {
                        var executiveSummary = new ClosureExecutiveSummary();
                        executiveSummary.GenerateExecutiveSummaryTask(task.RefID);
                    }
                    break;
                }

                scope.Complete();
            }
        }
Esempio n. 2
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            using (var scope = new TransactionScope())
            {
                switch (status)
                {
                case TaskWorkStatus.K2ProcessApproved:
                    ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_ConsInfo, NodeCode.Reimage_ConsInfo_Confirm, ProjectStatus.Finished);

                    var reimagePackage = ReimagePackage.Get(ProjectId);
                    reimagePackage.GeneratePackageTask(ProjectId);

                    var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == ProjectId);

                    if (reimageInfo != null)
                    {
                        if (!TaskWork.Any(e => e.RefID == ProjectId &&
                                          e.TypeCode == FlowCode.Reimage_Summary &&
                                          e.Status == TaskWorkStatus.UnFinish &&
                                          e.ActivityName == NodeCode.Start))
                        {
                            var    reimageSummary = ReimageSummary.GetReimageSummaryInfo(ProjectId);
                            string filePath;
                            reimageSummary.GenerateExcel(out filePath);

                            if (!ProjectInfo.Any(e => e.ProjectId == ProjectId &&
                                                 e.FlowCode == FlowCode.Reimage_Summary &&
                                                 e.Status == ProjectStatus.Finished))
                            {
                                var summaryTask = reimageInfo.GenerateTaskWork(
                                    FlowCode.Reimage_Summary,
                                    FlowCode.Reimage_Summary,
                                    FlowCode.Reimage_Summary,
                                    string.Format(@"/Reimage/Main#/Summary?projectId={0}", ProjectId));

                                summaryTask.Add();
                            }
                        }
                    }
                    break;
                }

                scope.Complete();
            }
        }
Esempio n. 3
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            switch (status)
            {
            case TaskWorkStatus.K2ProcessApproved:
                ProjectInfo.FinishNode(this.ProjectId, FlowCode.Closure_LegalReview, NodeCode.Closure_LegalReview_LegalConfirm, ProjectStatus.Finished);
                //ProjectInfo.UpdateProjectStatus(this.ProjectId, FlowCode.Closure_LegalReview, ProjectStatus.Finished);
                if (ProjectInfo.Any(e => e.ProjectId == ProjectId &&
                                    e.Status == ProjectStatus.Finished &&
                                    e.FlowCode == FlowCode.Closure_ExecutiveSummary))
                {
                    var package = new ClosurePackage();
                    package.GeneratePackageTask(ProjectId);
                    package.GeneratePackage(ProjectId);
                }

                break;
            }
        }
Esempio n. 4
0
        public static IQueryable <TaskWork> FilterTaskWork(IQueryable <TaskWork> taskWorks)
        {
            var exceptList = new List <Guid>();

            foreach (var taskWork in taskWorks)
            {
                TaskWork work = taskWork;
                if (work.TypeCode == FlowCode.Closure_ClosureTool &&
                    work.ActivityName == "Asset Actor" &&
                    !ProjectInfo.Any(e => e.ProjectId == work.RefID &&
                                     e.FlowCode == FlowCode.Closure_WOCheckList &&
                                     e.Status == ProjectStatus.Finished))
                {
                    exceptList.Add(work.Id);
                }
            }

            return(taskWorks.Where(e => !exceptList.Contains(e.Id)));
        }
Esempio n. 5
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            using (var scope = new TransactionScope())
            {
                switch (status)
                {
                case TaskWorkStatus.K2ProcessApproved:
                    ProjectInfo.FinishNode(this.ProjectId, FlowCode.Closure_ExecutiveSummary, NodeCode.Closure_ExecutiveSummary_Generate, ProjectStatus.Finished);
                    if (ProjectInfo.Any(e => e.ProjectId == ProjectId &&
                                        e.Status == ProjectStatus.Finished &&
                                        e.FlowCode == FlowCode.Closure_LegalReview))
                    {
                        var package = new ClosurePackage();
                        package.GeneratePackageTask(ProjectId);
                        package.GeneratePackage(ProjectId);
                    }
                    break;
                }

                scope.Complete();
            }
        }
Esempio n. 6
0
        public static RenewalToolDTO InitPage(string projectId, string id = null)
        {
            RenewalToolDTO dto       = new RenewalToolDTO();
            var            tool      = RenewalTool.Get(projectId, id);
            var            project   = ProjectInfo.Get(projectId, FlowCode.Renewal_Tool);
            var            info      = RenewalInfo.Get(projectId);
            var            isFinance = ClientCookie.UserCode == info.FinanceAccount;

            tool.IsProjectFreezed = tool.CheckIfFreezeProject(projectId);
            var    nextRefTableId    = new Guid(FlowInfo.GetRefTableId("RenewalAnalysis", projectId));
            var    nextFlowStarted   = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Analysis);
            var    haveTask          = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Tool && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var    projectComment    = ProjectComment.GetSavedComment(tool.Id, "RenewalTool", ClientCookie.UserCode);
            var    projectNode       = NodeInfo.GetNodeInfo(project.NodeCode);
            var    packageStarted    = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package);
            string selectedYearMonth = null;

            dto.Info              = info;
            dto.Entity            = tool;
            dto.TTMDataYearMonths = RenewalToolFinMeasureInput.GetYearMonths(projectId, out selectedYearMonth);
            dto.FinMeasureInput   = RenewalToolFinMeasureInput.Get(projectId, dto.Entity.Id);
            if (string.IsNullOrEmpty(dto.FinMeasureInput.FinanceYear) || string.IsNullOrEmpty(dto.FinMeasureInput.FinanceMonth))
            {
                var ym = selectedYearMonth.Split('-');
                dto.FinMeasureInput.FinanceYear  = ym[0];
                dto.FinMeasureInput.FinanceMonth = ym[1];
            }
            dto.FinMeasureInput.FinanceDataYearMonth = dto.FinMeasureInput.FinanceYear + "-" + dto.FinMeasureInput.FinanceMonth;
            //dto.FinMeasureInput.ContributionMargin = StoreCM.Get(dto.Info.USCode).ContributionMargin;
            McdAMEntities amdb  = new McdAMEntities();
            var           finfo = amdb.DataSync_LDW_AM_STFinanceData2.FirstOrDefault(f => f.UsCode == dto.Info.USCode &&
                                                                                     f.FinanceYear == dto.FinMeasureInput.FinanceYear && f.FinanceMonth == dto.FinMeasureInput.FinanceMonth);
            decimal cm = 0;

            if (finfo != null && !string.IsNullOrEmpty(finfo.contribution_marginPct))
            {
                cm = decimal.Parse(finfo.contribution_marginPct);
            }
            dto.FinMeasureInput.ContributionMargin = cm;
            var coninfo = RenewalConsInfo.FirstOrDefault(e => e.ProjectId == projectId && !e.IsHistory);
            var conProj = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId && e.FlowCode == "Renewal_ConsInfo");

            dto.WriteOffAndReinCost = RenewalToolWriteOffAndReinCost.Get(projectId, dto.Entity.Id, projectNode);
            if (coninfo != null && !coninfo.HasReinvenstment)
            {
                dto.WriteOffAndReinCost.REWriteOff   = null;
                dto.WriteOffAndReinCost.LHIWriteOff  = null;
                dto.WriteOffAndReinCost.ESSDWriteOff = null;
                dto.WriteOffAndReinCost.ESSDWriteOff = null;
                dto.WriteOffAndReinCost.RECost       = null;
                dto.WriteOffAndReinCost.LHICost      = null;
                dto.WriteOffAndReinCost.ESSDCost     = null;
            }

            dto.Uploadable     = projectNode.Sequence >= 3 && ClientCookie.UserCode == dto.Info.AssetActorAccount && !packageStarted;
            dto.ProjectComment = projectComment != null ? projectComment.Content : "";
            dto.Editable       = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Tool);
            dto.Recallable     = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Tool);
            dto.Savable        = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Tool) && string.IsNullOrEmpty(id);
            dto.IsFinished     =
                ProjectInfo.Any(
                    e =>
                    e.ProjectId == projectId && e.FlowCode == FlowCode.Renewal_Tool &&
                    e.Status == ProjectStatus.Finished);
            return(dto);
        }
Esempio n. 7
0
 public static bool CheckIfConsInfoFinished(string projectId)
 {
     return(ProjectInfo.Any(e => e.ProjectId == projectId &&
                            e.FlowCode == FlowCode.Reimage_ConsInfo &&
                            e.Status == ProjectStatus.Finished));
 }