예제 #1
0
        public static void Main(string[] args)
        {
            var helloIAm       = new CP2013_WordOfMouth.DTO.AppointmentType(1, "Clean my teeth", 100);
            var jsonApointment = new JsonAppointmentAddType().GetJson(helloIAm);
            var test           = PostRequests(new HttpPostAddAppointmentType(), jsonApointment);

            var Login      = new Login("*****@*****.**", "Password");
            var json       = new JsonLogin().GetJson(Login);
            var something  = PostRequests(new HttpPostLogin(), json);
            var newSession = new JsonSession().GetObject(something) as Session;
            var dentistser = GetRequests(new HttpGetAllDentist(), new JsonAllDentists(), "") as List <Dentist>;

            var allAvaliable = GetRequests(new HttpGetAllAvaliableTimes(), new JsonDentistTimeSlots(), "");
            //  foreach (var d in dentistser)
            //  {
            var stuffed        = PostRequests(new HttpGetBookingsForDentist(), 2.ToString());
            var objectsAreGood = new JsonAppointments().GetObject(stuffed) as List <Appointment>;
            //  }

            var dentistperson = new Dentist(0, "Dentist New", "*****@*****.**", "0412345678");
            var jd            = new JsonDentistEditAdd();
            var json2         = jd.GetJson(dentistperson);

            var stuff = PostRequests(new HttpPostAddDentist(), json2);

            dentistser = GetRequests(new HttpGetAllDentist(), new JsonAllDentists(), "") as List <Dentist>;

            var i = dentistser.Count - 1;

            dentistperson = new Dentist(i, "Dentist New", "*****@*****.**", "0412345678");
            jd            = new JsonDentistEditAdd();
            json2         = jd.GetJson(dentistperson);

            stuff = PostRequests(new HttpPostEditDentist(), json2);

            GetRequests(new HttpGetDentist(), new JsonDentist(), 1.ToString());
            GetRequests(new HttpGetAppointments(), new JsonAppointments(), newSession.GetSessionID().ToString());
            var timeSlots         = GetRequests(new HttpGetDentistTimeSlots(), new JsonDentistTimeSlots(), 2.ToString());
            var apps              = GetRequests(new HttpGetAllAppointmentTypes(), new JsonAllAppointmentTypes(), "");
            var deleteAppointment = new HttpPostDeleteAppointment();

            deleteAppointment.SendRequest(1.ToString());
            var response = deleteAppointment.GetResponse();

            //var Login = new Login("*****@*****.**", "Password");
            //var json = new JsonLogin().GetJson(Login);


            PostRequests(new HttpPostDeleteDentist(), 37.ToString());
            #region OLDMAIN
            var login    = new OldLogin("*****@*****.**", "Password");
            var session  = rr.Login(login);
            var dentists = rr.GetAllDentists();
            var dentist  = rr.GetDentist(dentists[0].id);
            // var timeSlots = rr.GetAllTimeSlots();

            Console.WriteLine(timeSlots);
            rr.GetTimeSlotsForDentist(dentists[0].id);
            Console.WriteLine(dentists);


            fileHandler = new MOCKFileHandler();
            var key = GetStringFromOutput(MENU);

            while (key != "q")
            {
                switch (key)
                {
                case "1":
                    UserUI();
                    break;

                case "2":
                    AdminUI();
                    break;

                default:
                    Console.WriteLine("unknown error");
                    break;
                }
                key = GetStringFromOutput(MENU);
            }
            #endregion
        }