public static void BookDoctorByPatient(int doctorId, int patientID, ComboBox comboBox)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            DoctorBooking db = null;

            try
            {
                db = new DoctorBooking()
                {
                    DrId        = doctorId,
                    PId         = patientID,
                    BookingTime = comboBox.Text,
                    BookingDate = DateTime.Now.AddDays(1).ToShortDateString()
                };

                dp.DoctorBookings.InsertOnSubmit(db);
                dp.SubmitChanges();

                MessageBox.Show("Booked successfully", "Query Result");
            }catch (Exception)
            {
                MessageBox.Show("Failed to set the time", "Query Result");
            }
        }
Exemple #2
0
        public static void DoctorProfileUpdate(string emailID, List <TextBox> textBoxList, ComboBox comboBox1, DateTimePicker dateTimePicker1)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            try
            {
                Doctor dr = dp.Doctors.FirstOrDefault(drl => drl.Email_ID.Equals(emailID)); //Email must be from constructor value
                dr.First_Name     = textBoxList[0].Text;
                dr.Last_Name      = textBoxList[1].Text;
                dr.Password       = textBoxList[3].Text;
                dr.Contact_Number = textBoxList[4].Text;
                dr.Address        = textBoxList[5].Text;
                dr.Blood_Group    = comboBox1.Text;
                dr.Gender         = textBoxList[6].Text;
                dr.Birth_Date     = dateTimePicker1.Value;

                dp.SubmitChanges();

                MessageBox.Show("Dr. information updated", "Result");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().Name + ", " + ex.Message);
            }
        }
Exemple #3
0
        public static void DeletePatient(int PatientID)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            try
            {
                Patient p = dp.Patients.FirstOrDefault(dl => dl.Id.Equals(PatientID));

                dp.Patients.DeleteOnSubmit(p);
                dp.SubmitChanges();
                MessageBox.Show("Patient Deleted", "Query Result");
            }
            catch (Exception ex)
            {
                MessageBox.Show("No data found on the database..." + ex.GetType().Name + ex.Message, "Query Result");
            }
        }
Exemple #4
0
        public static bool DeleteDoctor(string userID)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            try
            {
                Doctor d = dp.Doctors.FirstOrDefault(dl => dl.Id.Equals(userID));

                dp.Doctors.DeleteOnSubmit(d);
                dp.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                MessageBox.Show("No data found on the database...", "Query Result");
                return(false);
            }
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Admin ad = dp.Admins.FirstOrDefault(adml => adml.Email_ID.Equals(emailID)); //Email must be from constructor value
                ad.First_Name     = textBox1.Text;
                ad.Last_Name      = textBox2.Text;
                ad.Password       = textBox4.Text;
                ad.Contact_Number = textBox5.Text;
                ad.Address        = textBox6.Text;
                ad.Blood_Group    = comboBox1.Text;
                ad.Gender         = textBox8.Text;
                ad.Birth_Date     = dateTimePicker1.Value;

                dp.SubmitChanges();
                MessageBox.Show("Information updated", "Result");
            }catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().Name);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("First Name must be filled up", "Notification");
            }
            else if (textBox2.Text == "")
            {
                MessageBox.Show("Last Name must be filled up", "Notification");
            }
            else if (textBox3.Text == "")
            {
                MessageBox.Show("Email id must be filled up", "Notification");
            }
            else if (passwordText.Text == "")
            {
                MessageBox.Show("Password text must be filled up", "Notification");
            }
            else if (confirmPasswordText.Text == "")
            {
                MessageBox.Show("Confirm password text must be filled up", "Notification");
            }
            else if (textBox6.Text == "")
            {
                MessageBox.Show("Please provide a contact number", "Notification");
            }
            else if (textBox7.Text == "")
            {
                MessageBox.Show("Address must be filled up", "Notification");
            }
            else if (comboBox1.Text == "")
            {
                MessageBox.Show("Please select blood group", "Notification");
            }
            else if (passwordText.Text != confirmPasswordText.Text)
            {
                MessageBox.Show("Password mismatched", "Notification");
            }
            else
            {
                try
                {
                    Patient pt = new Patient
                    {
                        First_Name     = textBox1.Text,
                        Last_Name      = textBox2.Text,
                        Email_ID       = textBox3.Text,
                        Password       = passwordText.Text,
                        Contact_Number = textBox6.Text,
                        Address        = textBox7.Text,
                        Blood_Group    = comboBox1.Text,
                        Birth_Date     = dateTimePicker1.Value,
                        //Photo = ConvertFileToByte(pictureBox2.ImageLocation)
                    };

                    List <CheckBox> listOfCheckBox = new List <CheckBox>();
                    listOfCheckBox.Add(checkBox1);
                    listOfCheckBox.Add(checkBox2);
                    listOfCheckBox.Add(checkBox3);

                    if (listOfCheckBox[0].Checked == true && listOfCheckBox[1].Checked == false && listOfCheckBox[2].Checked == false)
                    {
                        pt.Gender = "Male";
                    }
                    else if (listOfCheckBox[0].Checked == false && listOfCheckBox[1].Checked == true && listOfCheckBox[2].Checked == false)
                    {
                        pt.Gender = "Female";
                    }
                    else if (listOfCheckBox[0].Checked == false && listOfCheckBox[1].Checked == false && listOfCheckBox[2].Checked == true)
                    {
                        pt.Gender = "Other";
                    }

                    dp.Patients.InsertOnSubmit(pt);
                    dp.SubmitChanges();
                    label12.Text = "Information successfully updated";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.GetType().Name + ", " + ex.Message, "Query Result");
                }
            }
        }
