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
        }
Beispiel #2
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