public static void RequestForConsultation(string date)
 {
     if (selected == null)
     {
         Console.WriteLine("There is no selected doctor.");
     }
     else
     {
         try
         {
             Doctor doctor = (Doctor)selected;
             doctor.Calendar.Sort();
             foreach (Consultation c in doctor.Calendar)
             {
                 if (c.StartOfConsultation > DateTime.Now)
                 {
                     Console.WriteLine(c);
                 }
             }
             Console.WriteLine("Write date and time for consultation.");
             date = Console.ReadLine();
             try
             {
                 string[] dateAndTime         = date.Split('/', '.', ' ', ':');
                 DateTime startOfConsultation = new DateTime(int.Parse(dateAndTime[2]), int.Parse(dateAndTime[1]), int.Parse(dateAndTime[0]), int.Parse(dateAndTime[3]), int.Parse(dateAndTime[4]), 0);
                 Patient  myPatient           = (Patient)myUser;
                 myPatient.RequestForConsultation(doctor, startOfConsultation);
             }
             catch (Exception)
             {
                 MessageBox.Show("Please enter date in DD/MM/YYYY HH:MM or DD.MM.YYYY HH:MM format.");
             }
         }
         catch { }
     }
 }
Пример #2
0
        public static void Init(MySqlConnection conn, string role, string username, string password)
        {
            int line;

            switch (role)
            {
            case "doctor":
                Doctor doctor = new Doctor(username, password);
                doctor.ActivCommands();
                line = Convert.ToInt16(Console.ReadLine());
                switch (line)
                {
                case 2:
                    doctor.MyRequest(conn, doctor);
                    Start(true);
                    break;

                case 3:
                    doctor.PatientHistory(conn, doctor);
                    Console.WriteLine();
                    Start(true);
                    break;
                }
                break;

            case "patient":
                Patient patient = new Patient(username, password);
                patient.ActivCommands();
                line = Convert.ToInt16(Console.ReadLine());
                switch (line)
                {
                case 1:
                    patient.RequestForConsultation(conn, patient);
                    break;

                case 2:
                    patient.MyRequest(conn, patient);
                    Start(true);
                    break;

                case 3:
                    patient.PatientHistory(conn, patient);
                    break;
                }
                break;

            case "admin":
                Admin admin = new Admin(username, password);
                admin.ActivCommands();
                line = Convert.ToInt16(Console.ReadLine());
                switch (line)
                {
                case 1:
                    Console.Write("Username: "******"Username: "******"");
                    Console.Write("Password: "******"Password: "******"");
                    Console.Write("Proffesion: ");
                    string profession = Console.ReadLine().Replace("Proffesion: ", "");
                    admin.AddDoctor(conn, username, password, profession);
                    Start(true);
                    break;

                case 2:
                    //admin.MyRequest(conn, patient);
                    break;
                }
                break;
            }

            Console.ReadLine();
        }