Exemplo n.º 1
0
        void PatientAppointment_Load(object sender, EventArgs e)
        {
            doctor doc;

            //Indicating that appointment has been fixed and that no diagnosis can be done untill the Doctor prescribes the medicine

            if (this.callViewAppointment)
            {
                IViewAppointment view = new Appointment(this.username);
                doc = view.viewAppointment(patient_path, doc_path);

                if (doc == null)
                {
                    lbl1.Text = "Note: No Appointment Fixed Yet,First go to Disease Diagnose or Book an Appointment";
                    btnPrescription.Enabled = false;
                }
                else
                {
                    txtAge.Text        = doc._Age.ToString();
                    txtName.Text       = "Dr. " + doc._FirstName + " " + doc._LastName;
                    txtPhone.Text      = doc._PhoneNo;
                    txtFees.Text       = doc._Fee.ToString();
                    txtSpeciality.Text = doc._Speciality;
                }
            }
            else
            {
                IFixAppointment fix = new Appointment(this.username); //interface
                doc = fix.fixAppointment(patient_path, doc_path);

                if (doc == null)
                {
                    btnPrescription.Enabled = false;
                    lbl1.Text = "We were unable to find a suitable doctor in our System, Please comeback later";
                }
                else
                {
                    txtAge.Text        = doc._Age.ToString();
                    txtName.Text       = "Dr. " + doc._FirstName + " " + doc._LastName;
                    txtPhone.Text      = doc._PhoneNo;
                    txtFees.Text       = doc._Fee.ToString();
                    txtSpeciality.Text = doc._Speciality;

                    d = doc;
                    backgroundWorker1.RunWorkerAsync();
                }
            }

            txtName.Enabled       = false;
            txtAge.Enabled        = false;
            txtFees.Enabled       = false;
            txtSpeciality.Enabled = false;
            txtPhone.Enabled      = false;
            lblNote.Visible       = false;
        }
        public void notifyDoctor(doctor doc)
        {
            string emailAddress = null;

            StreamReader dr = null;
            StreamReader pa = null;

            try
            {
                dr = new StreamReader(doc_path + doc._Username + ".txt");
                pa = new StreamReader(patient_path + username + ".txt");
            }
            catch { MessageBox.Show("Unable to Open File"); }

            for (int i = 0; i < 13; ++i)
            {
                emailAddress = dr.ReadLine();
            }

            dr.Close();

            Patient patient = new Patient();

            patient._FirstName = pa.ReadLine();
            patient._LastName  = pa.ReadLine();
            for (int i = 0; i < 2; ++i)
            {
                pa.ReadLine();
            }
            patient._Age    = Int32.Parse(pa.ReadLine());
            patient._Gender = pa.ReadLine();

            pa.Close();

            string date = DateTime.Now.ToString();

            string appointment = "\n\n####-------Patient Info-------#### \n\n Date: " + date + "\n\nName: " + patient._FirstName + " " + patient._LastName +
                                 "\nAge: " + patient._Age + "\nGender: " + patient._Gender + "\n\nAppointment is fixed, Kindly visit Dr.Assistant for writing the prescription";

            try
            {
                MailMessage mail   = new MailMessage("*****@*****.**", emailAddress, "Appointment Details", appointment);
                SmtpClient  Client = new SmtpClient("smtp.gmail.com");
                Client.Port        = 587;
                Client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "doctor123patient");
                Client.EnableSsl   = true;
                Client.Send(mail);
            }
            catch
            {
                MessageBox.Show("Unable to Send Pin to this Email Id");
                return;
            }
        }
        public SendingNotifications(string username, doctor doc)
        {
            doc_path = First_Page.doc_path;
            // doc_path =

            patient_path = First_Page.pat_path;
            // patient_path =

            this.username = username;

            this.doc = doc;

            InitializeComponent();
        }
Exemplo n.º 4
0
        //Implementation for ViewAppointment Interface

        public doctor showDetails(string Doc, string doc_path)
        {
            string trash;

            doc = new generalphysician();

            StreamReader sr = null;

            try
            {
                sr = new StreamReader(doc_path + Doc + ".txt");
            }
            catch (Exception e) { e.Message.ToString(); }

            doc._FirstName = sr.ReadLine();
            doc._LastName  = sr.ReadLine();
            doc._Username  = sr.ReadLine();

            trash = sr.ReadLine();


            doc._Age = Int32.Parse(sr.ReadLine());

            trash = sr.ReadLine();

            doc._Speciality = sr.ReadLine();
            doc._PhoneNo    = sr.ReadLine();

            for (int i = 0; i < 2; ++i)
            {
                trash = sr.ReadLine();
            }

            doc._Fee = Double.Parse(sr.ReadLine());

            sr.Close();

            return(doc);
        }
        public void notifyPatient(doctor doc)
        {
            string emailAddress = null;

            StreamReader pa = null;

            try
            {
                pa = new StreamReader(patient_path + username + ".txt");
            }
            catch { MessageBox.Show("Unable to Open File"); }

            for (int i = 0; i < 10; ++i)
            {
                emailAddress = pa.ReadLine();
            }

            pa.Close();

            string date = DateTime.Now.ToString();

            string appointment = "\n\n####-------Doctor's Info-------#### \n\n Date: " + date + "\n\n\nName: " + doc._FirstName + " " + doc._LastName +
                                 "\n\nAge: " + doc._Age + "\n\nSpeciality: " + doc._Speciality + "\n\nFee: " + doc._Fee;

            try
            {
                MailMessage mail   = new MailMessage("*****@*****.**", emailAddress, "Appointment Details", appointment);
                SmtpClient  Client = new SmtpClient("smtp.gmail.com");
                Client.Port        = 587;
                Client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "doctor123patient");
                Client.EnableSsl   = true;
                Client.Send(mail);
            }
            catch
            {
                MessageBox.Show("Unable to Send Pin to this Email Id");
            }
        }
Exemplo n.º 6
0
 public btnResend(doctor d)
 {
     this.doc = d;
     InitializeComponent();
 }
Exemplo n.º 7
0
        public doctor fixAppointment(string patient_path, string doctor_path)
        {
            int    lineCount = 0;
            int    cnt       = 0;
            string line;

            string disease_predicted;
            string doctor_suggested;

            lineCount = readEmptyLines();

            StreamReader sr = null;

            try
            {
                sr = new StreamReader(patient_path + username + ".txt");
            }
            catch (Exception e) { e.Message.ToString(); }

            while (true)
            {
                line = sr.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    cnt += 1;
                    if (cnt == lineCount - 1)
                    {
                        break;
                    }
                }
            }

            while (true)
            {
                if ((line = sr.ReadLine()) == "Symptoms End")
                {
                    break;
                }
            }

            disease_predicted = sr.ReadLine();
            doctor_suggested  = sr.ReadLine();

            sr.Close();

            string doc = searchDoc(doctor_suggested);

            if (doc != null)
            {
                doctor d = new generalphysician();
                writePatient_DocFile(doc);  //writing patient name in doctor file
                writeDoc_PatientFile(doc);  //writing doctor name in patient file
                d = showDetails(doc, doctor_path);
                return(d);
            }
            else
            {
                doctor d = null;
                writeDoc_PatientFile("-");  //writing doctor name in patient file
                return(d);
            }
            //Function bracket
        }
Exemplo n.º 8
0
        public doctor viewAppointment(string patient_path, string doc_path)
        {
            string docName = null;
            int    lineCount = 0, cnt = 0;
            string trash = null;

            doctor d = null;

            lineCount = readEmptyLines();

            StreamReader sr = null;

            try
            {
                sr = new StreamReader(patient_path + this.username + ".txt"); //opening username(patient) file
            }
            catch (Exception e)
            {
                e.Message.ToString();
            }

            if (lineCount == 1)
            {
                return(d);
            }

            while (true)
            {
                trash = sr.ReadLine();
                if (string.IsNullOrEmpty(trash))
                {
                    cnt += 1;
                    if (cnt == lineCount - 1)
                    {
                        break;
                    }
                }
            }

            while (true)
            {
                if ((trash = sr.ReadLine()) == "Symptoms End")
                {
                    break;
                }
            }

            for (int i = 0; i < 2; ++i)
            {
                trash = sr.ReadLine();
            }

            docName = sr.ReadLine();
            if (docName != "-")
            {
                d = showDetails(docName, doc_path);
            }
            else
            {
                return(null);
            }
            sr.Close();
            return(d);
        }
Exemplo n.º 9
0
        }//function bracket

        public string searchDoc(string doctor_suggested)
        {
            string user, speciality, line;

            int count;

            string temp = null;

            int min = 9999;

            bool flag     = false;
            bool minFound = false;

            StreamReader doc = null;
            StreamReader sr  = null;

            try
            {
                doc = new StreamReader(First_Page.doc_path + "usernames.txt");
            }
            catch (Exception e) { e.Message.ToString(); }

            while (true)
            {
                user = doc.ReadLine();
                if (user == null)
                {
                    break;
                }

                try
                {
                    sr = new StreamReader(First_Page.doc_path + user + ".txt");
                }
                catch (Exception e) { e.Message.ToString(); }

                for (int i = 0; i < 6; ++i)
                {
                    line = sr.ReadLine();
                }
                speciality = sr.ReadLine();

                sr.Close();

                if (speciality == doctor_suggested)
                {
                    flag  = true;
                    count = readEmptyLines(user);
                    if (count < min)
                    {
                        minFound = true;
                        min      = count;
                        temp     = user;
                    }

                    if (count == 1)
                    {
                        break;
                    }
                    else
                    {
                        flag = false;
                        continue;
                    }
                }
            }

            doc.Close();

            if (flag == true || minFound == true)
            {
                return(temp);
            }

            else
            {
                return(null);
            }
        }//function bracket
