Esempio n. 1
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     if (treeView1.SelectedNode.Tag is Ts)
     {
         FrmTsInputEdit_TsErrorCode frm             = Program.programContainer.GetExportedValue <FrmTsInputEdit_TsErrorCode>();
         OperationResult            operationResult = tsCompositionContainer.GetExportedValue <IFrmTsInputEditService>().TsErrorCauseEdit(((Ts)treeView1.Nodes[0].Tag).rcard);
         if (operationResult.ResultType == OperationResultType.Success)
         {
             TsErrorCauseSelectCollection tsErrorCauseSelectCollection = (TsErrorCauseSelectCollection)operationResult.AppendData;
             frm.listBox1.DataSource   = tsErrorCauseSelectCollection.errorCodeGroups;
             frm.listBox1.SelectedItem = null;
             frm.formStatus            = Frms.FrmTsInputEdit_TsErrorCode.Status.ADD;
             frm.ShowDialog();
             return;
         }
     }
     if (treeView1.SelectedNode.Tag is TsErrorCode)
     {
         FrmTsInputEdit_TsErrorCause frm             = Program.programContainer.GetExportedValue <FrmTsInputEdit_TsErrorCause>();
         OperationResult             operationResult = tsCompositionContainer.GetExportedValue <IFrmTsInputEditService>().TsErrorCauseEdit(((Ts)treeView1.Nodes[0].Tag).rcard);
         if (operationResult.ResultType == OperationResultType.Success)
         {
             TsErrorCauseSelectCollection tsErrorCauseSelectCollection = (TsErrorCauseSelectCollection)operationResult.AppendData;
             frm.listBox1.DataSource   = tsErrorCauseSelectCollection.errorComs;
             frm.listBox2.DataSource   = tsErrorCauseSelectCollection.errorCodeSeasonGroups;
             frm.listBox4.DataSource   = tsErrorCauseSelectCollection.Duties;
             frm.listBox5.DataSource   = tsErrorCauseSelectCollection.solutions;
             frm.listBox1.SelectedItem = null;
             frm.listBox2.SelectedItem = null;
             frm.listBox4.SelectedItem = null;
             frm.listBox5.SelectedItem = null;
             frm.tsErrorCode           = (TsErrorCode)treeView1.SelectedNode.Tag;
             frm.formStatus            = Frms.FrmTsInputEdit_TsErrorCause.Status.ADD;
             frm.ShowDialog();
         }
     }
 }
Esempio n. 2
0
        private void treeView1_DoubleClick(object sender, EventArgs e)
        {
            if (((TreeView)sender).SelectedNode.Tag is TsErrorCause)
            {
                FrmTsInputEdit_TsErrorCause frm             = Program.programContainer.GetExportedValue <FrmTsInputEdit_TsErrorCause>();
                OperationResult             operationResult = tsCompositionContainer.GetExportedValue <IFrmTsInputEditService>().TsErrorCauseEdit(((Ts)treeView1.Nodes[0].Tag).rcard);
                if (operationResult.ResultType == OperationResultType.Success)
                {
                    TsErrorCauseSelectCollection tsErrorCauseSelectCollection = (TsErrorCauseSelectCollection)operationResult.AppendData;
                    frm.listBox1.DataSource = tsErrorCauseSelectCollection.errorComs;
                    frm.listBox2.DataSource = tsErrorCauseSelectCollection.errorCodeSeasonGroups;
                    frm.listBox4.DataSource = tsErrorCauseSelectCollection.Duties;
                    frm.listBox5.DataSource = tsErrorCauseSelectCollection.solutions;
                    frm.textBox1.Text       = TBoxErrorCodeGroupDesc.Text;
                    frm.textBox2.Text       = TBoxErrorCodeDesc.Text;
                    frm.richTextBox1.Text   = RBoxPremunition.Text;
                    int index_listBoxe1 = frm.listBox1.FindString(currentTsErrorCause.errorCom.errorComponent);
                    if (index_listBoxe1 == -1)
                    {
                        MessageBox.Show("Item is not available in ListBox1");
                    }
                    else
                    {
                        frm.listBox1.SetSelected(index_listBoxe1, true);
                    }

                    int index_listBoxe2 = frm.listBox2.FindString(currentTsErrorCause.errorCodeSeason.ecsg.ecsgdesc);
                    if (index_listBoxe2 == -1)
                    {
                        MessageBox.Show("Item is not available in ListBox2");
                    }
                    else
                    {
                        frm.listBox2.SetSelected(index_listBoxe2, true);
                    }

                    int index_listBoxe4 = frm.listBox4.FindString(currentTsErrorCause.duty.dutydesc);
                    if (index_listBoxe4 == -1)
                    {
                        MessageBox.Show("Item is not available in ListBox4");
                    }
                    else
                    {
                        frm.listBox4.SetSelected(index_listBoxe4, true);
                    }

                    int index_listBoxe5 = frm.listBox5.FindString(currentTsErrorCause.solution.soldesc);
                    if (index_listBoxe5 == -1)
                    {
                        MessageBox.Show("Item is not available in ListBox5");
                    }
                    else
                    {
                        frm.listBox5.SetSelected(index_listBoxe5, true);
                    }
                    frm.formStatus = Frms.FrmTsInputEdit_TsErrorCause.Status.UPDATE;
                    frm.ShowDialog();
                }
            }
            if (((TreeView)sender).SelectedNode.Tag is TsErrorCode)
            {
                FrmTsInputEdit_TsErrorCode frm             = Program.programContainer.GetExportedValue <FrmTsInputEdit_TsErrorCode>();
                OperationResult            operationResult = tsCompositionContainer.GetExportedValue <IFrmTsInputEditService>().TsErrorCauseEdit(((Ts)treeView1.Nodes[0].Tag).rcard);
                if (operationResult.ResultType == OperationResultType.Success)
                {
                    TsErrorCauseSelectCollection tsErrorCauseSelectCollection = (TsErrorCauseSelectCollection)operationResult.AppendData;
                    frm.listBox1.DataSource = tsErrorCauseSelectCollection.errorCodeGroups;
                    int index_listBoxe1 = frm.listBox1.FindString(currentTsErrorCode.errorCode.ecg.ToString());
                    if (index_listBoxe1 == -1)
                    {
                        MessageBox.Show("Item is not available in ListBox1");
                    }
                    else
                    {
                        frm.listBox1.SetSelected(index_listBoxe1, true);
                    }
                    frm.formStatus = Frms.FrmTsInputEdit_TsErrorCode.Status.UPDATE;
                    frm.ShowDialog();
                }
            }
        }