Example #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            day   = mthAppointmentDate.SelectionEnd.Day;
            month = mthAppointmentDate.SelectionEnd.Month;
            year  = mthAppointmentDate.SelectionEnd.Year;
            DialogResult r = MessageBox.Show("Are you sure you want to SUBMIT?", "Doctors Appointment", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly);

            if (r == DialogResult.Yes)
            {
                using (cnn = new SqlConnection(PatientManagementSystem.Properties.Settings.Default.PatientDBConn))
                {
                    cnn.Open();
                    string insert = "INSERT INTO DoctorsAppointment"
                                    + "(DID,PID,AppmntDate,AppmntTimeIn,AppmntTimeOut,AppmntDay,AppmntMonth,AppmntYear,Image)"
                                    + "VALUES"
                                    + "(@DID,@PID,@AppmntDate,@AppmntTimeIn,@AppmntOut,@AppmntDay,@AppmntMonth,@AppmntYear,@Image)";
                    int k = verifyAppointments();
                    if (k == -1)
                    {
                        using (cmd = new SqlCommand(insert, cnn))
                        {
                            cmd.Parameters.AddWithValue("@DID", cmbDoctorID.Text);
                            cmd.Parameters.AddWithValue("@PID", cmbPatientID.Text);
                            cmd.Parameters.AddWithValue("@AppmntDate", mthAppointmentDate.SelectionEnd.ToShortDateString());
                            cmd.Parameters.AddWithValue("@AppmntTimeIn", mskTimeIn.Text);
                            cmd.Parameters.AddWithValue("@AppmntOut", mskTimeOut.Text);
                            cmd.Parameters.AddWithValue("@AppmntDay", day);
                            cmd.Parameters.AddWithValue("@AppmntMonth", month);
                            cmd.Parameters.AddWithValue("@AppmntYear", year);

                            MemoryStream ms = new MemoryStream();
                            picImage.Image.Save(ms, picImage.Image.RawFormat);
                            byte[]       data = ms.GetBuffer();
                            SqlParameter p    = new SqlParameter("@Image", SqlDbType.Image);
                            p.Value = data;
                            cmd.Parameters.Add(p);

                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Data Submitted Successfully!", "Doctors Appointment", MessageBoxButtons.OK,
                                            MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

                            this.Hide();
                            var frm = new frmDoctorsAppointment();
                            frm.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("This particular Doctor is booked", "Doctors Appointment");
                    }
                }
            }
        }
Example #2
0
 private void tsDoctorAppointment_Click(object sender, EventArgs e)
 {
     if (appnt == null)
     {
         appnt             = new frmDoctorsAppointment();
         appnt.MdiParent   = this;
         appnt.FormClosed += new FormClosedEventHandler(appnt_FormClosed);
         appnt.Show();
     }
     else
     {
         appnt.Activate();
         appnt.WindowState = FormWindowState.Normal;
     }
 }
Example #3
0
 void appnt_FormClosed(object sender, FormClosedEventArgs e)
 {
     appnt = null;
 }