예제 #1
0
 public static void SetUp(TestContext context)
 {
     dal     = new EntityFrameworkDAL(new GestDepDbContext());
     service = new GestDepService(dal);
     //freeSwimPayments = service.GetAllFreeSwimPayments();
     // DataSamples.CreateData(dal);
 }
예제 #2
0
        public AssignarMonitorACurs(IGestDepService service)
        {
            InitializeComponent();
            this.service = service;



            //selectCurs.Items.Clear();
            IEnumerable <Course> courses = service.GetCourses();

            selectCurs.DropDownStyle    = System.Windows.Forms.ComboBoxStyle.DropDownList;
            selectMonitor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            selectMonitor.Enabled       = false;
            selectCurs.Items.Clear();

            foreach (Course c in courses)
            {
                selectCurs.Items.Add(c.Description.ToString());
            }



            //selectCurs.Items.Add(courses);
            selectMonitor.Items.Clear();
            //IEnumerable<Monitor> m = service.getCourses();
            selectMonitor.Items.Add(courses);

            this.curs = null;
        }
예제 #3
0
 public SelectMonitor(IGestDepService service, Activity activity)
 {
     InitializeComponent();
     this.service  = service;
     this.activity = activity;
     LoadData();
 }
예제 #4
0
 public AñadirUsuario(IGestDepService service, CityHall city, String s)
 {
     InitializeComponent();
     this.service = service;
     this.city    = city;
     dni.Text     = s;
 }
예제 #5
0
 public Salas(IGestDepService service, Gym g)
 {
     InitializeComponent();
     this.service = service;
     this.gym     = g;
     LoadData();
 }
예제 #6
0
 public AnadirUsuario(IGestDepService service, Course curso, DateTime t)
 {
     InitializeComponent();
     this.service = service;
     c            = curso;
     time         = t;
 }
예제 #7
0
 public ListarCallesLibres(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
     selectedPool = null;
     // Fecha del DateTimePicker al lunes de la semana actual
     dateSelector.Value = DateTime.Today.AddDays(-(DateTime.Today.DayOfWeek - DayOfWeek.Monday));
 }
예제 #8
0
 public InscribirEnActividad(IGestDepService service, CityHall c, Gym g)
 {
     InitializeComponent();
     this.service  = service;
     this.ciudad   = c;
     this.gimnasio = g;
     LoadData();
 }
예제 #9
0
        public GestDepApp(IGestDepService service)
        {
            InitializeComponent();
            this.service = service;

            DateTime monday = service.CalcularLunes(DateTime.Today);

            actualizarCalendario(monday);
            actual = monday;
        }
예제 #10
0
 public GestDepApp(IGestDepService s)
 {
     InitializeComponent();
     service            = s;
     cursoForm          = new AnadirCurso(service);
     asignarMonitor     = new AsignarMonitor(service);
     matricularUsuario  = new MatricularUsuario(service);
     anadirUsuario      = new AnadirUsuario(service, null, new DateTime());
     listarCallesLibres = new ListarCallesLibres(service);
 }
예제 #11
0
        public LlistarCarrersLliures(IGestDepService service)
        {
            InitializeComponent();
            this.service = service;

            pisines = service.GetPools();
            selectPiscina.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            selectPiscina.Items.Clear();
            foreach (Pool p in pisines)
            {
                selectPiscina.Items.Add(p.ZipCode.ToString());
            }
            piscina = null;
        }
예제 #12
0
파일: Program.cs 프로젝트: joaeschu/3-
        Program(IGestDepService service)
        {
            this.service = service;
            service.removeAllData();
            creaPiscina(3);
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Course c = creaCurso("curso1");

            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            añadeLanesACurso(c);
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            List <DateTime> fechas = calculaFechasCurso(c);

            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            bool haySolapamiento = calculaSolapamiento(c, service.findPoolById(1));

            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            if (!haySolapamiento)
            {
                añadeCursoAPiscina(c, service.findPoolById(1));
            }
            else
            {
                Console.WriteLine("No se añadió porque se solapaban");
            }
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
            //-------------------------------------------------------
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
            //Course c1 = creaCurso("curso2");
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
            //añadeLanesACurso(c1);
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
            //añadeCursoAPiscina(c1, service.findPoolById(1));
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
        }
예제 #13
0
        public InscriureUsuariACurs(IGestDepService service)
        {
            InitializeComponent();
            this.service = service;

            cursos = service.GetCourses();
            selectCurs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            selectCurs.Items.Clear();

            foreach (Course c in cursos)
            {
                selectCurs.Items.Add(c.Description.ToString());
            }

            curs   = null;
            dni    = null;
            usuari = null;
        }
