Ejemplo n.º 1
0
        public static RenewalPackageDTO InitPage(string projectId, string id = null)
        {
            RenewalPackageDTO dto = new RenewalPackageDTO();
            var entity            = RenewalPackage.Get(projectId, id);
            var project           = ProjectInfo.Get(projectId, FlowCode.Renewal_Package);
            var info = RenewalInfo.Get(projectId);

            entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId);
            entity.GenerateCover();
            var haveTask       = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Package && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment = ProjectComment.GetSavedComment(entity.Id, "RenewalPackage", ClientCookie.UserCode);
            var projectNode    = NodeInfo.GetNodeInfo(project.NodeCode);

            dto.Info             = info;
            dto.Entity           = entity;
            dto.Analysis         = RenewalAnalysis.Get(entity.AnalysisId.Value);
            dto.FinMeasureOutput = RenewalToolFinMeasureOutput.GetByToolId(entity.ToolId.Value);
            dto.Uploadable       = projectNode.Sequence >= 4 && ClientCookie.UserCode == dto.Info.AssetActorAccount;
            var editStatuses = new[] { ProjectStatus.Finished, ProjectStatus.Rejected };

            dto.ProjectComment = projectComment != null ? projectComment.Content : "";
            dto.Editable       = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Package);
            dto.Recallable     = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Package);
            dto.Savable        = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Package) && string.IsNullOrEmpty(id);
            if (entity.ProcInstId.HasValue)
            {
                var currentActivityName = K2FxContext.Current.GetCurrentActivityName(entity.ProcInstId.Value);
                dto.Rejectable = !entity.WorkflowNormalActors.Contains(currentActivityName);
            }
            dto.IsLindaLu = string.Compare(ClientCookie.UserCode, ConfigurationManager.AppSettings["AssetMgrCode"], true) == 0;
            return(dto);
        }
Ejemplo n.º 2
0
 public IHttpActionResult Submit(RenewalPackageDTO postData)
 {
     postData.Entity.Submit(postData.ProjectComment, () =>
     {
         RenewalEmail.SendPackageApprovalEmail(postData.Info, postData.Entity, postData.Entity.AppUsers);
     });
     return(Ok());
 }
Ejemplo n.º 3
0
 public IHttpActionResult Recall(RenewalPackageDTO postData)
 {
     postData.Entity.Recall(postData.ProjectComment);
     return(Ok());
 }
Ejemplo n.º 4
0
 public IHttpActionResult Confirm(RenewalPackageDTO postData)
 {
     postData.Entity.Confirm(postData.SN);
     return(Ok());
 }
Ejemplo n.º 5
0
 public IHttpActionResult Resubmit(RenewalPackageDTO postData)
 {
     postData.Entity.Resubmit(postData.ProjectComment, postData.SN);
     return(Ok());
 }