Exemple #1
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            var info = RenewalInfo.Get(ProjectId);

            switch (status)
            {
            case TaskWorkStatus.K2ProcessApproved:
                ProjectProgress.SetProgress(ProjectId, "50%");
                ProjectInfo.FinishNode(ProjectId, FlowCode.Renewal_Analysis, NodeCode.Finish, ProjectStatus.Finished);
                if (info.RenewalYears > 2)
                {
                    if (!ProjectInfo.FlowHaveTask(ProjectId, FlowCode.Renewal_ClearanceReport))
                    {
                        info.GenerateSubmitTask(FlowCode.Renewal_ClearanceReport);
                    }
                }
                else
                {
                    ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ClearanceReport);
                    if (!ProjectInfo.FlowHaveTask(ProjectId, FlowCode.Renewal_ConfirmLetter))
                    {
                        info.GenerateSubmitTask(FlowCode.Renewal_ConfirmLetter);
                    }
                }

                break;

            case TaskWorkStatus.K2ProcessDeclined:
                break;
            }
        }
Exemple #2
0
        public static void Complete(string projectId, string flowCode)
        {
            var taskWorks = Search(e => e.RefID == projectId &&
                                   e.TypeCode == flowCode &&
                                   e.ReceiverAccount == ClientCookie.UserCode).ToArray();

            foreach (var taskWork in taskWorks)
            {
                taskWork.Url        = taskWork.GetViewUrl();
                taskWork.Status     = TaskWorkStatus.Finished;
                taskWork.FinishTime = DateTime.Now;
                switch (taskWork.TypeCode)
                {
                case FlowCode.MajorLease_ContractInfo:
                case FlowCode.MajorLease_SiteInfo:
                case FlowCode.Reimage_SiteInfo:
                case FlowCode.Rebuild_SiteInfo:
                    ProjectInfo.FinishProject(taskWork.RefID, taskWork.TypeCode);
                    break;
                }
            }

            Update(taskWorks);
        }
Exemple #3
0
        public void UpdateFromProjectList()
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var oldInfo  = RenewalInfo.Get(this.ProjectId);
                var consInfo = RenewalConsInfo.Get(this.ProjectId);
                var analysis = RenewalAnalysis.Get(this.ProjectId);
                analysis.LeaseTenureAndTerm = string.Format("{0} years,from {1:yyyy-MM-dd} to {2:yyyy-MM-dd}", this.RenewalYears, this.NewLeaseStartDate, this.NewLeaseEndDate);
                analysis.Update();
                if (oldInfo.NeedProjectCostEst != this.NeedProjectCostEst)
                {
                    consInfo.HasReinvenstment = this.NeedProjectCostEst;
                    consInfo.Update();
                    if (ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Letter) &&
                        ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_LLNegotiation))
                    {
                        if (!this.NeedProjectCostEst)
                        {
                            TaskWork.Cancel(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_ConsInfo);
                            ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ConsInfo);
                            if (!ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Tool))
                            {
                                if (!TaskWork.Any(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_Tool))
                                {
                                    GenerateSubmitTask(FlowCode.Renewal_Tool);
                                }
                            }
                        }
                        else
                        {
                            ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_ConsInfo);

                            GenerateSubmitTask(FlowCode.Renewal_ConsInfo);
                            if (!ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Tool))
                            {
                                TaskWork.Cancel(e => e.RefID == this.ProjectId && e.TypeCode == FlowCode.Renewal_Tool && e.Status == TaskWorkStatus.UnFinish);
                                ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_Tool);
                            }
                        }
                    }
                }

                if (oldInfo.RenewalYears != this.RenewalYears)
                {
                    if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_Analysis))
                    {
                        if (this.RenewalYears <= 2)
                        {
                            TaskWork.Finish(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_ClearanceReport);
                            ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ClearanceReport);
                        }
                        else
                        {
                            if (!TaskWork.Any(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Renewal_ClearanceReport && e.Status == TaskWorkStatus.UnFinish))
                            {
                                GenerateSubmitTask(FlowCode.Renewal_ClearanceReport);
                            }
                        }
                    }
                }
                this.Update();
                tranScope.Complete();
            }
        }