Example #1
0
        private void addReactorButton_Click(object sender, EventArgs e)
        {
            EditChemicalReactorForm new_chemical = new EditChemicalReactorForm(null);

            new_chemical.ShowDialog();

            addReactorDataToTable(new_chemical.createdAgent);
        }
Example #2
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;
                }
            }
        }