public static void GetWorkFlowStatus(DateTime GetTime, WorkFlowStatus status, string message = "", bool ForceRecord = false) { lock (GetWorkFlowLock) { if (status == WorkFlowStatus.报警结束) { if (_wfStatus == WorkFlowStatus.报警) { _wfStatus = IsWorkFlowRunning ? WorkFlowStatus.待料 : WorkFlowStatus.空闲; } } else if (_wfStatus != WorkFlowStatus.报警) { _wfStatus = status; } if (_lastStatus != _wfStatus || ForceRecord) { //int index, row; //GetShift(GetTime, out index, out row); DataRow workrow = workflow.NewRow(); workrow[COL_WORKFLOW_TIME] = GetTime.ToLongTimeString(); workrow[COL_WORKFLOW_STATUS] = _lastStatus + "->" + _wfStatus; workrow[COL_WORKFLOW_MEMO] = message; workflow.Rows.Add(workrow); _lastStatus = _wfStatus; if (updateState != null) { updateState.BeginInvoke(_wfStatus, null, null, null); } } } }
public static StringBuilder ToWorkFlowStatusIcon(this WorkFlowStatus workFlowStatus) { StringBuilder html = new StringBuilder(); html.Append("<span title=\"" + workFlowStatus.GetDescription() + "\">"); switch (workFlowStatus) { case WorkFlowStatus.Running: html.Append("<i class=\"fa fa-spinner fa-spin green\"></i>"); break; case WorkFlowStatus.IsFinish: html.Append("<i class=\"fa fa-check green\"></i>"); break; case WorkFlowStatus.Deprecate: html.Append("<i class=\"fa fa-ban red\"></i>"); break; case WorkFlowStatus.Back: html.Append("<i class=\"fa fa-rotate-left red\"></i>"); break; case WorkFlowStatus.UnSubmit: default: html.Append("<i class=\"fa fa-save gray\"></i>"); break; } html.Append(workFlowStatus.GetDescription() + "</span>"); return(html); }
public CheckListCAPItem(AuditCheck currentAuditCheck, WorkFlowStatus workFlowStatus) { InitializeComponent(); _currentAuditCheck = currentAuditCheck; _workFlowStatus = workFlowStatus; UpdateInformation(); }
private void UpdateInformation() { labelSourceText.Text = _currentCheck.Source; labelEditorText.Text = _currentCheck.EditionNumber?.ToString() ?? ""; labelRevisionText.Text = _currentCheck.RevisionNumber?.ToString() ?? ""; labelLevelText.Text = _currentCheck.Level.ToString(); metroTextBoxSection.Text = $"{_currentCheck.SectionNumber} {_currentCheck.SectionName}"; metroTextBoxPart.Text = $"{_currentCheck.PartNumber} {_currentCheck.PartName}"; metroTextBoxSubPart.Text = $"{_currentCheck.SubPartNumber} {_currentCheck.SubPartName}"; metroTextBoxItem.Text = $"{_currentCheck.ItemNumber} {_currentCheck.ItemName}"; metroTextBoxRequirement.Text = _currentCheck.Requirement; if (_currentAuditCheck.Settings.IsApplicable.HasValue) { checkBoxNotApplicable.Checked = _currentAuditCheck.Settings.IsApplicable.Value; } if (_currentAuditCheck.Settings.IsSatisfactory.HasValue) { radioButtonSatisfactory.Checked = _currentAuditCheck.Settings.IsSatisfactory.Value; radioButtonNotSatisfactory.Checked = !radioButtonSatisfactory.Checked; } metroTextBoxFindings.Text = _currentAuditCheck.Settings.Findings; metroTextBoxComments.Text = _currentAuditCheck.Settings.Comments; metroTextBoxWorkflowStage.Text = WorkFlowStage.GetItemById(_currentAuditCheck.Settings.WorkflowStageId).ToString(); metroTextBoxWorkFlowStatus.Text = WorkFlowStatus.GetItemById(_currentAuditCheck.Settings.WorkflowStatusId).ToString(); if (_currentAuditCheck.WorkflowStageId == WorkFlowStage.CAR.ItemId) { button1.Visible = radioButtonNotSatisfactory.Checked; } // for (int i = 0; i < checkedListBoxRoot.Items.Count; i++) // { // if (!string.IsNullOrEmpty(_currentAuditCheck.Settings.RootCause) &&_currentAuditCheck.Settings.RootCause.Contains(checkedListBoxRoot.Items[i].ToString())) // checkedListBoxRoot.SetItemChecked(i, true); // } flowLayoutPanel1.Controls.Clear(); foreach (var group in _currentCheck.CheckListRecords.GroupBy(i => i.OptionNumber)) { flowLayoutPanel1.Controls.Add(new Label() { Text = $"Option: {group.Key}", Font = new System.Drawing.Font("Verdana", 9F), ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(122)))), ((int)(((byte)(122))))) }); foreach (var record in group) { var control = new AuditCheckControl(_currentAuditCheckRecords.FirstOrDefault(i => i.CheckListRecordId == record.ItemId)); flowLayoutPanel1.Controls.Add(control); } } }
protected override List <CustomCell> GetListViewSubItems(CheckLists item) { var author = GlobalObjects.CaaEnvironment?.GetCorrector(item); var condition = "Unknown"; var root = ""; var status = WorkFlowStatus.Unknown; if (item.AuditCheck != null) { root = item.AuditCheck.Settings.RootCause; status = WorkFlowStatus.GetItemById(item.AuditCheck.Settings.WorkflowStatusId); if (item.AuditCheck.Settings.IsApplicable.HasValue && item.AuditCheck.Settings.IsApplicable.Value) { condition = "Not Applicable"; } else { if (item.AuditCheck.Settings.IsSatisfactory.HasValue) { if (item.AuditCheck.Settings.IsSatisfactory.Value) { condition = "Satisfactory"; } else { condition = "Not Satisfactory"; } } } } var subItems = new List <CustomCell>() { CreateRow(item.Settings.SectionNumber, item.Settings.SectionNumber), CreateRow(item.Settings.SectionName, item.Settings.SectionName), CreateRow(item.Settings.PartNumber, item.Settings.PartNumber), CreateRow(item.Settings.PartName, item.Settings.PartName), CreateRow(item.Settings.SubPartNumber, item.Settings.SubPartNumber), CreateRow(item.Settings.SubPartName, item.Settings.SubPartName), CreateRow(item.Settings.ItemNumber, item.Settings.ItemNumber), CreateRow(item.Settings.Requirement, item.Settings.Requirement), CreateRow(item.Level.ToString(), item.Level), CreateRow(condition, condition), CreateRow(root, root), CreateRow(status.ToString(), status), CreateRow(author, author) }; return(subItems); }
protected override List <CustomCell> GetListViewSubItems(CheckLists item) { var author = GlobalObjects.CaaEnvironment?.GetCorrector(item); var auditor = Specialist.Unknown.FirstName; var auditee = Specialist.Unknown.FirstName; var current = ""; var status = WorkFlowStatus.Unknown; var stage = WorkFlowStage.Unknown; if (item.AuditCheck != null) { status = WorkFlowStatus.GetItemById(item.AuditCheck.Settings.WorkflowStatusId); stage = WorkFlowStage.GetItemById(item.AuditCheck.Settings.WorkflowStageId); } if (item.PelRecord != null) { auditor = $"{item.PelRecord?.Auditor.FirstName} {item.PelRecord?.Auditor.LastName}"; auditee = $"{item.PelRecord?.Auditee.FirstName} {item.PelRecord?.Auditee.LastName}"; if (item.PelRecord?.CurrentAuditor != null) { current = $"{item.PelRecord?.CurrentAuditor.FirstName} {item.PelRecord?.CurrentAuditor.LastName}"; } else { current = $"My Tasks"; } } var subItems = new List <CustomCell>() { CreateRow(item.Source, item.Source), CreateRow(item.SettingsIcao.AnnexRef, item.SettingsIcao.AnnexRef), CreateRow(item.SettingsIcao.PartNumber, item.SettingsIcao.PartNumber), CreateRow(item.SettingsIcao.PartName, item.SettingsIcao.PartName), CreateRow(item.SettingsIcao.ChapterNumber, item.SettingsIcao.ChapterName), CreateRow(item.SettingsIcao.ChapterName, item.SettingsIcao.ChapterName), CreateRow(item.SettingsIcao.ItemNumber, item.SettingsIcao.ItemNumber), CreateRow(item.SettingsIcao.ItemtName, item.SettingsIcao.ItemtName), CreateRow(item.SettingsIcao.Standard, item.SettingsIcao.Standard), CreateRow(item.Level.ToString(), item.Level), CreateRow(stage.ToString(), stage), CreateRow(status.ToString(), status), CreateRow(auditor, item.PelRecord?.Auditor), CreateRow(auditee, item.PelRecord?.Auditee), CreateRow(current, item.PelRecord?.CurrentAuditor), CreateRow(author, author), }; return(subItems); }
private void ControlOnAccept(object sender, EventArgs e) { var item = sender as CheckListCAPItem; item.ApplyChanges(); var wf = item._workFlowStatus; var res = MessageBox.Show(wf == WorkFlowStatus.Open ? $"Do you really want move to next status({WorkFlowStatus.GetItemById(_currentAuditCheck.Settings.WorkflowStatusId)})?" : $"Do you really want move to next status({WorkFlowStatus.GetItemById(_currentAuditCheck.Settings.WorkflowStatusId + 1)})?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (res == DialogResult.Yes) { _currentAuditCheck.Settings.FromWorkflowStatusId = _currentAuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.Open.ItemId ? WorkFlowStatus.Open.ItemId : wf.ItemId; _currentAuditCheck.Settings.WorkflowStatusId = _currentAuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.Open.ItemId ? wf.ItemId : wf.ItemId + 1; if (_currentAuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.VOI.ItemId) { _currentAuditCheck.Settings.VOIDate = DateTime.Now; } else if (_currentAuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.FAT.ItemId) { _currentAuditCheck.Settings.FATDate = DateTime.Now; } GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentAuditCheck); var rec = new CheckListTransfer() { Created = DateTime.Now, From = _auditor.SpecialistId, To = _auditor.SpecialistId, AuditId = _auditId, CheckListId = _currentAuditCheck.CheckListId, Settings = new CheckListTransferSettings() { Remark = $"Workflow status Updated to {wf}!", WorkflowStageId = _currentAuditCheck.WorkflowStageId, IsWorkFlowChanged = true, } }; GlobalObjects.CaaEnvironment.NewKeeper.Save(rec); _animatedThreadWorker.RunWorkerAsync(); } Focus(); }
public static StringBuilder ToWorkFlowInstanceStatusIcon(int?isFinish, int status) { StringBuilder html = new StringBuilder(); WorkFlowStatus flowStatus = (WorkFlowStatus)status; if (isFinish == null && flowStatus == WorkFlowStatus.UnSubmit) { html.Append("<span class=\"gray\"><i class=\"fa fa-undo\"></i>未提交</span>"); } else if (isFinish == 1 && flowStatus == WorkFlowStatus.IsFinish) { html.Append("<span><i class=\"fa fa-check green\"></i>已审核</span>"); } else { switch (flowStatus) { case WorkFlowStatus.Running: html.Append("<span><i class=\"fa fa-spin fa-spinner green\"></i>审核中</span>"); break; case WorkFlowStatus.Deprecate: html.Append("<span><i class=\"fa fa-close red\"></i>不同意</span>"); break; case WorkFlowStatus.Back: html.Append("<span><i class=\"fa fa-mail-reply red\"></i>已退回</span>"); break; case WorkFlowStatus.Stop: html.Append("<span><i class=\"fa fa-mail-reply red\"></i>已终止</span>"); break; case WorkFlowStatus.Withdraw: html.Append("<span><i class=\"fa fa-reply-all red\"></i>已撤回</span>"); break; default: html.Append("<span>状态未知</span>"); break; } } return(html); }
public long CreateWorkFlowStatus(WorkFlowStatus WorkFlowStatus) { try { if (WorkFlowStatus != null) { PSF.SaveOrUpdate <WorkFlowStatus>(WorkFlowStatus); return(WorkFlowStatus.Id); } else { throw new Exception("WorkFlowStatus Object is required and it cannot be empty."); } } catch (Exception) { throw; } finally { if (PSF != null) { PSF.Dispose(); } } }
///// <summary> ///// 允许修正工作任务 ///// </summary> ///// <param name="workTask"></param> //public void AllowCorrectionWorkTask(IWorkTask workTask) //{ // if (WorkTaskStatus == WorkTaskStatus.Executed) // { // throw new Exception("工作流程已完成,不允许修正工作任务!"); // } // if (WorkTaskStatus == WorkTaskStatus.Waiting) // { // throw new Exception("工作流程为等待状态,不允许修正工作任务!"); // } // var _workReport = _workTasks.FirstOrDefault(p => p.ID.Equals(workTask.ID)); // if (_workReport == null) // throw new Exception($"评审报告【{Name}】不包含数据报告【{workTask.Name}】"); // if (_workReport is IDataReport) // { // var dataReport = _workReport as IDataReport; // if (dataReport.DataReportStatus == DataReportStatus.UnCommit) // throw new Exception($"数据报告【{workTask.Name}】已是未提交状态,可以直接修改!"); // dataReport.UpdateDataReportStatus(DataReportStatus.UnCommit); // } // else if (_workReport is IReviewReport) // { // var reviewReport = _workReport as IReviewReport; // if (reviewReport.ReviewReportStatus == ReviewReportStatus.Pending) // throw new Exception($"数据报告【{workTask.Name}】已是未决定状态,可以直接修改!"); // reviewReport.UpdateReviewReportStatus(ReviewReportStatus.Pending); // } // var _nextWorkReport = GetNextWorkTask(workTask); // if (_nextWorkReport != null) // _nextWorkReport.Wait(); //} protected override void UpdateWorkTaskStatus(WorkTaskStatus workTaskStatus) { if (workTaskStatus == WorkTaskStatus.Executing && (_workTasks == null || _workTasks.Count == 0)) { throw new Exception("项目流程不包含工作流程,不能开启"); } var oldWorkTaskStatus = WorkTaskStatus; base.UpdateWorkTaskStatus(workTaskStatus); // 从等待状态变为执行状态 if (oldWorkTaskStatus == WorkTaskStatus.Waiting && workTaskStatus == WorkTaskStatus.Executing) { var firstWorkTask = _workTasks.FirstOrDefault(); firstWorkTask.Start(); } // 从完成状态变为执行状态 if (oldWorkTaskStatus == WorkTaskStatus.Executed && workTaskStatus == WorkTaskStatus.Executing) { WorkFlowStatus = WorkFlowStatus.Pending; } }
public bool CompleteActivityTicketSystem(TicketSystem TicketSystem, string Template, string userId, string ActivityName, bool isRejection) { bool retValue = false; try { PSF.SaveOrUpdate <TicketSystem>(TicketSystem); WorkFlowTemplate WorkFlowTemplate = PSF.Get <WorkFlowTemplate>("TemplateName", Template); //close the current activity Activity CurrentActivity = PSF.Get <Activity>("InstanceId", TicketSystem.InstanceId, "ActivityName", ActivityName, "Completed", false); if (CurrentActivity != null) { //if current activity doesnt need any rejection and there is no rejection then it will be completed //otherwise once the rejection resolved then it will be completed //this need to be obdated as waiting if (CurrentActivity.IsRejApplicable == true && isRejection == true) { CurrentActivity.BranchCode = TicketSystem.BranchCode; CurrentActivity.DeptCode = TicketSystem.DeptCode; CurrentActivity.Completed = true; CurrentActivity.Available = false; CurrentActivity.Assigned = false; CurrentActivity.Performer = userId; PSF.SaveOrUpdate(CurrentActivity); } else { Activity WaitingAct = PSF.Get <Activity>("WaitingFor", CurrentActivity.Id); if (WaitingAct != null) { CurrentActivity.BranchCode = TicketSystem.BranchCode; CurrentActivity.DeptCode = TicketSystem.DeptCode; CurrentActivity.Waiting = false; PSF.SaveOrUpdate(CurrentActivity); WaitingAct.Completed = true; WaitingAct.Assigned = false; WaitingAct.Available = false; } CurrentActivity.BranchCode = TicketSystem.BranchCode; CurrentActivity.DeptCode = TicketSystem.DeptCode; CurrentActivity.Completed = true; CurrentActivity.Available = false; CurrentActivity.Assigned = false; CurrentActivity.Performer = userId; if (CurrentActivity.ActivityName == "CompleteETicket") { TicketSystem.IsTicketCompleted = true; PSF.Update <TicketSystem>(TicketSystem); ProcessInstance pi = PSF.Get <ProcessInstance>(TicketSystem.InstanceId); pi.Status = "Completed"; PSF.SaveOrUpdate <ProcessInstance>(pi); TicketSystem.Status = "Completed"; PSF.SaveOrUpdate <TicketSystem>(TicketSystem); } PSF.SaveOrUpdate(CurrentActivity); } } //trigger the next activity //we need to check whether parallel activities are there to complete //activities that are coming in the next order IList <WorkFlowStatus> WorkFlowStatusList = PSF.GetList <WorkFlowStatus>("TemplateId", WorkFlowTemplate.Id, "ActivityOrder", CurrentActivity.NextActOrder); //checking parallel activities get the current order of activities Dictionary <string, object> WaitCriteria = new Dictionary <string, object>(); WaitCriteria.Add("TemplateId", WorkFlowTemplate.Id); WaitCriteria.Add("ActivityOrder", CurrentActivity.ActivityOrder); WaitCriteria.Add("InstanceId", CurrentActivity.InstanceId); Dictionary <long, IList <Activity> > conditionList = PSF.GetListWithSearchCriteriaCount <Activity>(0, 100, string.Empty, string.Empty, WaitCriteria); if (conditionList != null && conditionList.Count > 0) { IList <Activity> conditionWaitList = conditionList.First().Value; bool? waiting = false; foreach (Activity a in conditionWaitList) { if (a.Completed == false && waiting == false) { waiting = true; } } retValue = true; if (waiting == true) { if (CurrentActivity.IsRejApplicable == true && isRejection == true) { } else { return(retValue); } } } if (WorkFlowStatusList != null && WorkFlowStatusList.Count > 0) { //if it is rejection flow then build the logic here //{logic goes here } foreach (WorkFlowStatus wfs in WorkFlowStatusList) { //Rejection Activity if (CurrentActivity.IsRejApplicable == true && isRejection == true) { WorkFlowStatus wfsRej = PSF.Get <WorkFlowStatus>("TemplateId", WorkFlowTemplate.Id, "RejectionFor", CurrentActivity.ActivityOrder); if (wfsRej != null) { Activity NextActivityRej = new Activity(); NextActivityRej.CreatedDate = DateTime.Now; NextActivityRej.ActivityName = wfsRej.WFStatus; if (NextActivityRej.ActivityName == "CompleteETicket") { NextActivityRej.Completed = true; //ProcessInstance pi = PSF.Get<ProcessInstance>(CallManagement.InstanceId); //pi.Status = "Completed"; PSF.SaveOrUpdate<ProcessInstance>(pi); TicketSystem.Status = NextActivityRej.ActivityName; PSF.SaveOrUpdate <TicketSystem>(TicketSystem); } else { NextActivityRej.Completed = false; } NextActivityRej.ActivityFullName = wfsRej.Description; NextActivityRej.AppRole = wfsRej.Performer; NextActivityRej.Performer = userId; NextActivityRej.TemplateId = WorkFlowTemplate.Id; NextActivityRej.InstanceId = TicketSystem.InstanceId; NextActivityRej.NextActOrder = wfsRej.NextActOrder; NextActivityRej.ActivityOrder = wfsRej.ActivityOrder; NextActivityRej.PreviousActOrder = wfsRej.PreviousActOrder; NextActivityRej.ProcessRefId = TicketSystem.Id; NextActivityRej.RejectionFor = CurrentActivity.Id; NextActivityRej.Completed = false; NextActivityRej.Available = true; NextActivityRej.Assigned = false; NextActivityRej.BranchCode = TicketSystem.BranchCode; NextActivityRej.DeptCode = TicketSystem.DeptCode; PSF.SaveOrUpdate <Activity>(NextActivityRej); TicketSystem.Status = NextActivityRej.ActivityName; PSF.SaveOrUpdate <TicketSystem>(TicketSystem); //CurrentActivity.WaitingFor = NextActivityRej.Id; //PSF.SaveOrUpdate(CurrentActivity); } } else { Activity NextActivity = new Activity(); NextActivity.CreatedDate = DateTime.Now; if (wfs.IsRejectionRequired == true) { NextActivity.IsRejApplicable = true; } NextActivity.ActivityName = wfs.WFStatus; NextActivity.ActivityFullName = wfs.Description; NextActivity.AppRole = wfs.Performer; NextActivity.Completed = wfs.WFStatus == "Complete" ? true : false; NextActivity.Available = wfs.WFStatus != "Complete" ? true : false; //NextActivity.Performer = userId; NextActivity.TemplateId = WorkFlowTemplate.Id; NextActivity.InstanceId = TicketSystem.InstanceId; NextActivity.NextActOrder = wfs.NextActOrder; NextActivity.ActivityOrder = wfs.ActivityOrder; NextActivity.PreviousActOrder = wfs.PreviousActOrder; NextActivity.ProcessRefId = TicketSystem.Id; NextActivity.Available = true; NextActivity.Assigned = false; NextActivity.Completed = false; NextActivity.BranchCode = TicketSystem.BranchCode; NextActivity.DeptCode = TicketSystem.DeptCode; PSF.SaveOrUpdate <Activity>(NextActivity); TicketSystem.Status = NextActivity.ActivityName; PSF.SaveOrUpdate <TicketSystem>(TicketSystem); } } retValue = true; } return(retValue); } catch (Exception) { throw; } }
private void Item_OnWorkTaskStatusChange(IWorkTask workTask) { if (WorkFlowStatus != WorkFlowStatus.Pending) { return; } if (workTask is IReviewReport) { var reviewReport = workTask as IReviewReport; if (reviewReport.ReviewReportStatus == ReviewReportStatus.NoPass) { if (WorkTaskStatus != WorkTaskStatus.Executing) { throw new Exception("工作任务不是执行状态,不将工作流程状态改为不通过状态!"); } WorkFlowStatus = WorkFlowStatus.NoPass; UpdateWorkTaskStatus(WorkTaskStatus.Executed); } else if (reviewReport.ReviewReportStatus == ReviewReportStatus.Pending) { WorkFlowStatus = WorkFlowStatus.Pending; if (WorkTaskStatus != WorkTaskStatus.Executed) { UpdateWorkTaskStatus(WorkTaskStatus.Executing); } } else if (reviewReport.ReviewReportStatus == ReviewReportStatus.Pass) { ExecutNextWorkTask(); } } else if (workTask is IDataReport) { var dataReport = workTask as IDataReport; if (dataReport.DataReportStatus == DataReportStatus.UnCommit) { WorkFlowStatus = WorkFlowStatus.Pending; if (WorkTaskStatus == WorkTaskStatus.Executed) { UpdateWorkTaskStatus(WorkTaskStatus.Executing); } } else if (dataReport.DataReportStatus == DataReportStatus.Commit) { ExecutNextWorkTask(); } } // 所有子任务状态为完成状态,工作流程状态改为完成 if (_workTasks.All(p => p.TaskCompletion)) { if (WorkTaskStatus != WorkTaskStatus.Executing) { throw new Exception("工作任务不是执行状态,不将工作流程状态改为通过状态!"); } WorkFlowStatus = WorkFlowStatus.Pass; UpdateWorkTaskStatus(WorkTaskStatus.Executed); } // 所有子任务转台为等待状态,工作流程状态改为等待 if (_workTasks.All(p => p.WorkTaskStatus == WorkTaskStatus.Waiting)) { if (WorkTaskStatus != WorkTaskStatus.Executing) { throw new Exception("工作任务不是执行状态,不将工作流程状态改为通过状态!"); } WorkFlowStatus = WorkFlowStatus.Pending; UpdateWorkTaskStatus(WorkTaskStatus.Waiting); } }
public async Task WhenPublishedWithDraftQueriedWithPublishStatus_ReturnsVersionWithWorkflowStatus(PublishStatusQuery publishStatus, WorkFlowStatus workFlowStatus) { var uniqueData = UNIQUE_PREFIX + "PubDraftQPubStatus_" + publishStatus; using var app = _appFactory.Create(); var directoryId = await app.TestData.PageDirectories().AddAsync(uniqueData); var pageId = await app.TestData.Pages().AddAsync(uniqueData, directoryId, c => c.Publish = true); var publishedVersionId = await app.TestData.Pages().AddDraftAsync(pageId); await app.TestData.Pages().PublishAsync(pageId); var draftVersionId = await app.TestData.Pages().AddDraftAsync(pageId); var expectedVersionId = workFlowStatus == WorkFlowStatus.Draft ? draftVersionId : publishedVersionId; var contentRepository = app.Services.GetContentRepositoryWithElevatedPermissions(); var page = await contentRepository .Pages() .GetById(pageId) .AsRenderDetails(publishStatus) .ExecuteAsync(); using (new AssertionScope()) { page.Should().NotBeNull(); page.PageId.Should().Be(pageId); page.PageVersionId.Should().Be(expectedVersionId); page.WorkFlowStatus.Should().Be(workFlowStatus); } }
protected override List <CustomCell> GetListViewSubItems(CheckLists item) { var stage = WorkFlowStage.GetItemById(item.AuditCheck.Settings.WorkflowStageId); var status = WorkFlowStatus.GetItemById(item.AuditCheck.Settings.WorkflowStatusId); if (stage == WorkFlowStage.Evaluation) { radGridView1.Columns["Finding"].IsVisible = false; radGridView1.Columns["Comments"].IsVisible = false; radGridView1.Columns["Condition"].IsVisible = false; radGridView1.Columns["Root Cause"].IsVisible = false; radGridView1.Columns["CA Due Date"].IsVisible = false; radGridView1.Columns["FAT Date"].IsVisible = false; radGridView1.Columns["VOI Date"].IsVisible = false; } else if (stage == WorkFlowStage.CAR) { radGridView1.Columns["Root Cause"].IsVisible = false; radGridView1.Columns["CA Due Date"].IsVisible = false; radGridView1.Columns["FAT Date"].IsVisible = false; radGridView1.Columns["VOI Date"].IsVisible = false; } else if (stage == WorkFlowStage.RCA) { radGridView1.Columns["Condition"].IsVisible = false; radGridView1.Columns["CA Due Date"].IsVisible = false; radGridView1.Columns["FAT Date"].IsVisible = false; radGridView1.Columns["VOI Date"].IsVisible = false; } else if (stage == WorkFlowStage.CAP || stage == WorkFlowStage.Closed) { radGridView1.Columns["Condition"].IsVisible = false; } var author = GlobalObjects.CaaEnvironment?.GetCorrector(item); var condition = "Unknown"; var root = ""; var finding = ""; var comments = ""; var fat = ""; var voi = ""; var due = ""; if (item.AuditCheck != null) { root = item.AuditCheck.Settings.RootCause; finding = item.AuditCheck.Settings.Findings; comments = item.AuditCheck.Settings.Comments; if (item.AuditCheck.Settings.FATDate.HasValue) { fat = SmartCore.Auxiliary.Convert.GetDateFormat(item.AuditCheck.Settings.FATDate.Value); if ((bool)item.Level?.CorrectiveAction.CalendarValue.HasValue) { due = SmartCore.Auxiliary.Convert.GetDateFormat(item.AuditCheck.Settings.FATDate.Value.AddDays(item.Level.CorrectiveAction.CalendarValue.Value)); } } if (item.AuditCheck.Settings.VOIDate.HasValue) { voi = SmartCore.Auxiliary.Convert.GetDateFormat(item.AuditCheck.Settings.VOIDate.Value); } if (item.AuditCheck.Settings.IsApplicable.HasValue && item.AuditCheck.Settings.IsApplicable.Value) { condition = "Not Applicable"; } else { if (item.AuditCheck.Settings.IsSatisfactory.HasValue) { if (item.AuditCheck.Settings.IsSatisfactory.Value) { condition = "Satisfactory"; } else { condition = "Not Satisfactory"; } } } } var auditor = Specialist.Unknown.FirstName; var auditee = Specialist.Unknown.FirstName; var current = ""; if (item.PelRecord != null) { auditor = $"{item.PelRecord?.Auditor.FirstName} {item.PelRecord?.Auditor.LastName}"; auditee = $"{item.PelRecord?.Auditee.FirstName} {item.PelRecord?.Auditee.LastName}"; if (item.PelRecord?.CurrentAuditor != null) { current = $"{item.PelRecord?.CurrentAuditor.FirstName} {item.PelRecord?.CurrentAuditor.LastName}"; } else { current = $"My Tasks"; } } var subItems = new List <CustomCell>() { CreateRow(item.Settings.SectionNumber, item.Settings.SectionNumber), CreateRow(item.Settings.SectionName, item.Settings.SectionName), CreateRow(item.Settings.PartNumber, item.Settings.PartNumber), CreateRow(item.Settings.PartName, item.Settings.PartName), CreateRow(item.Settings.SubPartNumber, item.Settings.SubPartNumber), CreateRow(item.Settings.SubPartName, item.Settings.SubPartName), CreateRow(item.Settings.ItemNumber, item.Settings.ItemNumber), CreateRow(item.Settings.Requirement, item.Settings.Requirement), CreateRow(finding, finding), CreateRow(comments, comments), CreateRow(item.Level.ToString(), item.Level), CreateRow(condition, condition), CreateRow(root, root), CreateRow(due, due), CreateRow(fat, item.AuditCheck.Settings.FATDate), CreateRow(voi, item.AuditCheck.Settings.VOIDate), CreateRow(stage.ToString(), stage), CreateRow(status.ToString(), status), CreateRow(auditor, item.PelRecord?.Auditor), CreateRow(auditee, item.PelRecord?.Auditee), CreateRow(current, item.PelRecord?.CurrentAuditor), CreateRow(author, author), }; return(subItems); }