コード例 #1
0
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            String date       = dateTimePicker.Value.ToString();
            String coststatus = Convert.ToString(comboBoxCostStatus.SelectedItem);
            String pat        = Convert.ToString(comboBoxPatient.SelectedItem);
            String time       = Convert.ToString(comboBoxTime.SelectedItem);
            String appstatus  = Convert.ToString(comboBoxTime.SelectedItem);
            String doc        = Convert.ToString(comboBoxDoc.SelectedItem);
            String rcost      = textCost.Text;
            Regex  regex      = new Regex("^[0-9]+$");


            if (textCost.Text != "" & textSickness.Text != "" & pat != "" & time != "" & appstatus != "" & coststatus != "" & doc != "" & regex.IsMatch(rcost))
            {
                ap = new HospitalInformation.Appointment(time, Convert.ToString(comboBoxPatient.SelectedItem), Convert.ToString(comboBoxDoc.SelectedItem), textSickness.Text, Convert.ToString(comboBoxAppStatus.SelectedItem), textCost.Text, coststatus, date);

                int row4d = qdal.existingapp(ap.PatientName, ap.DoctorName, ap.appdate, ap.Time, ap.appStatus);
                int row3d = qdal.existingDoc(ap.DoctorName, ap.appdate, ap.Time, ap.appStatus);
                int row3p = qdal.existingPat(ap.PatientName, ap.appdate, ap.Time, ap.appStatus);


                if (row4d > 0)
                {
                    MessageBox.Show("This Patient is already assigned to the given doctor");
                }
                else if (row3d > 0)
                {
                    MessageBox.Show("Doctor is not available");
                }
                else if (row3p > 0)
                {
                    MessageBox.Show("Patient is not available for the given time");
                }

                else
                {
                    double cost = HospitalInformation.Appointment.costcal(textCost.Text);
                    ap.Cost = Convert.ToString(cost);
                    int rows = qdal.CreateApp(ap);
                    if (rows > 0)
                    {
                        MessageBox.Show("Query Executed");
                    }
                }
            }
            else
            {
                MessageBox.Show("Fields shouldnot be empty or cpst should be number");
            }
        }
コード例 #2
0
        public int CreateApp(HospitalInformation.Appointment ap)
        {
            MySqlCommand command = new MySqlCommand();



            command.CommandType = CommandType.Text;
            command.CommandText = "insert into hospitalsystem.Appointment(Appointmentid,PatientName,Doctorname,appTime,Sickness,AppStatus,Cost,CostStatus,Appdate) values ('" + ap.ID + "','" + ap.PatientName + "','" + ap.DoctorName + "','" + ap.Time + "','" + ap.Sickness + "','" + ap.appStatus + "','" + ap.Cost + "','" + ap.costStatus + "','" + ap.appdate + "')";
            MySqlCommand command2 = new MySqlCommand();

            command2.CommandType = CommandType.Text;
            command2.CommandText = "insert into hospitalsystem.Log(log_event) values('New Appointment is added')";
            db.ExeNonQuery(command2);
            return(db.ExeNonQuery(command));
        }
コード例 #3
0
 public DeleteAppointment(HospitalInformation.Appointment ap)
 {
     InitializeComponent();
     this.ap = ap;
 }