private void DeleteAppointment_Load(object sender, EventArgs e)
 {
     dt = qdal.AppInfo();
     dataGridViewAppDelete.DataSource = dt;
 }
예제 #2
0
        private void buttonca_Click(object sender, EventArgs e)
        {
            Regex  regex      = new Regex("^[0-9]+$");
            String appdate    = dateTimePicker.Value.ToString();
            String pat        = Convert.ToString(comboBoxPat.SelectedItem);
            String apptime    = Convert.ToString(comboBoxTime.SelectedItem);
            String appstatus  = Convert.ToString(comboBoxAppStatus.SelectedItem);
            String doc        = Convert.ToString(comboBoxDoc.SelectedItem);
            String coststatus = Convert.ToString(comboBoxCostStatus.SelectedItem);

            if (textCost.Text != "" & textSickness.Text != "" & pat != "" & apptime != "" & appstatus != "" & coststatus != "" & doc != "" & regex.IsMatch(textCost.Text))
            {
                //   string q = "Update hospitalsystem.Patient set LastName='" + textLastName.Text + "', FirstName='" + textFirstName.Text + "',  psswd ='" + textPassword.Text + "', Address='" + textAddress.Text + "', Phone='" + textPhone.Text + "', DOB ='" + dob + "' where username='******';";

                int row4d = qdal.existingappD(pat, doc, appdate, apptime, appstatus);
                int row3d = qdal.existingDocPa(doc, appdate, apptime, appstatus, pat);
                int row3p = qdal.existingPatp(pat, appdate, apptime, appstatus);

                if (appstatus.Equals("Scheduled"))
                {
                    if (row4d > 0)
                    {
                        MessageBox.Show("This Patient is already assigned to the another doctor");
                    }

                    else if (row3d > 0)
                    {
                        MessageBox.Show("Doctor is not available");
                    }
                    //else if (row3p > 0) {

                    //    MessageBox.Show("Patient is not available");
                    //}

                    else
                    {
                        qdal.AppUpdate(textSickness.Text, pat, doc, textCost.Text, appstatus, coststatus, appdate, apptime, textAppId.Text);
                        MessageBox.Show("App Updated");
                        dt = qdal.AppInfo();
                        comboBoxPat.SelectedIndex        = -1;
                        comboBoxAppStatus.SelectedIndex  = -1;
                        comboBoxTime.SelectedIndex       = -1;
                        comboBoxCostStatus.SelectedIndex = -1;
                        textAppId.Clear();
                        comboBoxDoc.SelectedIndex = -1;
                        textCost.Clear();
                        textSickness.Clear();
                        dateTimePicker.Value = DateTime.Now;
                    }
                }

                else
                {
                    qdal.DocAppUpdate(textSickness.Text, pat, textCost.Text, appstatus, coststatus, appdate, apptime, textAppId.Text);
                    MessageBox.Show("App Updated");
                    dt = qdal.AppInfo();
                    comboBoxPat.SelectedIndex        = -1;
                    comboBoxAppStatus.SelectedIndex  = -1;
                    comboBoxTime.SelectedIndex       = -1;
                    comboBoxCostStatus.SelectedIndex = -1;
                    textAppId.Clear();
                    comboBoxDoc.SelectedIndex = -1;
                    textCost.Clear();
                    textSickness.Clear();
                    dateTimePicker.Value = DateTime.Now;
                }
            }
            else
            {
                MessageBox.Show("No fields Should be blank or cost should ne a number");
            }
        }