Ejemplo n.º 1
0
        // Search for specific person
        private void Search_for_Patient_Click(object sender, EventArgs e)
        {
            String Option    = Inv_Search_options_comboBox.Text;
            String SearchKey = indv_Search_key_textBox.Text;
            int    ID;

            if (!ValidateData.ValidateComboBoxItem(Option, new List <String> {
                "ID", "Home Number", "Mobile Number"
            }))
            {
                Error.SetError(Inv_Search_options_comboBox, "Please enter validate search option");
                return;
            }
            Error.Clear();

            if (!ValidateData.ValidateIntSearchKey(SearchKey))
            {
                Error.SetError(indv_Search_key_textBox, "Please enter validate search key");
                return;
            }
            Error.Clear();

            if (Option == "ID")
            {
                ID = Int32.Parse(SearchKey);
            }
            else
            {
                if (CheckIfExist(Option, SearchKey) == false)
                {
                    return;
                }

                ID = GetID(Option, SearchKey);
            }

            Patient_Profile_Viewer ViewPatient = new Patient_Profile_Viewer(ID);

            if (ViewPatient.CheckBoxIfExist())
            {
                ViewPatient.Show();
            }

            Inv_Search_options_comboBox.Text = "";
            indv_Search_key_textBox.Text     = "";
        }
        private void Get_Proc_Number_Button_Click(object sender, EventArgs e)
        {
            String        Choise        = Procedures_comboBox.Text;
            List <String> ComboBoxItems = new List <String>();

            for (int i = 0; i < Procedures_comboBox.Items.Count; i++)
            {
                ComboBoxItems.Add(Procedures_comboBox.GetItemText(Procedures_comboBox.Items[i]));
            }

            if (!ValidateData.ValidateComboBoxItem(Choise, ComboBoxItems))
            {
                Error.SetError(Procedures_comboBox, "shdf");
                return;
            }
            Error.Clear();

            try
            {
                var NumOftimes = (from P in Stats.Dates.Where(P => P.Procedures == Choise) select P).Count();

                if (NumOftimes == 0)
                {
                    MessageBox.Show(Choise + " Procedure was NOT performed at all");
                }
                else if (NumOftimes == 1)
                {
                    MessageBox.Show(Choise + " Procedure was performed " + NumOftimes.ToString() + " time.");
                }
                else
                {
                    MessageBox.Show(Choise + " Procedure was performed " + NumOftimes.ToString() + " times.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }