public DataManager()
 {
     cont = new Model1Container();
     BR   = new BookingRepository(cont);
     CShR = new CashierRepository(cont);
     CR   = new CinemaRepository(cont);
     FR   = new FilmRepository(cont);
     HR   = new HallRepository(cont);
     SR   = new SeatRepository(cont);
     SsR  = new SessionRepository(cont);
     TR   = new TicketRepository(cont);
 }
Beispiel #2
0
        public List <Cashier> Find(List <Cashier> f, string ent, string atr, string sign, string eqv)
        {
            List <Cashier> result = new List <Cashier>();

            switch (ent)
            {
            case "Кассир":
            {
                switch (atr)
                {
                case "ФИО":
                {
                    switch (sign)
                    {
                    case "=": { result = (from d in f where d.FIO == eqv select d).ToList(); break; }

                    case "!=": { result = (from d in f where d.FIO != eqv select d).ToList(); break; }
                    }
                    break;
                }

                case "Логин":
                {
                    switch (sign)
                    {
                    case "=": { result = (from d in f where d.Login == eqv select d).ToList(); break; }

                    case "!=": { result = (from d in f where d.Login != eqv select d).ToList(); break; }
                    }
                    break;
                }
                }
                break;
            }

            case "Кинотеатр":
            {
                CinemaRepository c    = new CinemaRepository(db);
                List <Cinema>    cin  = c.Search(db.CinemaSet.ToList(), atr, sign, eqv);
                List <Cashier>   cash = new List <Cashier>();
                foreach (Cinema x in cin)
                {
                    cash.AddRange(x.Сashier);
                }
                result = (from d in f select d).Intersect(from a in cash select a).ToList();
                break;
            }
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Многопараметрический поиск зала
        /// </summary>
        /// <param name="f"></param>
        /// <param name="ent"></param>
        /// <param name="atr"></param>
        /// <param name="sign"></param>
        /// <param name="eqv"></param>
        /// <param name="eqv2"></param>
        /// <returns></returns>
        public List <Hall> Search(List <Hall> f, string ent, string atr, string sign, string eqv, string eqv2)
        {
            List <Hall> result = new List <Hall>();

            switch (ent)
            {
            case "Зал":
            {
                switch (atr)
                {
                case "Номер":
                {
                    switch (sign)
                    {
                    case "=": { result = (from d in f where d.Num == int.Parse(eqv) select d).ToList(); break; }

                    case "!=": { result = (from d in f where d.Num != int.Parse(eqv) select d).ToList(); break; }

                    case ">": { result = (from d in f where d.Num > int.Parse(eqv) select d).ToList(); break; }

                    case "<": { result = (from d in f where d.Num < int.Parse(eqv) select d).ToList(); break; }

                    case ">=": { result = (from d in f where d.Num >= int.Parse(eqv) select d).ToList(); break; }

                    case "<=": { result = (from d in f where d.Num <= int.Parse(eqv) select d).ToList(); break; }
                    }
                    break;
                }

                case "Тип":
                {
                    switch (sign)
                    {
                    case "=": { result = (from d in f where d.Type == eqv2 select d).ToList(); break; }

                    case "!=": { result = (from d in f where d.Type != eqv2 select d).ToList(); break; }
                    }
                    break;
                }

                case "Количество рядов":
                {
                    switch (sign)
                    {
                    case "=": { result = (from d in f where d.AmountOfRow == int.Parse(eqv) select d).ToList(); break; }

                    case "!=": { result = (from d in f where d.AmountOfRow != int.Parse(eqv) select d).ToList(); break; }

                    case ">": { result = (from d in f where d.AmountOfRow > int.Parse(eqv) select d).ToList(); break; }

                    case "<": { result = (from d in f where d.AmountOfRow < int.Parse(eqv) select d).ToList(); break; }

                    case ">=": { result = (from d in f where d.AmountOfRow >= int.Parse(eqv) select d).ToList(); break; }

                    case "<=": { result = (from d in f where d.AmountOfRow <= int.Parse(eqv) select d).ToList(); break; }
                    }
                    break;
                }

                case "Количество мест в ряду":
                {
                    switch (sign)
                    {
                    case "=": { result = (from d in f where d.AmountOfSeats == int.Parse(eqv) select d).ToList(); break; }

                    case "!=": { result = (from d in f where d.AmountOfSeats != int.Parse(eqv) select d).ToList(); break; }

                    case ">": { result = (from d in f where d.AmountOfSeats > int.Parse(eqv) select d).ToList(); break; }

                    case "<": { result = (from d in f where d.AmountOfSeats < int.Parse(eqv) select d).ToList(); break; }

                    case ">=": { result = (from d in f where d.AmountOfSeats >= int.Parse(eqv) select d).ToList(); break; }

                    case "<=": { result = (from d in f where d.AmountOfSeats <= int.Parse(eqv) select d).ToList(); break; }
                    }
                    break;
                }
                }
                break;
            }

            case "Кинотеатр":
            {
                CinemaRepository c    = new CinemaRepository(db);
                List <Cinema>    cin  = c.Search(db.CinemaSet.ToList(), atr, sign, eqv);
                List <Hall>      cash = new List <Hall>();
                foreach (Cinema x in cin)
                {
                    cash.AddRange(x.Hall);
                }
                result = (from d in f select d).Intersect(from a in cash select a).ToList();
                break;
            }
            }
            return(result);
        }