Exemplo n.º 1
0
        public HallViewModel GetHallDetails(int id)
        {
            try
            {
                Halls halls = _context.Halls
                              .Where(x => x.HallId == id)
                              .Include(x => x.Student)
                              .FirstOrDefault();

                HallViewModel model = new HallViewModel
                {
                    HallID      = halls.HallId,
                    HallName    = halls.HallName,
                    KeyReturned = halls.KeyReturned,
                    IsOwing     = halls.IsOwing,
                    StudentID   = halls.StudentId,
                    FullName    = halls.Student.FullName,

                    StudentIndexList = new SelectList(_studentService.GetStudents(), "StudentID", "FullName", halls.HallId),
                    // StudentDepartList = new SelectList(_studentService.GetStudents(), "StudentID", "StudentId", fees.FeeId)
                };

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
 public void Remove()
 {
     _context.Halls.Remove(SelectedHall);
     _context.SaveChanges();
     Halls.Remove(SelectedHall);
     Messenger.Default.Send(new RefreshScheduleMessage());
 }
Exemplo n.º 3
0
 public void Write(BinaryWriter bw)
 {
     bw.Write(Id);
     bw.Write(RoomA.Id);
     bw.Write(RoomB.Id);
     Halls.Write(bw);
 }
Exemplo n.º 4
0
        public void TestHalls()
        {
            string expected = "Blue";

            string actual = datacontext.GetTable <Halls>().First().Title;

            Assert.AreEqual(expected, actual);

            expected = "Green";

            var hall = new Halls {
                Title = "Green", Lines = 10, Seats = 10
            };

            datacontext.GetTable <Halls>().InsertOnSubmit(hall);

            datacontext.SubmitChanges();

            int max = (from h in datacontext.GetTable <Halls>() select h.ID).Max();

            actual = (from h in datacontext.GetTable <Halls>() where h.ID == max select h.Title).First();

            Assert.AreEqual(expected, actual);

            Halls hall2 = (from h in datacontext.GetTable <Halls>() where h.ID == max select h).First();

            datacontext.GetTable <Halls>().DeleteOnSubmit(hall2);
            datacontext.SubmitChanges();

            int exp     = 2;
            int actuall = (from h in datacontext.GetTable <Halls>() select h.ID).Max();

            Assert.AreEqual(exp, actuall);
        }
Exemplo n.º 5
0
 public void Take()
 {
     Employees = logerEmployee.Take();
     Customers = logerCustomer.Take();
     Halls     = logerHall.Take();
     Rents     = logerRent.Take();
     if (Employees.Count != 0)
     {
         Employees.Last().SetLastID();
     }
     if (Customers.Count != 0)
     {
         Customers.Last().SetLastID();
     }
     if (Halls.Count != 0)
     {
         Halls.Last().SetLastID();
     }
     if (Rents.Count != 0)
     {
         Rents.Last().SetLastID();
     }
     foreach (Rent rent in Rents)
     {
         rent.Customer = Customers.SingleOrDefault(c => c.ID == rent.CustomerID);
         rent.Hall     = Halls.SingleOrDefault(h => h.ID == rent.HallID);
     }
 }
Exemplo n.º 6
0
 public void Read(BinaryReader br)
 {
     Id      = br.ReadString();
     roomAId = br.ReadString();
     roomBId = br.ReadString();
     Halls.Read(br);
 }
Exemplo n.º 7
0
        public void GetInformation()
        {
            try
            {
                StreamReader fileReader = new StreamReader("DataFiles/ReservedPlacesDataBase.txt");
                if (fileReader != null)
                {
                    using (fileReader)
                    {
                        List <Movie> readedMovies = new List <Movie>();
                        //Spliting by NewLine file to part witch are movies
                        string[] movies = fileReader.ReadToEnd().Split(new char[] { charDevidors[3], charDevidors[4] }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var currentMovie in movies)
                        {
                            //Spliting by '#' current movie to part witch are it's elements
                            string[] movieElements = currentMovie.Split(new char[] { charDevidors[0] }, StringSplitOptions.RemoveEmptyEntries);

                            string movieName = movieElements[0];

                            double moviePrice = double.Parse(movieElements[1]);

                            //Spliting pojection by '+'  so we get hall and date
                            List <Projection> movieProjections = new List <Projection>();
                            if (movieElements.Length == 3)
                            {
                                foreach (var currentProjection in movieElements[2].Split(new char[] { charDevidors[2] }, StringSplitOptions.RemoveEmptyEntries))
                                {
                                    string[] projectionElements = currentProjection.Split(new char[] { charDevidors[1] }, StringSplitOptions.RemoveEmptyEntries);

                                    //Parsing to enum
                                    Halls projHall = (Halls)Enum.Parse(typeof(Halls), projectionElements[0]);

                                    //Parsing to datetime
                                    Projection creatingProjection = new Projection(projHall, projectionElements[1]);

                                    if (projectionElements.Length > 2)
                                    {
                                        //Spliting places
                                        string[] reservedPlaces = projectionElements[2].Split(new char[] { charDevidors[5] }, StringSplitOptions.RemoveEmptyEntries);

                                        for (int i = 0; i < reservedPlaces.Length; i++)
                                        {
                                            creatingProjection.ReservePlace(int.Parse(reservedPlaces[i]));
                                        }
                                    }

                                    movieProjections.Add(creatingProjection);
                                }
                            }
                            readedMovies.Add(new Movie(movieName, moviePrice, movieProjections));
                        }
                        Movies = readedMovies;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
 private void ClickMethod()
 {
     // _ctx.РазмерыЗалов.FirstOrDefault(a => a.Наименование == NewSize).ID
     Halls.Add(new Залы()
     {
         НомерЗала = NewNumber, азмерыЗалов = _ctx.азмерыЗалов.FirstOrDefault(a => a.Наименование == NewSize), IDРазмера = _ctx.азмерыЗалов.FirstOrDefault(a => a.Наименование == NewSize).ID
     });
 }
Exemplo n.º 9
0
 public IEnumerable <SelectListItem> GetHalls()
 {
     return(Halls
            .Select(e => new SelectListItem
     {
         Text = e.Name,
         Value = e.HallId.ToString()
     }));
 }
Exemplo n.º 10
0
 public void GetHall()
 {
     Halls.Add(new Hall()
     {
         Id = 3, HallNo = "1", TotalRows = 5, TotalColumns = 10
     });
     Halls.Add(new Hall()
     {
         Id = 4, HallNo = "2", TotalRows = 4, TotalColumns = 10
     });
 }
Exemplo n.º 11
0
        public T?GetById <T>(string key)
            where T : class
        {
            var def = Activator.CreateInstance(typeof(T));

            return(def switch
            {
                Ticket _ => (Tickets.FirstOrDefault(x => x.Id == key) as T),
                Day _ => (Days.FirstOrDefault(x => x.Id == key) as T),
                Hall _ => (Halls.FirstOrDefault(x => x.Id == key) as T),
                _ => null
            });
Exemplo n.º 12
0
        private void HallClick(object sender, RoutedEventArgs e)
        {
            Halls hall = (Halls)((Button)sender).DataContext;

            deleteHallButton.Visibility = Visibility.Visible;
            changeHallButton.Visibility = Visibility.Visible;
            hallName.Text       = hall.name;
            rowQuantity.Text    = hall.row_quantity.ToString();
            columnQuantity.Text = hall.column_quantity.ToString();
            this.hall           = hall;
            this.button         = (Button)sender;
            fillPlaces();
        }
Exemplo n.º 13
0
        public bool DeleteHalls(int id)
        {
            try
            {
                Halls halls = _context.Halls.Where(x => x.HallId == id).FirstOrDefault();


                _context.Halls.Remove(halls);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 14
0
 private void yesBTN_Click(object sender, EventArgs e)
 {
     Validation();
     if (errorTB.Text == string.Empty)
     {
         Rent.Customer   = Customers.FirstOrDefault(c => c.FullName == (string)custCB.SelectedItem);
         Rent.CustomerID = Rent.Customer.ID;
         Rent.Hall       = Halls.FirstOrDefault(h => h.Name == (string)hallCB.SelectedItem);
         Rent.HallID     = Rent.Hall.ID;
         Rent.People     = Convert.ToInt32(peopleNUM.Value);
         Rent.Hours      = Convert.ToInt32(durationNUM.Value);
         Rent.TimeStart  = datestartDTP.Value.Date;
         Rent.TimeStart  = Rent.TimeStart.AddHours(Convert.ToInt32(timestartNUM.Value));
         Rent.Price      = Rent.Hall.Price * Rent.Hours;
         Rent.Customer.CountVisits++;
         Rent.Customer.MoneySpent += Rent.Price;
         DialogResult              = DialogResult.Yes;
     }
 }
Exemplo n.º 15
0
    void SplitChunk(Rect chunk)
    {
        Rect hall;
        Rect chunk_a, chunk_b;

        HallChunkSplit(chunk, out chunk_a, out hall, out chunk_b);

        if (CoinFlip())
        {
            Chunks.Enqueue(chunk_a);
            Chunks.Enqueue(chunk_b);
        }
        else
        {
            Chunks.Enqueue(chunk_b);
            Chunks.Enqueue(chunk_a);
        }

        Halls.Enqueue(hall);

        TotalHallArea += hall.Area;
    }
Exemplo n.º 16
0
        public bool AddHalls(HallViewModel model)
        {
            try
            {
                Halls halls = new Halls
                {
                    HallId      = model.HallID,
                    HallName    = model.HallName,
                    KeyReturned = model.KeyReturned,
                    IsOwing     = model.IsOwing,
                    StudentId   = model.StudentID
                };

                _context.Halls.Add(halls);
                _context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 17
0
        public bool UpdateHalls(HallViewModel model)
        {
            try
            {
                Halls halls = _context.Halls.Where(x => x.HallId == model.HallID).FirstOrDefault();

                halls.HallId      = model.HallID;
                halls.HallName    = model.HallName;
                halls.KeyReturned = model.KeyReturned;
                halls.IsOwing     = model.IsOwing;
                halls.StudentId   = model.StudentID;

                _context.Halls.Update(halls);
                _context.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 18
0
        private void CreateHallClick(object sender, RoutedEventArgs e)
        {
            bool  check = true;
            Halls hall = new Halls();
            int   i = -1; bool isFindId = true;

            while (isFindId)
            {
                i++;
                isFindId = false;
                foreach (Halls halls in main.bd.Halls)
                {
                    if (halls.id == i)
                    {
                        isFindId = true;
                    }
                }
            }
            hall.id   = i;
            hall.name = hallName.Text;
            try
            {
                hall.column_quantity = Convert.ToInt32(columnQuantity.Text);
                hall.row_quantity    = Convert.ToInt32(rowQuantity.Text);
            }
            catch
            {
                check = false;
            }
            hall.cinema_id = ((Cinemas)((ComboBoxItem)cinemas.SelectedValue).DataContext).id;
            if (check)
            {
                main.bd.Halls.Add(hall);
                main.bd.SaveChanges();
            }
            fillHalls();
        }
Exemplo n.º 19
0
        public static void GetInformation()
        {
            StreamReader fileReader = new StreamReader("../../DataFiles/MoviesDatabase.txt");

            if (fileReader != null)
            {
                using (fileReader)
                {
                    List <Movie> readedMovies = new List <Movie>();
                    //Spliting by ';' file to part witch are movies
                    string[] movies = fileReader.ReadToEnd().Split(new char[] { charDevidors[3], charDevidors[4] }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var currentMovie in movies)
                    {
                        //Spliting by '#' current movie to part witch are it's elements
                        string[] movieElements = currentMovie.Split(new char[] { charDevidors[0] }, StringSplitOptions.RemoveEmptyEntries);

                        string movieName = movieElements[0];

                        double moviePrice = double.Parse(movieElements[1]);

                        //Spliting pojection by '+'  so we get hall and date
                        List <Projection> movieProjections = new List <Projection>();
                        foreach (var currentProjection in movieElements[2].Split(new char[] { charDevidors[2] }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            string[] projectionElements = currentProjection.Split(new char[] { charDevidors[1] }, StringSplitOptions.RemoveEmptyEntries);
                            //Parsing to enum
                            Halls projHall = (Halls)Enum.Parse(typeof(Halls), projectionElements[0]);
                            //Parsing to datetime
                            movieProjections.Add(new Projection(projHall, DateTime.Parse(projectionElements[1])));
                        }
                        readedMovies.Add(new Movie(movieName, moviePrice, movieProjections));
                    }
                    Movies = readedMovies;
                }
            }
        }
Exemplo n.º 20
0
        private void hallCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            Hall hall = Halls.FirstOrDefault(h => h.Name == (string)hallCB.SelectedItem);

            peopleNUM.Maximum = hall.Capacity;
        }
Exemplo n.º 21
0
 public void AddHall(HallSector hallSector)
 {
     Halls.Add(hallSector);
 }
Exemplo n.º 22
0
        public void LoadData()
        {
            halls      = new List <Halls>();
            places     = new List <Places>();
            categories = new List <Category>();
            ages       = new List <AgeRestriction>();
            films      = new List <Films>();
            sessions   = new List <Session>();
            tickets    = new List <Tickets>();
            string queryHalls    = "SELECT * FROM Halls";
            string queryPlaces   = "SELECT * FROM Plases";
            string queryCategory = "SELECT * FROM Category";
            string queryAges     = "SELECT * FROM AgeRestriction";
            string queryFilms    = "SELECT * FROM Films";
            string queryTickets  = "SELECT * FROM Tickets";
            string querySessions = "SELECT * FROM Session";

            SqlCommand    cmd;
            SqlDataReader reader;

            //Hall
            connection.Open();
            cmd    = new SqlCommand(queryHalls, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Halls h = new Halls(
                    (int)reader["Id"],
                    reader["Name"].ToString()
                    );
                halls.Add(h);
            }
            connection.Close();
            //Places
            connection.Open();
            cmd    = new SqlCommand(queryPlaces, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Places p = new Places(
                    (int)reader["HallId"],
                    (int)reader["Row"]
                    );
                places.Add(p);
            }
            connection.Close();
            //Category
            connection.Open();
            cmd    = new SqlCommand(queryCategory, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Category c = new Category(
                    (int)reader["Id"],
                    reader["Name"].ToString()
                    );
                categories.Add(c);
            }
            connection.Close();
            //Ages
            connection.Open();
            cmd    = new SqlCommand(queryAges, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                AgeRestriction a = new AgeRestriction(
                    (int)reader["Id"],
                    (int)reader["Age"]
                    );
                ages.Add(a);
            }
            connection.Close();
            //Films
            connection.Open();
            cmd    = new SqlCommand(queryFilms, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Films f = new Films(
                    (int)reader["Id"],
                    reader["Name"].ToString(),
                    (int)reader["CategoryId"],
                    (int)reader["AgeId"]
                    );
                films.Add(f);
            }
            connection.Close();
            //Tickets
            connection.Open();
            cmd    = new SqlCommand(queryTickets, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Tickets t = new Tickets(
                    (int)reader["PlaceId"],
                    (int)reader["SessionId"],
                    (DateTime)reader["Date"]
                    );
                tickets.Add(t);
            }
            connection.Close();
            //Sessions
            connection.Open();
            cmd    = new SqlCommand(querySessions, connection);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                Session s = new Session(
                    (int)reader["Id"],
                    (int)reader["HallId"],
                    (DateTime)reader["DateTime"],
                    (int)reader["FilmId"]
                    );
                sessions.Add(s);
            }
            connection.Close();
        }
Exemplo n.º 23
0
 public Projection(Halls hall, String projectionHour)
 {
     Hall           = hall;
     ProjectionHour = projectionHour;
     reservedPlaces = new List <int>();
 }