Exemplo n.º 10
0
        private void DoctorInfo()
        {
            checkSpeciality();
            if (speciality == "General Physician")
            {
                d = new generalphysician();
            }
            else if (speciality == "Otolaryngologist")
            {
                d = new otolaryngologist();
            }
            else if (speciality == "Cardiologist")
            {
                d = new cardiologist();
            }
            else if (speciality == "Pulmonologist")
            {
                d = new pulmonologist();
            }
            else if (speciality == "Infectologist")
            {
                d = new infectologist();
            }

            StreamReader sr = null;

            try
            {
                if (File.Exists(Doctor_path + username + ".txt"))
                {
                    sr = new StreamReader(Doctor_path + username + ".txt");
                }
                else
                {
                    throw new CustomException("Cannot Open Doctor username.txt");
                }


                txtFname.Text = sr.ReadLine();
                d._FirstName  = txtFname.Text;

                txtLname.Text = sr.ReadLine();
                d._LastName   = txtLname.Text;

                txtUsername.Text = sr.ReadLine();

                txtPassword.Text = sr.ReadLine();
                d._Password      = txtPassword.Text;

                txtAge.Text = sr.ReadLine();
                d._Age      = Int32.Parse(txtAge.Text);

                txtGen.Text = sr.ReadLine();

                txtSpeciality.Text = sr.ReadLine();

                txtPhone.Text = sr.ReadLine();
                d._PhoneNo    = txtPhone.Text;

                txtAddress.Text = sr.ReadLine();
                d._Address      = txtAddress.Text;

                txtPostal.Text = sr.ReadLine();
                d._PostalCode  = txtPostal.Text;

                txtFees.Text = sr.ReadLine();
                d._Fee       = Int32.Parse(txtFees.Text);

                txtDescription.Text = sr.ReadLine();
                d._description      = txtDescription.Text;

                txtEmail.Text   = sr.ReadLine();
                d._EmailAddress = txtEmail.Text;

                sr.Close();
            }
            catch (CustomException e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 11
0
        private void btnSignup_Click(object sender, EventArgs e)
        {
            Console.Beep();

            string msg;

            if (First_Page.opt1 == 0)
            {
                msg = "Username and Speciality won't change, Do You Want to SignUp";
            }
            else
            {
                msg = "Username won't change, Do You Want to SignUp";
            }

            if (checkTextBoxes())
            {
                if (MessageBox.Show(msg, "Message", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (First_Page.opt1 == 0)
                    {
                        doctor doc = null;
                        if (SpecialityCb.SelectedIndex == 0)
                        {
                            doc = new generalphysician();
                        }
                        else if (SpecialityCb.SelectedIndex == 1)
                        {
                            doc = new otolaryngologist();
                        }
                        else if (SpecialityCb.SelectedIndex == 2)
                        {
                            doc = new cardiologist();
                        }
                        else if (SpecialityCb.SelectedIndex == 3)
                        {
                            doc = new pulmonologist();
                        }
                        else
                        {
                            doc = new infectologist();
                        }

                        doc._FirstName   = FirstNameTb.Text;
                        doc._LastName    = LastNameTb.Text;
                        doc._Username    = UserNameTb.Text;
                        doc._Password    = PasswordTb.Text;
                        doc._Age         = Int32.Parse(AgeTb.Text);
                        doc._PhoneNo     = PhoneNoTb.Text;
                        doc._PostalCode  = PostalCodeTb.Text;
                        doc._Speciality  = SpecialityCb.Text;
                        doc._Address     = AddressTb.Text;
                        doc._Gender      = GenderCb.Text;
                        doc._description = DescriptionTb.Text;

                        this.Hide();
                        btnResend email = new btnResend(doc);
                        email.ShowDialog();
                        this.Close();
                    }

                    else
                    {
                        p._FirstName  = FirstNameTb.Text;
                        p._LastName   = LastNameTb.Text;
                        p._Username   = UserNameTb.Text;
                        p._Password   = PasswordTb.Text;
                        p._Age        = Int32.Parse(AgeTb.Text);
                        p._PhoneNo    = PhoneNoTb.Text;
                        p._PostalCode = PostalCodeTb.Text;
                        p._Address    = AddressTb.Text;
                        p._Gender     = GenderCb.Text;

                        this.Hide();
                        btnResend email = new btnResend(p);
                        email.ShowDialog();
                        this.Close();
                    }
                }
            } //validation if
        }     //function bracket