Exemple #7
0
        public static void DoctorAvailableTimeSetToDB(string emailID, string fromTime, string toTime, int drID)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            List <string> fromTimeList = new List <string>();

            fromTimeList.Add("8:00 AM");
            fromTimeList.Add("9:00 AM");
            fromTimeList.Add("10:00 AM");
            fromTimeList.Add("11:00 AM");
            fromTimeList.Add("12:00 PM");
            fromTimeList.Add("1:00 PM");
            fromTimeList.Add("2:00 PM");
            fromTimeList.Add("3:00 PM");
            fromTimeList.Add("4:00 PM");
            fromTimeList.Add("5:00 PM");
            fromTimeList.Add("6:00 PM");

            List <string> toTimeList = new List <string>();

            toTimeList.Add("12:00 PM");
            toTimeList.Add("1:00 PM");
            toTimeList.Add("2:00 PM");
            toTimeList.Add("3:00 PM");
            toTimeList.Add("4:00 PM");
            toTimeList.Add("5:00 PM");
            toTimeList.Add("6:00 PM");
            toTimeList.Add("7:00 PM");
            toTimeList.Add("8:00 PM");
            toTimeList.Add("9:00 PM");

            string[] arrayList = new string[11];
            int      i = 0, l = 0;

            foreach (string f in fromTimeList)
            {
                arrayList[i] = f;
                i++;
            }

            for (int j = 0; j < arrayList.Length; j++)
            {
                if (arrayList[j] == fromTime)
                {
                    l = j;
                }
            }
            for (int m = 0; m < l; m++)
            {
                arrayList[m] = "";
            }

            //new area 2

            string[] arrayList2 = new string[10];
            int      i2 = 0, l2 = 0;

            foreach (string f in toTimeList)
            {
                arrayList2[i2] = f;
                i2++;
            }

            for (int kk = 0; kk < arrayList2.Length; kk++)
            {
                if (arrayList2[kk] == arrayList[arrayList.Length - 1])
                {
                    l2 = arrayList2[kk].Length;
                }
            }

            for (int m = 0; m < l2; m++)
            {
                arrayList2[m] = "";
            }

            int s1 = 0;

            for (int s = 0; s < arrayList2.Length; s++)
            {
                if (arrayList2[s] == toTime)
                {
                    s1 = s;
                }
            }

            for (int s3 = arrayList2.Length - 1; s3 > s1; s3--)
            {
                arrayList2[s3] = "";
            }
            string          dt;
            DoctorAvailable ad = null;

            try
            {
                ad = new DoctorAvailable();

                ad.DoctorId        = drID;
                ad.CurrentDateTime = dt = DateTime.Now.AddDays(1).ToShortDateString();
                ad.FromTime1       = arrayList[0];
                ad.FromTime2       = arrayList[1];
                ad.FromTime3       = arrayList[2];
                ad.FromTime4       = arrayList[3];
                ad.FromTime5       = arrayList[4];
                ad.FromTime6       = arrayList[5];
                ad.FromTime7       = arrayList[6];
                ad.FromTime8       = arrayList[7];
                ad.FromTime9       = arrayList[8];
                ad.FromTime10      = arrayList[9];
                ad.FromTime11      = arrayList[10];

                ad.ToTime1  = arrayList2[0];
                ad.ToTime2  = arrayList2[1];
                ad.ToTime3  = arrayList2[2];
                ad.ToTime4  = arrayList2[3];
                ad.ToTime5  = arrayList2[4];
                ad.ToTime6  = arrayList2[5];
                ad.ToTime7  = arrayList2[6];
                ad.ToTime8  = arrayList2[7];
                ad.ToTime9  = arrayList2[8];
                ad.ToTime10 = arrayList2[9];

                dp.DoctorAvailables.InsertOnSubmit(ad);
                dp.SubmitChanges();
                MessageBox.Show("Available time set successfully...", "Query Result");
            }
            catch (Exception ex)
            {
                MessageBox.Show("c1" + ex.GetType().Name + ex.Message, "Query Result");
            }
        }
