Beispiel #1
0
        public List <SeatGroup> Get(int?HallID = null)
        {
            return(TryToGetList(() =>
            {
                using (var db = ConnectionFactory.GetDBCMDataContext())
                {
                    var result = new List <SeatGroup>();

                    db.List_Seats(HallID).ToLookup(s => s.RowIndex).ToList().ForEach(sg =>
                    {
                        var group = new SeatGroup();
                        group.RowIndex = sg.Key;
                        group.RowDisplayNumber = sg.First().RowDisplayNumber;
                        group.RowAligmentID = sg.First().RowAlignmentID;

                        sg.Where(s => s.SeatID.HasValue).ToList().ForEach(s => group.Seats.Add(new Seat
                        {
                            ID = s.SeatID.Value,
                            Index = s.SeatIndex.Value,
                            DisplayNumber = s.SeatDisplayNumber.Value,
                            TypeID = s.TypeId.Value,
                            SeatColor = s.SeatColor,
                            IsEconom = s.IsEconom ?? false,
                        }));

                        result.Add(group);
                    });
                    return result;
                }
            }, Logger: string.Format("Get(HallID = {0})", HallID)));
        }
Beispiel #2
0
        public List <SeatGroup> GetBySession(long ScheduleID)
        {
            return(TryToGetList(() =>
            {
                var db = ConnectionFactory.GetDBCMDataContext();

                var result = new List <SeatGroup>();

                db.List_SeatsBySession(ScheduleID).ToLookup(s => s.RowIndex).ToList().ForEach(sg =>
                {
                    var group = new SeatGroup();
                    group.RowIndex = sg.Key;
                    group.RowDisplayNumber = sg.First().RowDisplayNumber;
                    group.RowAligment = sg.First().RowAlignment;

                    sg.Where(s => s.SeatID.HasValue).OrderBy(s => s.SeatIndex).ToList().ForEach(s => group.Seats.Add(new Seat
                    {
                        ID = s.SeatID.Value,
                        Index = s.SeatIndex.Value,
                        DisplayNumber = s.SeatDisplayNumber.Value,
                        TypeID = s.TypeId.Value,
                        TypeCodeVal = s.SeatTypeCodeVal,
                        Type = s.SeatColor,
                        SeatColor = s.SeatColor,
                        IsEconom = s.IsEconom.Value,
                        IsSold = s.IsSold ?? false,
                        IsReserved = s.IsReserved ?? false,
                        IsBlocked = s.IsBlocked ?? false
                    }));

                    result.Add(group);
                });

                return result.OrderByDescending(r => r.RowIndex).ToList();
            }, Logger: string.Format("GetBySession(ScheduleID = {0})", ScheduleID)));
        }