void createFolder_files(string folder_path)
        {
            StreamWriter sw = null;

            try
            {
                //doctor
                doc_path = folder_path + "\\Doctor";
                Directory.CreateDirectory(doc_path);

                doc_path = folder_path + "\\" + "Doctor\\";
                sw       = new StreamWriter(doc_path + "usernames.txt");
                sw.Close();

                //patient
                pat_path = folder_path + "\\" + "Patient";
                Directory.CreateDirectory(pat_path);

                pat_path = folder_path + "\\" + "Patient\\";
                sw       = new StreamWriter(pat_path + "usernames.txt");
                sw.Close();

                //drugs
                drug_path = folder_path + "\\" + "Drugs";
                Directory.CreateDirectory(drug_path);

                drug_path = folder_path + "\\" + "Drugs\\";
                sw        = new StreamWriter(drug_path + "Drugs.txt");
                sw.Close();

                // Drugs suggestion
                sw = new StreamWriter(drug_path + "Drug_Suggestions.txt");
                sw.Close();

                //prescription
                pres_path = folder_path + "\\" + "Prescription";
                Directory.CreateDirectory(pres_path);
                pres_path = folder_path + "\\" + "Prescription\\";
            }
            catch
            {
                CustomException msg = new CustomException("Unable to Open a file or Create Directory");
                MessageBox.Show(msg.Message);
            }
        }
Example #2
0
        private void DoctorInfo()
        {
            pictureBox2.Visible = false;

            string       doc_path = First_Page.doc_path;
            StreamReader sr       = null;

            try
            {
                if (File.Exists(doc_path + username + ".txt"))
                {
                    sr = new StreamReader(doc_path + username + ".txt");
                }
                else
                {
                    throw new CustomException("cannot open doctor usernames.txt");
                }
                lblFname.Text       = sr.ReadLine();
                lblLname.Text       = sr.ReadLine();
                lblUsername.Text    = sr.ReadLine();
                lblPass.Text        = sr.ReadLine();
                lblAge.Text         = sr.ReadLine();
                lblGender.Text      = sr.ReadLine();
                lblSpeciality.Text  = sr.ReadLine();
                lblPhone.Text       = sr.ReadLine();
                lblAddress.Text     = sr.ReadLine();
                lblPostal.Text      = sr.ReadLine();
                lblFees.Text        = sr.ReadLine();
                txtDescription.Text = sr.ReadLine();
                lblEmail.Text       = sr.ReadLine();
                sr.Close();
            }
            catch
            {
                CustomException msg = new CustomException("Unable to Doctor File");
                MessageBox.Show(msg.Message, "Error");
            }
        }