private void SaveSeats(Group group, int seatNumber, int projectionId) { List <Seat> seats = new List <Seat>(); for (int i = 0; i < group.Totalrow; i++) { for (int j = 0; j < group.Totalcolumn; j++) { Seat seat = new Seat(); seat.GroupId = group.Id; seat.Rownumber = i; seat.Columnnumber = j; seat.Seatname = group.GroupName + j + i; Seat isAvailable = ws.GetByRowAndColumn(0, group.Id, i, j); if (isAvailable.Status == STATUS.FUERA_SERVICIO.ToString()) { seat.Status = STATUS.FUERA_SERVICIO.ToString(); } else { seat.Status = STATUS.DISPONIBLE.ToString(); } seat.Seatname = seatNumber.ToString(); seat.ProjectionId = projectionId; seats.Add(seat); seatNumber++; } } ws.AddAll(seats); }
void SeatsConfiguration(Grid gridName, int totalRow, int totalColumn, int groupId) { for (int row = 0; row < totalRow; row++) { for (int column = 0; column < totalColumn; column++) { //Se usa esas letras para identificar cuando comienza y termina cada columna o fila //por ejemplo para extraer el valor del row, comienza con la letra r y termina con la letra R // para obtener la columna, comienza con la letra c y termina con la letra C //las letras son arbitrarias Seat seat = ws.GetByRowAndColumn(HallId, groupId, row, column); Button btn = new Button(); btn.Name = "btnr" + row.ToString() + "R" + "c" + column.ToString() + "C"; SetDefaultButtonProperty(btn, seat.Status); Grid.SetRow(btn, row); Grid.SetRow(btn, row); Grid.SetColumn(btn, column); gridName.Children.Add(btn); } } }