Exemplo n.º 1
0
        //Loads the next form to add a new consultation
        private void Add_Consultation_Click(object sender, EventArgs e)
        {
            if (Dropdown_1.SelectedIndex == -1 || Dropdown_2.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a patient and a time period", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Global.consTimePeriod = Dropdown_2.SelectedItem.ToString();
            this.Hide();
            Add_Edit_Consultation_2 addCons2 = new Add_Edit_Consultation_2();

            addCons2.ShowDialog();
            addCons2.Focus();
        }
Exemplo n.º 2
0
        //Opens the Add_Edit_Consultation_2 in an edit session
        private void Edit_Consultation_Click(object sender, EventArgs e)
        {
            //Checks if there are any consultations for the patient
            if (Existing_Consultations.Rows.Count == 0)
            {
                MessageBox.Show("There are no existing conultations for this patient", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Checks if the user has selected a consultation
            if (Existing_Consultations.SelectedRows.Count == 0)
            {
                MessageBox.Show("Please select a consultation from the List To edit", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Getting the CONS_ID_Number, date and time period for the selected existing consultation
            int cellIndex = Existing_Consultations.SelectedCells[0].RowIndex;
            DataGridViewCell cellCollection = Existing_Consultations.Rows[cellIndex].Cells[0];

            Global.consID = cellCollection.Value.ToString();

            cellCollection        = Existing_Consultations.Rows[cellIndex].Cells[1];
            Global.consTimePeriod = cellCollection.Value.ToString();

            cellCollection = Existing_Consultations.Rows[cellIndex].Cells[2];
            string tempDate = cellCollection.Value.ToString();

            Global.consDate = Convert.ToDateTime(tempDate);

            Global.editingExistingConsulation = true;

            //Loads Add_Edit_Consultation_2
            this.Hide();
            Add_Edit_Consultation_2 addCons2 = new Add_Edit_Consultation_2();

            addCons2.ShowDialog();
            addCons2.Focus();
        }