Ejemplo n.º 1
0
        public bool ReserveSeats(int OperatorStockID, long CustomerID, Schedule Schedule, List <SeatStatusChange> Seats, Guid MachineID)
        {
            long userid;

            SecuredUsers.Items.TryGetValue(Context.ConnectionId, out userid);

            var repo = new TicketReservation();

            var reservedSeats = Seats.Where(s => !s.IsBooking && s.IsReserved).ToList();

            var dtos = reservedSeats.Select(s => new TicketReservationDTO
            {
                ScheduleID = Schedule.ID,
                SeatID     = s.SeatID,
                OperatorID = userid,
                StatusCode = 1
            });

            var xml = new TicketReservationWrapperDTO
            {
                Reservations = dtos.ToList()
            }.ToXml();

            repo.TX(0, xml);

            if (!repo.IsError)
            {
                Clients.All.RemoteReserveSeats(Schedule, reservedSeats, MachineID);
            }

            return(!repo.IsError);
        }
Ejemplo n.º 2
0
        public bool RemoveReservations(Schedule Schedule, List <SeatStatusChange> Seats, Guid MachineID, bool IsBookingCancelation)
        {
            long userid;

            SecuredUsers.Items.TryGetValue(Context.ConnectionId, out userid);

            var dtos = Seats.Select(s => new TicketReservationDTO
            {
                ScheduleID = Schedule.ID,
                SeatID     = s.SeatID,
                OperatorID = userid
            });

            var xml = new TicketReservationWrapperDTO
            {
                IsBookingCancelation = IsBookingCancelation,
                Reservations         = dtos.ToList()
            }.ToXml();

            var repo = new TicketReservation();

            repo.TX(1, xml);

            if (!repo.IsError)
            {
                Clients.All.RemoteReserveSeats(Schedule, Seats, MachineID);
            }

            return(!repo.IsError);
        }
Ejemplo n.º 3
0
        void UpdateBlockReservation()
        {
            long sessionID;
            bool isBlocked;
            var  success = false;

            if (bool.TryParse(Request.Form["isBlocked"], out isBlocked) &&
                long.TryParse(Request.QueryString["sessionID"], out sessionID))
            {
                var seats = JsonConvert.DeserializeXNode(Request.Form["data"], "data").Root;

                var xml = new TicketReservationWrapperDTO
                {
                    IsUnblocking = !isBlocked,
                    Reservations = seats.Children("seats").Select(s => new TicketReservationDTO
                    {
                        ScheduleID = sessionID,
                        SeatID     = s.LongValueOf("seatID").Value,
                        StatusCode = 7
                    }).ToList()
                }.ToXml();

                var repo = new TicketReservation();
                var iud  = (byte)(isBlocked ? 0 : 1);
                repo.TX(iud, xml);
                success = !repo.IsError;
            }

            Response.WriteJson(new { Success = success });
        }