예제 #14
0
        public AltaCurs()
        {
            InitializeComponent();


            idal    = new EntityFrameworkDAL(new GestDepDbContext());
            service = new GestDepService(idal);

            IEnumerable <Pool> pools = service.GetPools();

            //   List<Pool> picinas = pools.ToList();
            comboSelectPicina.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            combohores.DropDownStyle        = System.Windows.Forms.ComboBoxStyle.DropDownList;
            comboSelectPicina.Items.Clear();

            foreach (Pool p in pools)
            {
                comboSelectPicina.Items.Add(p.ZipCode.ToString());
            }

            //Añadir check box a una llista
        }
예제 #15
0
파일: Program.cs 프로젝트: joaeschu/3-
        Program(IGestDepService service)
        {
            this.service = service;

            service.removeAllData();

            // Adding Pool and Lanes
            addPoolAndLanes();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Adding Courses
            addCourses();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();


            // Adding Monitor
            addMonitor();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();


            // Adding Users and Enrollments
            addUsers();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Adding payments
            addPayments();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Testing Free Lanes
            testingFreeLanes();
            Console.Out.WriteLine("\nPress any key to finish.");
            Console.In.ReadLine();
        }
예제 #16
0
        Program(IGestDepService service)
        {
            this.service = service;

            service.RemoveAllData();

            // Adding Pool and Lanes
            AddCityHallGymAndRooms();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Adding Courses
            AddActivities();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Adding Instructors
            AddInstructors();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Adding Users and Enrollments
            AddUsers();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Adding payments
            AddPayments();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();

            // Testing Free Lanes
            TestingFreeRooms();
            Console.Out.WriteLine("\nPress any key to finish.");
            Console.In.ReadLine();
        }
예제 #17
0
 public AñadirUsuario(IGestDepService service, CityHall city)
 {
     InitializeComponent();
     this.service = service;
     this.city    = city;
 }
