Ejemplo n.º 1
0
        private static void LoggedClientMenu(int id)
        {
            Patient patient = PatientService.GetPatient(id);

            observable.AddObserver(patient);
            while (true)
            {
                Console.Clear();
                Console.WriteLine("--------------Client Menu--------------");
                Console.WriteLine("Welcome " + patient.Name + " your access code is " + id);
                if (patient.Appointment != null)
                {
                    Console.WriteLine(patient.Appointment);
                }

                Console.WriteLine();
                Console.WriteLine("1.See Treatment");
                Console.WriteLine("2.Pay");
                if (patient.Appointment == null)
                {
                    Console.WriteLine("3.Make appointment");
                }
                Console.WriteLine("0.Logout");
                string input = Console.ReadLine();
                try
                {
                    var op = Parse(input);
                    switch (op)
                    {
                    case 3:
                    {
                        MakeAppointmentAsClient(patient);
                        break;
                    }

                    case 1:
                    {
                        Console.Clear();
                        if (patient.Treatment.Pills.Count > 0)
                        {
                            Console.WriteLine("Tratamentul Dvs. este urmatorul");
                            foreach (var trat in patient.Treatment.Pills)
                            {
                                Console.WriteLine("Nume pastila: " + trat.Name + " Cantitate: " + trat.Quantity +
                                                  " Pret: " + trat.Price);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Nu aveti momentan un tratament atribuit");
                        }

                        Console.WriteLine("Press any key to continue");
                        Console.ReadLine();
                        break;
                    }

                    case 2:
                    {
                        Console.WriteLine("Pay");
                        Pay(patient);
                        break;
                    }
                    }

                    if (op == 0)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }