コード例 #1
0
        private void concludeButton_Click(object sender, EventArgs e)
        {
            string container = "";

            if (transparentGlassRadioButton.Checked)
            {
                container += Resources.Language.pt_local.TemperedGlassContainer + "\n";
            }
            if (amberGlassRadioButton.Checked)
            {
                container += Resources.Language.pt_local.AmberGlassContainer + "\n";
            }
            if (plasticRadioButton.Checked)
            {
                container += Resources.Language.pt_local.PlasticContainer + "\n";
            }

            string origins = "";

            foreach (string item in originCheckedListBox.CheckedItems)
            {
                origins += item + "\n";
            }


            string dangers = "";

            foreach (string item in dangerCharacteristicsListBox.CheckedItems)
            {
                dangers += item + "\n";
            }


            // Create agent
            ChemicalReactor new_agent = new ChemicalReactor(
                residueNameTextBox.Text,
                physicalStateComboBox.Text,
                (float)quantityUpDown.Value,
                measurementUnitComboBox.Text,
                origins,
                casNumberTextBox.Text,
                mixedRadioButton.Checked ? mixedSubstanceTextBox.Text : "Pura",
                dangers,
                container,
                storageLocationTextBox.Text,
                inertRadioButton.Checked);

            try
            {
                new_agent.CheckValidity();
                this.createdAgent = new_agent;
                this.Close();
            }
            catch (Exception ex)
            {
                this.createdAgent = null;
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 private void addReactorDataToTable(ChemicalReactor createdAgent)
 {
     if (createdAgent != null)
     {
         this.chemicalReactorData.Rows.Add(
             createdAgent.name,
             createdAgent.physicalState,
             createdAgent.origin,  //
             createdAgent.quantity,
             createdAgent.measurementUnit,
             createdAgent.mixtureDescription,
             createdAgent.casNumber,
             createdAgent.dangerCharacteristics,  //
             createdAgent.inert,
             createdAgent.storageDetails,
             createdAgent.container
             );
     }
 }
コード例 #3
0
        private void editReactorButton_Click(object sender, EventArgs e)
        {
            if (chemicalReactorData.SelectedRows.Count > 0)
            {
                DataGridViewRow row = chemicalReactorData.SelectedRows[0];

                ChemicalReactor agent = new ChemicalReactor();
                agent.name                  = row.Cells[0].Value.ToString();
                agent.physicalState         = row.Cells[1].Value.ToString();
                agent.origin                = row.Cells[2].Value.ToString();
                agent.quantity              = (float)row.Cells[3].Value;
                agent.measurementUnit       = row.Cells[4].Value.ToString();
                agent.mixtureDescription    = row.Cells[5].Value.ToString();
                agent.casNumber             = row.Cells[6].Value.ToString();
                agent.dangerCharacteristics = row.Cells[7].Value.ToString();
                agent.inert                 = (bool)row.Cells[8].Value;
                agent.storageDetails        = row.Cells[9].Value.ToString();
                agent.container             = row.Cells[10].Value.ToString();

                EditChemicalReactorForm editReactorForm = new EditChemicalReactorForm(agent);
                editReactorForm.ShowDialog();

                if (editReactorForm.createdAgent != null)
                {
                    chemicalReactorData.Rows[row.Index].Cells[0].Value  = editReactorForm.createdAgent.name;
                    chemicalReactorData.Rows[row.Index].Cells[1].Value  = editReactorForm.createdAgent.physicalState;
                    chemicalReactorData.Rows[row.Index].Cells[2].Value  = editReactorForm.createdAgent.origin; //
                    chemicalReactorData.Rows[row.Index].Cells[3].Value  = editReactorForm.createdAgent.quantity;
                    chemicalReactorData.Rows[row.Index].Cells[4].Value  = editReactorForm.createdAgent.measurementUnit;
                    chemicalReactorData.Rows[row.Index].Cells[5].Value  = editReactorForm.createdAgent.mixtureDescription;
                    chemicalReactorData.Rows[row.Index].Cells[6].Value  = editReactorForm.createdAgent.casNumber;
                    chemicalReactorData.Rows[row.Index].Cells[7].Value  = editReactorForm.createdAgent.dangerCharacteristics; //
                    chemicalReactorData.Rows[row.Index].Cells[8].Value  = editReactorForm.createdAgent.inert;
                    chemicalReactorData.Rows[row.Index].Cells[9].Value  = editReactorForm.createdAgent.storageDetails;
                    chemicalReactorData.Rows[row.Index].Cells[10].Value = editReactorForm.createdAgent.container;
                }
            }
        }
コード例 #4
0
        public EditChemicalReactorForm(ChemicalReactor agent)
        {
            InitializeComponent();

            getAgentNames();

            if (agent != null)
            {
                residueNameTextBox.Text      = agent.name;
                physicalStateComboBox.Text   = agent.physicalState;
                quantityUpDown.Value         = (decimal)agent.quantity;
                measurementUnitComboBox.Text = agent.measurementUnit;
                casNumberTextBox.Text        = agent.casNumber;
                if (agent.inert)
                {
                    inertRadioButton.Checked = true;
                }
                else
                {
                    activeRadioButton.Checked = true;
                }
                isDangerousCheckBox.Checked = agent.dangerCharacteristics.Length > 0;
                storageLocationTextBox.Text = agent.storageDetails;
                if (agent.mixtureDescription == null || agent.mixtureDescription.Length <= 0)
                {
                    pureRadioButton.Checked  = true;
                    mixedRadioButton.Checked = false;
                }
                else
                {
                    pureRadioButton.Checked    = false;
                    mixedRadioButton.Checked   = true;
                    mixedSubstanceTextBox.Text = agent.mixtureDescription;
                }
            }
        }
コード例 #5
0
        private void CreateReactorList()
        {
            reactorData = new List <ChemicalReactor>();
            foreach (DataGridViewRow row in chemicalReactorData.Rows)
            {
                if (row.Cells[0] != null)
                {
                    ChemicalReactor agent = new ChemicalReactor();
                    agent.name                  = row.Cells[0].Value.ToString();
                    agent.physicalState         = row.Cells[1].Value.ToString();
                    agent.origin                = row.Cells[2].Value.ToString();
                    agent.quantity              = (float)row.Cells[3].Value;
                    agent.measurementUnit       = row.Cells[4].Value.ToString();
                    agent.mixtureDescription    = row.Cells[5].Value.ToString();
                    agent.casNumber             = row.Cells[6].Value.ToString();
                    agent.dangerCharacteristics = row.Cells[7].Value.ToString();
                    agent.inert                 = (bool)row.Cells[8].Value;
                    agent.storageDetails        = row.Cells[9].Value.ToString();
                    agent.container             = row.Cells[10].Value.ToString();

                    reactorData.Add(agent);
                }
            }
        }
コード例 #6
0
 private void cancelButton_Click(object sender, EventArgs e)
 {
     this.createdAgent = null;
     this.Close();
 }