예제 #18
0
 public MatricularUsuario(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #19
0
 public AddNewUser(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #20
0
 public AñadirAct(IGestDepService service, Gym g)
 {
     InitializeComponent();
     this.service  = service;
     this.gimnasio = g;
 }
예제 #21
0
 public AddActivity(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #22
0
 public EnrollUser(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #23
0
 public AnadirCurso(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #24
0
 public AsignarMonitor(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #25
0
 public GestDepApp(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
 }
예제 #26
0
        testAddCourse(IGestDepService service)
        {
            this.service = service;
            service.removeAllData();
            Console.WriteLine("Ejecutando test sobre la semana 20/11/2017 -- 25-11-2017...");
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Pool   p = creaPiscina(3);
            Course c = new Course("curso1", new DateTime(2017, 11, 20),
                                  new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                  new TimeSpan(0, 45, 0),
                                  Days.Monday | Days.Wednesday | Days.Friday,
                                  6, 20, false, 100);

            c.addLane(p.findLane(1));
            c.addLane(p.findLane(2));
            // curso en los mismos días en las mismas horas en las mismas líneas
            // SOLAPAN
            Course c2 = new Course("curso2", new DateTime(2017, 11, 20),
                                   new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c2.addLane(p.findLane(1));
            c2.addLane(p.findLane(2));
            // curso en distintos dias a la misma hora mismas líneas
            //NO SOLAPAN
            Course c3 = new Course("curso3", new DateTime(2017, 11, 20),
                                   new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Tuesday | Days.Thursday | Days.Saturday,
                                   6, 20, false, 100);

            c3.addLane(p.findLane(1));
            c3.addLane(p.findLane(2));
            // curso mismos días mismas horas distintas líneas
            // No solapan
            Course c4 = new Course("curso4", new DateTime(2017, 11, 20),
                                   new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c4.addLane(p.findLane(3));
            //curso distinto día distinta hora
            // no solapan
            Course c5 = new Course("curso5", new DateTime(2017, 11, 20),
                                   new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 11, 00, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c5.addLane(p.findLane(2));
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            muestraEstadoPiscinaYSolapamiento(p, c, c2, c3, c4, c5);
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Console.WriteLine("DEBE AÑADIRSE y los lunes miercoles y viernes solo habrá una lane libre a las 9:30");
            añadeCursoAPiscina(c, p);
            Console.WriteLine(p.dibujaOcupacionSemana(new DateTime(2017, 11, 20)));
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Console.WriteLine("NO DEBE AÑADIRSE ");
            añadeCursoAPiscina(c2, p);
            Console.WriteLine(p.dibujaOcupacionSemana(new DateTime(2017, 11, 20)));
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Console.WriteLine("DEBE AÑADIRSE y a las 9:30 solo quedará una lane cada día");
            añadeCursoAPiscina(c3, p);
            Console.WriteLine(p.dibujaOcupacionSemana(new DateTime(2017, 11, 20)));
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Console.WriteLine("DEBE AÑADIRSE y los lunes miercoles y viernes no quedarán lanes libres");
            añadeCursoAPiscina(c4, p);
            Console.WriteLine(p.dibujaOcupacionSemana(new DateTime(2017, 11, 20)));
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Console.WriteLine("DEBE AÑADIRSE y los lunes miercoles y viernes habra 2 lanes libres a las 11:00");
            añadeCursoAPiscina(c5, p);
            Console.WriteLine(p.dibujaOcupacionSemana(new DateTime(2017, 11, 20)));
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            //if (!haySolapamiento)
            //{
            //    Console.WriteLine("Añadiendo curso...");
            //    añadeCursoAPiscina(c, service.findPoolById(1));
            //}
            //else { Console.WriteLine("No se añadió porque se solapaban"); }
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //muestraEntradas();
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //muestraOcupacion();
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //pruebaAñadirEntrada(new DateTime(2017, 11, 20, 9, 30, 0), c.getLanesDictionary());
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //muestraEntradas();
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //muestraOcupacion();
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //if (!haySolapamiento)
            //{
            //    Console.WriteLine("Añadiendo curso...");
            //    añadeCursoAPiscina(c, service.findPoolById(1));
            //}
            //else { Console.WriteLine("No se añadió porque se solapaban"); }
            //Console.WriteLine("Press any key to continue...\n\n");
            //Console.ReadKey();
            //creaCurso2yAñadelo();

            //-------------------------------------------------------
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
            //Course c1 = creaCurso("curso2");
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
            //añadeLanesACurso(c1);
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
            //añadeCursoAPiscina(c1, service.findPoolById(1));
            //Console.WriteLine("Press any key to continue...");
            //Console.ReadKey();
        }
예제 #27
0
        testEnrrol(IGestDepService service)
        {
            this.service = service;
            service.removeAllData();
            Pool   p = creaPiscina(3);
            Course c = new Course("curso1", new DateTime(2017, 11, 20),
                                  new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                  new TimeSpan(0, 45, 0),
                                  Days.Monday | Days.Wednesday | Days.Friday,
                                  6, 20, false, 100);

            c.addLane(p.findLane(1));
            Course c2 = new Course("curso2", new DateTime(2017, 11, 20),
                                   new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c2.addLane(p.findLane(2));
            Course c3 = new Course("curso3", new DateTime(2017, 11, 20),
                                   new DateTime(2017, 11, 26), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c3.addLane(p.findLane(3));
            Course c4 = new Course("curso4", new DateTime(2017, 11, 10),
                                   new DateTime(2017, 11, 20), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c4.addLane(p.findLane(1));
            Course c5 = new Course("curso5", new DateTime(2017, 11, 5),
                                   new DateTime(2017, 11, 7), new DateTime(2017, 11, 20, 9, 30, 0),
                                   new TimeSpan(0, 45, 0),
                                   Days.Monday | Days.Wednesday | Days.Friday,
                                   6, 20, false, 100);

            c5.addLane(p.findLane(2));
            service.addCourse(c);
            service.addCourse(c2);
            service.addCourse(c3);
            service.addCourse(c4);
            service.addCourse(c5);
            Console.WriteLine("creados y añadidos cursos");
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            List <Course> cursosActuales = recuperaCursosActuales();

            Console.WriteLine("SE DEBE MOSTRAR c1 , c2 y c3");
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            Console.WriteLine("Escribe el dni del usuario que deseas inscribir...\n\n");
            String id = Console.ReadLine();
            User   u  = service.findUserById(id);

            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
            if (u == null)
            {
                // User.introduceDatosUsuarioPorTeclado();
                u = new User("2345678901", "Gemma Mengual", "Gemma Mengual's address", 46002, "ES891234121234567890", new DateTime(1977, 4, 12), false);
                service.addUser(u);
                service.saveChanges();
                Console.WriteLine(c.calculaPrecio(u));
                double precio = c.calculaPrecio(u);
                service.enrollUserToCourse(new DateTime(2017, 07, 26), u, c);
                Payment    p4 = new Payment(DateTime.Today, "pago", precio);
                Enrollment e  = new Enrollment(null, DateTime.Today, null, p4, u, c);
                service.saveChanges();
                service.addPayment(e, DateTime.Today);
                service.saveChanges();
            }
            else
            {
            }
            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();

            Console.WriteLine("Press any key to continue...\n\n");
            Console.ReadKey();
        }
예제 #28
0
 public AñadirMonitor(IGestDepService service)
 {
     InitializeComponent();
     this.service = service;
     LoadData();
 }