Beispiel #1
0
        public void readOrdersFromDb(int userID, string username, EventController evc, DbController dbc)
        {
            DataTable orderTable = dbc.readOrders(userID);

            foreach (DataRow row in orderTable.Rows)
            {
                Event ev = evc.getEventByID(Convert.ToInt32(row.Field <Int64>("Event_ID")));

                Order order = new Order(ev.PerformName, ev.Location.Name, ev.Start, username);

                DataTable seatTable = dbc.readSeatsForEvent(ev.Id, userID);

                foreach (DataRow seat in seatTable.Rows)
                {
                    string status       = "";
                    int    statusNumber = Convert.ToInt32(seat.Field <Int64>("SeatStatus"));

                    if (statusNumber == 1)
                    {
                        status = "foglalt";
                    }
                    else if (statusNumber == 2)
                    {
                        status = "fizetett";
                    }
                    else if (statusNumber == 3)
                    {
                        status = "hitelesitett";
                    }

                    order.addSeat(new Seat(Convert.ToInt32(seat.Field <Int64>("RowNumber")), Convert.ToInt32(seat.Field <Int64>("ColumnNumber")), status));
                }

                Orders.Add(order);
            }
        }