Ejemplo n.º 1
0
 public void addResidueDataToTable(ChemicalResidue createdAgent)
 {
     if (createdAgent != null)
     {
         this.chemicalResidueData.Rows.Add(
             createdAgent.name,
             createdAgent.physicalState,
             createdAgent.origin, //
             createdAgent.quantity,
             createdAgent.measurementUnit,
             createdAgent.dangerous,
             createdAgent.dangerCharacteristics, //
             createdAgent.inert,
             createdAgent.storageDetails,
             createdAgent.container
             );
     }
 }
Ejemplo n.º 2
0
 public EditChemicalResidueForm(ChemicalResidue agent)
 {
     InitializeComponent();
     if (agent != null)
     {
         residueNameTextBox.Text      = agent.name;
         physicalStateComboBox.Text   = agent.physicalState;
         quantityUpDown.Value         = (decimal)agent.quantity;
         measurementUnitComboBox.Text = agent.measurementUnit;
         if (agent.inert)
         {
             inertRadioButton.Checked = true;
         }
         else
         {
             activeRadioButton.Checked = true;
         }
         isDangerousCheckBox.Checked = agent.dangerCharacteristics.Length > 0;
         storageLocationTextBox.Text = agent.storageDetails;
     }
 }
Ejemplo n.º 3
0
        private void CreateResidueList()
        {
            residueData = new List <ChemicalResidue>();
            foreach (DataGridViewRow row in chemicalResidueData.Rows)
            {
                if (row.Cells[0] != null)
                {
                    ChemicalResidue agent = new ChemicalResidue();
                    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.dangerous             = (bool)row.Cells[5].Value;
                    agent.dangerCharacteristics = row.Cells[6].Value.ToString();
                    agent.inert                 = (bool)row.Cells[7].Value;
                    agent.storageDetails        = row.Cells[8].Value.ToString();
                    agent.container             = row.Cells[9].Value.ToString();

                    residueData.Add(agent);
                }
            }
        }
Ejemplo n.º 4
0
        private void editResidueButton_Click(object sender, EventArgs e)
        {
            if (chemicalResidueData.SelectedRows.Count > 0)
            {
                DataGridViewRow row = chemicalResidueData.SelectedRows[0];

                ChemicalResidue agent = new ChemicalResidue();
                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.dangerous             = (bool)row.Cells[5].Value;
                agent.dangerCharacteristics = row.Cells[6].Value.ToString();
                agent.inert                 = (bool)row.Cells[7].Value;
                agent.storageDetails        = row.Cells[8].Value.ToString();
                agent.container             = row.Cells[9].Value.ToString();

                EditChemicalResidueForm editResidueForm = new EditChemicalResidueForm(agent);
                editResidueForm.ShowDialog();

                if (editResidueForm.createdAgent != null)
                {
                    chemicalResidueData.Rows[row.Index].Cells[0].Value = editResidueForm.createdAgent.name;
                    chemicalResidueData.Rows[row.Index].Cells[1].Value = editResidueForm.createdAgent.physicalState;
                    chemicalResidueData.Rows[row.Index].Cells[2].Value = editResidueForm.createdAgent.origin; //
                    chemicalResidueData.Rows[row.Index].Cells[3].Value = editResidueForm.createdAgent.quantity;
                    chemicalResidueData.Rows[row.Index].Cells[4].Value = editResidueForm.createdAgent.measurementUnit;
                    chemicalResidueData.Rows[row.Index].Cells[5].Value = editResidueForm.createdAgent.dangerous;
                    chemicalResidueData.Rows[row.Index].Cells[6].Value = editResidueForm.createdAgent.dangerCharacteristics; //
                    chemicalResidueData.Rows[row.Index].Cells[7].Value = editResidueForm.createdAgent.inert;
                    chemicalResidueData.Rows[row.Index].Cells[8].Value = editResidueForm.createdAgent.storageDetails;
                    chemicalResidueData.Rows[row.Index].Cells[9].Value = editResidueForm.createdAgent.container;
                }
            }
        }
Ejemplo n.º 5
0
 private void cancelButton_Click(object sender, EventArgs e)
 {
     this.createdAgent = null;
     this.Close();
 }
Ejemplo n.º 6
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
            ChemicalResidue new_agent =
                new ChemicalResidue(
                    residueNameTextBox.Text,
                    physicalStateComboBox.Text,
                    inertRadioButton.Checked,
                    (float)quantityUpDown.Value,
                    measurementUnitComboBox.Text,
                    origins,
                    isDangerousCheckBox.Checked,
                    dangers,
                    container,
                    storageLocationTextBox.Text
                    );

            try
            {
                new_agent.CheckValidity();
                this.createdAgent = new_agent;
                this.Close();
            }
            catch (Exception ex)
            {
                this.createdAgent = null;
                MessageBox.Show(ex.Message);
            }
        }