protected static XElement SetRowSeats(SeatPattern seatPattern, SeatsOrder seatsOrder, string rowName,
            IEnumerable<DataRow> filteredSeats, XElement currentElement)
        {
            currentElement.SetAttributeValue("data-row", rowName);

            // TODO : Verify this is always true: what if rows shouldn't always be left o right
            currentElement.ReorderElements(OrderBy.MinX);

            var currentPathElement = currentElement.Descendants().First();

            var rowSeats = GetOrderedSeatsForRow(filteredSeats, rowName, seatsOrder);
            switch (seatPattern)
            {
                case SeatPattern.Odds:
                    rowSeats = rowSeats.Where(x => int.Parse(x["seat_num"].ToString())%2 != 0);
                    break;
                case SeatPattern.Even:
                    rowSeats = rowSeats.Where(x => int.Parse(x["seat_num"].ToString())%2 == 0);
                    break;
            }

            foreach (var seat in rowSeats)
            {
                currentPathElement = SetElementAndGetNext(currentPathElement, seat);
                if (currentPathElement == null) break;
            }

            currentElement = currentElement.ElementsAfterSelf().FirstOrDefault();
            return currentElement;
        }
 private static void SetOrchestraCircleSeatGroup(IEnumerable<DataRow> seats, XContainer root, string firstRow,
     string lastRow, SeatPattern seatPattern, ICollection<int> sections, int minSeat, int maxSeat,
     SeatsOrder seatsOrder)
 {
     var filteredSeats = GetSeatsBySectionsAndSeatNumberRange(seats, sections, minSeat, maxSeat).ToList();
     var currentElement = root.Elements().First();
     for (var c = firstRow[0]; c <= lastRow[0]; c++)
     {
         var actualRow = string.Format("{0}{0}{0}", c);
         currentElement = SetRowSeats(seatPattern, seatsOrder, actualRow, filteredSeats, currentElement);
         if (currentElement == null) break;
     }
 }
        protected static void SetStandardSeatGroup(IEnumerable<DataRow> seats, XContainer root, int firstRow,
           int lastRow, ICollection<int> excludedRows, SeatPattern seatPattern, ICollection<int> sections,
           int minSeat, int maxSeat, SeatsOrder seatsOrder)
        {
            var filteredSeats = GetSeatsBySectionsAndSeatNumberRange(seats, sections, minSeat, maxSeat).ToList();
            var currentElement = root.Elements().First();

            for (var c = firstRow; c <= lastRow; c++)
            {
                if (excludedRows != null && excludedRows.Contains(c)) continue;
                currentElement = SetRowSeats(seatPattern, seatsOrder, c.ToString(), filteredSeats, currentElement);
                if (currentElement == null) break;
            }
        }