Exemple #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            if (textBox1.Text == "")
            {
                MessageBox.Show("First Name must be filled up", "Notification");
            }
            else if (textBox2.Text == "")
            {
                MessageBox.Show("Last Name must be filled up", "Notification");
            }
            else if (textBox3.Text == "")
            {
                MessageBox.Show("Email id must be filled up", "Notification");
            }
            else if (passwordText.Text == "")
            {
                MessageBox.Show("Password text must be filled up", "Notification");
            }
            else if (confirmPasswordText.Text == "")
            {
                MessageBox.Show("Confirm password text must be filled up", "Notification");
            }
            else if (textBox6.Text == "")
            {
                MessageBox.Show("Please provide a contact number", "Notification");
            }
            else if (textBox7.Text == "")
            {
                MessageBox.Show("Address must be filled up", "Notification");
            }
            else if (comboBox1.Text == "")
            {
                MessageBox.Show("Please select blood group", "Notification");
            }
            else if (passwordText.Text != confirmPasswordText.Text)
            {
                MessageBox.Show("Password mismatched", "Notification");
            }
            else
            {
                try
                {
                    Admin pt = new Admin
                    {
                        First_Name     = textBox1.Text,
                        Last_Name      = textBox2.Text,
                        Email_ID       = textBox3.Text,
                        Password       = passwordText.Text,
                        Contact_Number = textBox6.Text,
                        Address        = textBox7.Text,
                        Blood_Group    = comboBox1.Text,
                        Birth_Date     = dateTimePicker1.Value,
                        //Photo = ConvertFileToByte(pictureBox2.ImageLocation)
                    };

                    List <CheckBox> listOfCheckBox = new List <CheckBox>();
                    listOfCheckBox.Add(checkBox1);
                    listOfCheckBox.Add(checkBox2);
                    listOfCheckBox.Add(checkBox3);

                    if (listOfCheckBox[0].Checked == true && listOfCheckBox[1].Checked == false && listOfCheckBox[2].Checked == false)
                    {
                        pt.Gender = "Male";
                    }
                    else if (listOfCheckBox[0].Checked == false && listOfCheckBox[1].Checked == true && listOfCheckBox[2].Checked == false)
                    {
                        pt.Gender = "Female";
                    }
                    else if (listOfCheckBox[0].Checked == false && listOfCheckBox[1].Checked == false && listOfCheckBox[2].Checked == true)
                    {
                        pt.Gender = "Other";
                    }

                    dp.Admins.InsertOnSubmit(pt);
                    dp.SubmitChanges();
                    label12.Text = "Information successfully updated";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.GetType().Name + ", " + ex.Message, "Query Result");
                }
            }
        }
        public static void CreateDoctor(List <TextBox> textBoxList, ComboBox comboBox, List <CheckBox> checkBoxList, DateTimePicker dateTimePicker1 /*, PictureBox photo*/)
        {
            DoctorPatientDataContext dp = new DoctorPatientDataContext(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Arwin\documents\visual studio 2015\Projects\CSharpProjects\DoctorPatientPortal\DoctorPatient.mdf;Integrated Security=True;Connect Timeout=30");

            if (textBoxList[0].Text == string.Empty)
            {
                MessageBox.Show("First Name must be filled up", "Notification");
            }
            else if (textBoxList[1].Text == string.Empty)
            {
                MessageBox.Show("Last Name must be filled up", "Notification");
            }
            else if (textBoxList[2].Text == string.Empty)
            {
                MessageBox.Show("Email ID must be filled up", "Notification");
            }
            else if (textBoxList[5].Text == string.Empty)
            {
                MessageBox.Show("Contact number must be filled up", "Notification");
            }
            else if (textBoxList[6].Text == string.Empty)
            {
                MessageBox.Show("Address must be filled up", "Notification");
            }
            else if (textBoxList[3].Text != textBoxList[4].Text)
            {
                MessageBox.Show("Password Mismatched", "Notification");
            }
            else if (textBoxList[3].Text == string.Empty)
            {
                MessageBox.Show("Enter password", "Notification");
            }
            else if (textBoxList[4].Text == string.Empty)
            {
                MessageBox.Show("Enter confirm password", "Notification");
            }
            else if (comboBox.Text == string.Empty)
            {
                MessageBox.Show("Please select Blood Group", "Notification");
            }
            else if ((checkBoxList.ElementAt(0).Checked == true && checkBoxList.ElementAt(1).Checked == true && checkBoxList.ElementAt(2).Checked == true) || (checkBoxList.ElementAt(0).Checked == true && checkBoxList.ElementAt(1).Checked == true) || (checkBoxList.ElementAt(1).Checked == true && checkBoxList.ElementAt(2).Checked == true) || (checkBoxList.ElementAt(0).Checked == true && checkBoxList.ElementAt(2).Checked == true))
            {
                MessageBox.Show("Please select a check box", "Notification");
            }
            else if (checkBoxList.ElementAt(0).Checked == false && checkBoxList.ElementAt(1).Checked == false && checkBoxList.ElementAt(2).Checked == false)
            {
                MessageBox.Show("Please select a gender", "Notification");
            }
            else
            {
                try
                {
                    Doctor d = new Doctor
                    {
                        First_Name     = textBoxList[0].Text,
                        Last_Name      = textBoxList[1].Text,
                        Email_ID       = textBoxList[2].Text,
                        Password       = textBoxList[3].Text,
                        Contact_Number = textBoxList[5].Text,
                        Address        = textBoxList[6].Text,
                        Blood_Group    = comboBox.Text,
                        Birth_Date     = dateTimePicker1.Value,
                        //Photo = ConvertFileToByte(photo.ImageLocation)
                    };

                    if (checkBoxList.ElementAt(0).Checked == true && checkBoxList.ElementAt(1).Checked == false && checkBoxList.ElementAt(2).Checked == false)
                    {
                        d.Gender = "Male";
                    }
                    else if (checkBoxList.ElementAt(0).Checked == false && checkBoxList.ElementAt(1).Checked == true && checkBoxList.ElementAt(2).Checked == false)
                    {
                        d.Gender = "Female";
                    }
                    else if (checkBoxList.ElementAt(0).Checked == false && checkBoxList.ElementAt(1).Checked == false && checkBoxList.ElementAt(2).Checked == true)
                    {
                        d.Gender = "Other";
                    }

                    dp.Doctors.InsertOnSubmit(d);
                    dp.SubmitChanges();
                    MessageBox.Show("Doctor added successfully", "Query Result");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Registration failed. Try again", "Query Result");
                    MessageBox.Show("Error Type: " + ex.GetType().Name + " " + ex.Message, "Query Result");
                }
            }
        }