Exemplo n.º 1
0
 public Surveillances(Enseignants Prof, Seances NewSeance, Salles NewSalles, DateTime DtSurveillance)
 {
     Enseignant       = new Enseignants(Prof);
     Seance           = new Seances(NewSeance);
     Salle            = new Salles(NewSalles);
     DateSurveillance = DtSurveillance;
 }
Exemplo n.º 2
0
        public async Task <IActionResult> PutSeance([FromRoute] int id, [FromBody] Seances seances)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            try
            {
                await Task.Run(() => _seanceService.UpdateSeance(seances));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SeancesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
        public void CreateSeance(SeancesVM seances)
        {
            var cinemaRes = unitOfWork.Cinemas.GetCount(seances.cinemaId);

            if (cinemaRes.CountSeats.CompareTo(null) != 0)
            {
                //TimeSpan hour = TimeSpan.FromTicks();
                Seances seance = new Seances();
                var     datas  = unitOfWork.Films.Get(seances.cinemaId);
                {
                    seance.SeanceName = seances.seanceName;
                    seance.CinemaId   = seances.cinemaId;
                    seance.FilmId     = seances.filmId;
                    seance.SeanceDate = seances.seanceDate;

                    seance.Price      = seances.price;
                    seance.CountSeats = cinemaRes.CountSeats;
                    seance.AllSeats   = cinemaRes.CountSeats;
                    unitOfWork.Seances.Create(seance);

                    var thisseance = unitOfWork.Seances.GetId(seances.cinemaId, seances.filmId, seances.seanceDate, seances.price).Id;
                    if (thisseance.CompareTo(null) != 0)
                    {
                        var       COUNTSEATS = unitOfWork.Seances.Get(thisseance).AllSeats;
                        BusySeats busy       = new BusySeats();
                        busy.SeanceId   = thisseance;
                        busy.SeatNumber = COUNTSEATS;

                        _busyseatService.CreateSeatBusy(busy);
                    }
                }
            }
        }
Exemplo n.º 4
0
 public Surveillances(Surveillances NewSurveillance)
 {
     Id               = NewSurveillance.PropId;
     Enseignant       = new Enseignants(NewSurveillance.PropEnseignant);
     Seance           = new Seances(NewSurveillance.PropSeance);
     Salle            = new Salles(NewSurveillance.PropSalle);
     DateSurveillance = NewSurveillance.PropDateSurveillance;
 }
Exemplo n.º 5
0
        public void CreateSeance(Seances seances)
        {
            // DateTime date = DateTime.Now;
            var seats = _unitOfWork.Cinemas.Get(seances.IdCinema);

            if (seats.CountSeats != 0)
            {
                Seances seance = new Seances();
                var     datas  = _unitOfWork.Films.Get(seances.IdFilm);
                if (seances.DateSeance >= datas.DateStart && seances.DateSeance <= datas.DateEnd)
                {
                    var seancesInCinema = _unitOfWork.Seances.GetAll().Where(x => x.IdCinema.Equals(seats.Id) && x.DateSeance.Equals(seances.DateSeance)).FirstOrDefault();

                    if (seancesInCinema == null)
                    {
                        seance.IdCinema    = seances.IdCinema;
                        seance.IdFilm      = seances.IdFilm;
                        seance.DateSeance  = seances.DateSeance;
                        seance.TimeSeance  = seances.TimeSeance;
                        seance.Price       = seances.Price;
                        seance.Count_Seats = seats.CountSeats;
                        seance.AllSeats    = seats.CountSeats;
                        _unitOfWork.Seances.Create(seance);
                        _unitOfWork.Save();

                        var thisseance = _unitOfWork.Seances.GetAll().Where(x => x.IdCinema.Equals(seances.IdCinema) && x.IdFilm.Equals(seances.IdFilm) && x.DateSeance.Equals(seances.DateSeance) && x.TimeSeance.Equals(seances.TimeSeance)).FirstOrDefault();
                        if (thisseance.Id != 0)
                        {
                            var COUNTSEATS = _unitOfWork.Seances.Get(thisseance.Id).AllSeats;

                            int i = 1;
                            if (thisseance.Id != 0)
                            {
                                for (i = 1; i <= COUNTSEATS; i++)
                                {
                                    _seatsBusyService.CreateSeatBusy(thisseance.Id, i);
                                }
                            }
                            else
                            {
                                throw new Exception("sdsgh");
                            }
                        }
                        else
                        {
                            throw new Exception("кинотеатр занят");
                        }
                    }
                }
                else
                {
                    throw new Exception("err date");
                }
            }
        }
Exemplo n.º 6
0
        public void UpdateSeance(int id, Seances seance)
        {
            if (seance == null)
            {
                throw new ArgumentNullException();
            }
            var datas = _unitOfWork.Seances.GetAll().Where(i => i.Id.Equals(id)).FirstOrDefault();

            datas.Price = seance.Price;
            _unitOfWork.Seances.Update(datas);
        }
Exemplo n.º 7
0
        public Seances UpdateSeance(Seances seance)
        {
            if (seance == null)
            {
                throw new ArgumentNullException();
            }
            var datas = unitOfWork.Seances.GetAll().Where(i => i.Id.Equals(seance.Id)).FirstOrDefault();

            datas.Price = seance.Price;
            return(unitOfWork.Seances.Update(datas));
        }
Exemplo n.º 8
0
 //не пригодилось, на удаление
 /// <summary>
 /// Метод проверяет наличие выделенного киносеанса в текущем списке.
 /// </summary>
 /// <returns></returns>
 public bool SelectedSeanceIsInSeances()
 {
     if (SelectedSeance == null)
     {
         return(false);
     }
     // return Seances.Where(x => x.Id == SelectedSeance.Id).Count() > 0 ? true : false;
     if (Seances.Where(x => x.Id == SelectedSeance.Id).Count() > 0)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
 public ActionResult PostSeances([FromForm] Seances seances)
 {
     try {
         if (seances.IdCinema == 0)
         {
             throw new Exception("ex");
         }
         else
         {
             _seanceService.CreateSeance(seances);
             return(RedirectToAction("Index", "Moderator"));
         }
     }catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Exemplo n.º 10
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         Seances clt = SeanceDAO.Get_client_ID(int.Parse(tbID.Text));
         tbhdb.Text   = clt.h_debut;
         tbhfin.Text  = clt.h_fin;
         tbpf.Text    = clt.nom_prof;
         tbgr.Text    = clt.num_grp.ToString();
         tb_id_m.Text = clt.nom_matiere;
         tbjour.Text  = clt.jour;
         tbsalle.Text = clt.n_salle;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 11
0
        private void InitData()
        {
            DatabasePZEntities context = new DatabasePZEntities();

            var   api = new ApiRequester();
            Movie movie;

            foreach (var seans in context.SEANS)
            {
                movie = api.getAppMovie((int)seans.Id_film);
                var    hours = new ObservableCollection <string>();
                var    rooms = new ObservableCollection <Room>();
                string spotTable;
                int    currentSpotNumber;

                foreach (var godziny in context.GODZINY.Where(id => id.Id_Seansu == seans.Id_seans))
                {
                    hours.Add(godziny.Godzina);
                    var  spots = new ObservableCollection <Spot>();
                    SALA room  = godziny.SEANS.SALA;
                    spotTable = godziny.Miejsca;

                    for (int i = 0; i < room.Ilosc_wierszy; i++)
                    {
                        for (int j = 0; j < room.Ilosc_kolumn; j++)
                        {
                            currentSpotNumber = (i * (int)room.Ilosc_kolumn) + j;
                            int isAvailable = Int32.Parse(spotTable[currentSpotNumber].ToString());
                            spots.Add(new Spot(isAvailable, j, i, currentSpotNumber + 1));
                        }
                    }

                    rooms.Add(new Room(room.Id_sala, spots, (int)room.Ilosc_kolumn, (int)room.Ilosc_wierszy));
                }


                App.Current.Dispatcher.BeginInvoke((Action) delegate()
                {
                    Seances.Add(new Seance(movie, rooms, hours, (DateTime)seans.Data_rozpoczecia, (DateTime)seans.Data_zakonczenia, seans.Id_seans));
                });
            }
        }
Exemplo n.º 12
0
        public static Seances Get_client_ID(int id)
        {
            string          requete = String.Format("select * from seance where id={0};", id);
            OleDbDataReader rd      = utils.lire(requete);
            Seances         c       = new Seances();

            while (rd.Read())
            {
                c.id          = rd.GetInt32(0);
                c.h_debut     = rd.GetString(1);
                c.h_fin       = rd.GetString(2);
                c.nom_prof    = rd.GetString(3);
                c.num_grp     = rd.GetInt32(4);
                c.nom_matiere = rd.GetString(5);
                c.jour        = rd.GetString(6);
                c.n_salle     = rd.GetString(7);
            }
            utils.Disconnect();
            return(c);
        }
Exemplo n.º 13
0
        private void TimerTick(object sender, EventArgs e)
        {
            List <AccessToWebApi.Entities.Seance> seances = _seanceHttpClient.GetSeances().ToList();


            /*
             * Необходимо проверить текущий список киносеансов и полученный от сервера на расхождения.
             * Если Списки разные,то текущий список обновляется.
             */
            bool flagUpdateSeances = false;//Изначально обновлять не надо

            if (Seances.Count() == seances.Count())
            {
                for (int i = 0; i < Seances.Count; i++)
                {
                    if (Seances[i].Id != seances[i].Id) //есть расхождения
                    {
                        flagUpdateSeances = true;       //обновляем
                        break;
                    }
                }
            }
            else
            {
                flagUpdateSeances = true;//обновляем
            }

            //Обновление текущего списка
            if (flagUpdateSeances)
            {
                Seances.Clear();
                foreach (var seance in seances)
                {
                    Seances.Add(new Model.Seance()
                    {
                        Id = seance.Id, Name = seance.Name, Start = seance.Start
                    });
                }
            }
        }