private void AddBotMsg() { if ((_stageId == WorkFlowStage.CAR.ItemId && ((_auditCheck.Settings.IsApplicable.HasValue && _auditCheck.Settings.IsApplicable.Value) || (_auditCheck.Settings.IsSatisfactory.HasValue && _auditCheck.Settings.IsSatisfactory.Value))) || _stageId == WorkFlowStage.Closed.ItemId || _stageId == WorkFlowStage.CAP.ItemId) { return; } if (_stageId > WorkFlowStage.View.ItemId && _stageId < WorkFlowStage.RCA.ItemId) { var actions = new List <ChatCardAction> { new ChatCardAction("Accept") }; var imageCard = new ChatImageCardDataItem(null, "", "", $"Move to next stage({WorkFlowStage.GetItemById(_stageId + 1).FullName})?", actions, null); var message = new ChatCardMessage(imageCard, _author1, DateTime.Now); radChat2.AddMessage(message); } else if (_stageId >= WorkFlowStage.RCA.ItemId && _stageId < WorkFlowStage.Closed.ItemId) { var actions = new List <ChatCardAction> { new ChatCardAction("Accept"), new ChatCardAction("Reject") }; var imageCard = new ChatImageCardDataItem(null, "", "", $"Move to next stage({WorkFlowStage.GetItemById(_stageId + 1).FullName}) press Accept. " + $"Move to previous stage({WorkFlowStage.GetItemById(_stageId - 1).FullName}) press Reject. ", actions, null); var message = new ChatCardMessage(imageCard, _author1, DateTime.Now); radChat2.AddMessage(message); } }
private void button2_Click(object sender, EventArgs e) { var res = MessageBox.Show($"Do you really want move to previous stage({WorkFlowStage.GetItemById(_currentAuditCheck.Settings.WorkflowStageId + 1).FullName})?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (res == DialogResult.Yes) { _currentAuditCheck.Settings.FromWorkflowStageId = _currentAuditCheck.Settings.WorkflowStageId; _currentAuditCheck.Settings.WorkflowStageId -= 1; _currentAuditCheck.Settings.WorkflowStatusId = WorkFlowStatus.Open.ItemId; 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 stage Updated to {WorkFlowStage.GetItemById(_currentAuditCheck.Settings.WorkflowStageId)}!", WorkflowStageId = _currentAuditCheck.Settings.WorkflowStageId, IsWorkFlowChanged = true } }; GlobalObjects.CaaEnvironment.NewKeeper.Save(rec); _animatedThreadWorker.RunWorkerAsync(); Focus(); } }
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 void FillDisplayerRequestedParams(ReferenceEventArgs e) { if (SelectedItem != null) { var stage = WorkFlowStage.GetItemById(SelectedItem.WorkFlowStageId); e.RequestedEntity = new CheckListAuditScreen(GlobalObjects.CaaEnvironment.Operators.FirstOrDefault(), _operatorId, _audit.ItemId, _type, SelectedItem.WorkFlowStageId); e.DisplayerText = $"({stage}): {_audit.AuditNumber}"; e.TypeOfReflection = ReflectionTypes.DisplayInNew; } }
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 button1_Click(object sender, EventArgs e) { var res = MessageBox.Show($"Do you really want move to next stage({WorkFlowStage.GetItemById(_currentAuditCheck.Settings.WorkflowStageId + 1).FullName})?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (res == DialogResult.Yes) { if (radioButtonNotSatisfactory.Checked && string.IsNullOrEmpty(metroTextBoxFindings.Text)) { MessageBox.Show($"Please input some text in Findings and then save current CheckList!", "Exclamation", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); return; } ApplyChanges(); foreach (var control in flowLayoutPanel1.Controls.OfType <AuditCheckControl>()) { control.ApplyChanges(); GlobalObjects.CaaEnvironment.NewKeeper.Save(control.AuditCheckRecord, true); } DialogResult = DialogResult.OK; Close(); _currentAuditCheck.Settings.FromWorkflowStageId = _currentAuditCheck.Settings.WorkflowStageId; _currentAuditCheck.Settings.WorkflowStageId += 1; _currentAuditCheck.Settings.WorkflowStatusId = WorkFlowStatus.Open.ItemId; GlobalObjects.CaaEnvironment.NewKeeper.Save(_currentAuditCheck); var rec = new CheckListTransfer() { Created = DateTime.Now, From = GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId, To = GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId, AuditId = _auditId, CheckListId = _currentAuditCheck.CheckListId, Settings = new CheckListTransferSettings() { Remark = $"Workflow stage Updated to {WorkFlowStage.GetItemById(_currentAuditCheck.Settings.WorkflowStageId)}!", WorkflowStageId = _currentAuditCheck.Settings.WorkflowStageId, IsWorkFlowChanged = true } }; GlobalObjects.CaaEnvironment.NewKeeper.Save(rec); _currentCheck.AuditCheck = _currentAuditCheck; _animatedThreadWorker.RunWorkerAsync(); Focus(); } }
protected override List <CustomCell> GetListViewSubItems(AuditPublish item) { var subItems = new List <CustomCell>(); var stage = WorkFlowStage.GetItemById(item.WorkFlowStageId); subItems.AddRange(new List <CustomCell>() { CreateRow($"{stage.Order}.{stage}", stage), CreateRow($"{item.AllTask}", item.AllTask), CreateRow($"{item.TaskInProgress}", item.TaskInProgress), CreateRow($"{item.Persent}", item.Persent), }); return(subItems); }
private void BackgroundWorkerRunWorkerLoadCompleted(object sender, RunWorkerCompletedEventArgs e) { if (_groups.All(i => !i.WorkflowId.HasValue)) { _groups.Add(ComboboxItem.All); _groups.AddRange(_records.Where(i => i.To > -1 && i.From > -1).GroupBy(i => i.WorkflowStageId) .Select(i => new ComboboxItem() { Name = WorkFlowStage.GetItemById(i.Key).ToString(), WorkflowId = i.Key })); comboBoxWF.Items.Clear(); comboBoxWF.Items.AddRange(_groups.ToArray()); this.comboBoxWF.SelectedIndexChanged -= new System.EventHandler(this.comboBoxWF_SelectedIndexChanged); comboBoxWF.SelectedItem = _selectedItem; this.comboBoxWF.SelectedIndexChanged += new System.EventHandler(this.comboBoxWF_SelectedIndexChanged); } radChat2.ChatElement.MessagesViewElement.Items.Clear(); var chatData = _records.Where(i => i.To > -1 && i.From > -1); if (_selectedItem.WorkflowId.HasValue) { chatData = chatData.Where(i => i.WorkflowStageId == _selectedItem.WorkflowId.Value); } foreach (var transfer in chatData) { if (transfer.From == GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId && transfer.To == GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId) { AddAuditorMsg(transfer); } else if (transfer.From == _auditor.SpecialistId) { AddAuditorMsg(transfer); } else { AddAuditeeMsg(transfer); } } }
private void ControlOnReject(object sender, EventArgs e) { var item = sender as CheckListCAPItem; var wf = item._workFlowStatus; item.ApplyChanges(); var res = MessageBox.Show(wf == WorkFlowStatus.IA ? $"Do you really want move to previous stage({WorkFlowStage.GetItemById(_currentAuditCheck.Settings.WorkflowStageId - 1)})?": $"Do you really want move to previous status({WorkFlowStatus.GetItemById(wf.ItemId - 1)})?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (res == DialogResult.Yes) { if (wf == WorkFlowStatus.IA) { _currentAuditCheck.Settings.FromWorkflowStageId = _currentAuditCheck.WorkflowStageId; _currentAuditCheck.Settings.WorkflowStageId = _currentAuditCheck.WorkflowStageId - 1; 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 stage Updated to {WorkFlowStage.GetItemById(_currentAuditCheck.WorkflowStageId- 1)}!", WorkflowStageId = _currentAuditCheck.WorkflowStageId, IsWorkFlowChanged = true, } }; GlobalObjects.CaaEnvironment.NewKeeper.Save(rec); DialogResult = DialogResult.OK; Close(); } else { if (_currentAuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.VOI.ItemId) { _currentAuditCheck.Settings.VOIDate = null; } else if (_currentAuditCheck.Settings.WorkflowStatusId == WorkFlowStatus.FAT.ItemId) { _currentAuditCheck.Settings.FATDate = null; } _currentAuditCheck.Settings.FromWorkflowStatusId = wf.ItemId; _currentAuditCheck.Settings.WorkflowStatusId = wf.ItemId - 1; 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(); }
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); }