Exemple #1
0
        private void ButtonRegisterActualStateClick(object sender, EventArgs e)
        {
            ActualStateDialog actualStateDialog = new ActualStateDialog(_currentComponent)
            {
                Text = "Add new Actual state record"
            };

            actualStateDialog.ShowDialog();
            if (actualStateDialog.DialogResult == DialogResult.OK)
            {
                InvokeComplianceAdded(null);
            }
        }
Exemple #2
0
        private void AddPerformance()
        {
            if (listViewCompliance.SelectedItems.Count == 0)
            {
                return;
            }

            ActualStateDialog                    actualStateDialog;
            DirectiveComplianceDialog            detailDirectiveDlg;
            ComponentChangeLLPCategoryRecordForm changeLLPCategoryDlg;
            ComponentLLPCategoryChangeRecord     componentLLPCategoryChangeRecord;

            ActualStateRecord  actualStateRecord;
            Component          component;
            DirectiveRecord    record;
            ComponentDirective directive;

            if (listViewCompliance.SelectedItems[0].Tag is NextPerformance)
            {
                var np = (NextPerformance)listViewCompliance.SelectedItems[0].Tag;
                //if (np.Condition != ConditionState.Overdue || np.PerformanceDate > DateTime.Now)
                //{
                //    MessageBox.Show("You can not enter a record for not delayed performance",
                //                    (string)new GlobalTermsProvider()["SystemName"],
                //                    MessageBoxButtons.OK,
                //                    MessageBoxIcon.Warning,
                //                    MessageBoxDefaultButton.Button1);
                //    return;
                //}
                if (np.BlockedByPackage != null)
                {
                    MessageBox.Show("Perform of the task:" + listViewCompliance.SelectedItems[0].Text +
                                    "\nblocked by Work Package:" +
                                    "\n" + np.BlockedByPackage.Title,
                                    (string)new GlobalTermsProvider()["SystemName"],
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning,
                                    MessageBoxDefaultButton.Button1);
                    return;
                }
                detailDirectiveDlg = new DirectiveComplianceDialog(np.Parent, np)
                {
                    Text = "Add new compliance for " + np.WorkType
                };
                detailDirectiveDlg.ShowDialog();
                if (detailDirectiveDlg.DialogResult == DialogResult.OK)
                {
                    InvokeComplianceAdded(null);
                }
            }
            else if (listViewCompliance.SelectedItems[0].Tag is DirectiveRecord)
            {
                record = (DirectiveRecord)listViewCompliance.SelectedItems[0].Tag;
                //if (record.DirectivePackage != null)
                //{
                //    MessageBox.Show("Perform of the task:" + listViewCompliance.SelectedItems[0].Text +
                //                    "\nadded by Work Package:" +
                //                    "\n" + record.DirectivePackage.Title +
                //                    "\nTo remove a performance of task, you need to exclude task from this work package," +
                //                    "\nor delete the work package ",
                //                    (string)new GlobalTermsProvider()["SystemName"],
                //                    MessageBoxButtons.OK,
                //                    MessageBoxIcon.Warning,
                //                    MessageBoxDefaultButton.Button1);
                //    return;
                //}

                directive               = (ComponentDirective)record.Parent;
                detailDirectiveDlg      = new DirectiveComplianceDialog(directive, record);
                detailDirectiveDlg.Text = "Edit exist compliance for " + directive.DirectiveType;
                detailDirectiveDlg.ShowDialog();
                if (detailDirectiveDlg.DialogResult == DialogResult.OK)
                {
                    InvokeComplianceAdded(null);
                }
            }
            else if (listViewCompliance.SelectedItems[0].Tag is ComponentLLPCategoryChangeRecord)
            {
                componentLLPCategoryChangeRecord = (ComponentLLPCategoryChangeRecord)listViewCompliance.SelectedItems[0].Tag;
                component = componentLLPCategoryChangeRecord.ParentComponent;
                if (component == null)
                {
                    component = _currentComponent;
                }
                changeLLPCategoryDlg      = new ComponentChangeLLPCategoryRecordForm(component, componentLLPCategoryChangeRecord);
                changeLLPCategoryDlg.Text = "Edit exist Change LLP Category record";
                changeLLPCategoryDlg.ShowDialog();
                if (changeLLPCategoryDlg.DialogResult == DialogResult.OK)
                {
                    InvokeComplianceAdded(null);
                }
            }
            else if (listViewCompliance.SelectedItems[0].Tag is ActualStateRecord)
            {
                actualStateRecord      = (ActualStateRecord)listViewCompliance.SelectedItems[0].Tag;
                actualStateDialog      = new ActualStateDialog(actualStateRecord);
                actualStateDialog.Text = "Edit exist Actual state record";
                actualStateDialog.ShowDialog();
                if (actualStateDialog.DialogResult == DialogResult.OK)
                {
                    InvokeComplianceAdded(null);
                }
            }
            else
            {
                return;
            }
        }