public void onSeatMapClick(string seatNumber, Constants.SeatClass seatClass, Ticket ticket) { if (_isEditStatus) { if (ticket == null) { ChooseSeat(int.Parse(seatNumber)); } } else { LoadCustomer(seatNumber, seatClass, ticket); } }
public void InitSeatMap(Constants.SeatClass seatClass) { InitLayoutContainer(); _seatMap = new List <Button>(); _seatClass = seatClass; bool isSeat = false; int seatIndex = 1; int gridIndex = 0; int maxSeat = seatClass == Constants.SeatClass.S ? MAX_FLOOR_SEAT_COUNT : MAX_NORMAL_SEAT_COUNT; for (int rowIndex = 0; rowIndex < MAX_ROWS_COUNT; rowIndex++) { for (int columnIndex = 0; columnIndex < MAX_COLUMNS_COUNT; columnIndex++) { isSeat = seatClass != Constants.SeatClass.S ? (gridIndex + rowIndex % 2) % 2 == 0 || seatIndex > maxSeat - 5 : (gridIndex + rowIndex % 2) % 2 == 1; int tempColumnIndex = columnIndex; if (rowIndex % 2 != 0) { tempColumnIndex = MAX_COLUMNS_COUNT - columnIndex - 1; } if (isSeat == false) { gridIndex++; continue; } Button seat = new Button(); seat.BackColor = EMPTY_SEAT_COLOR; seat.Dock = DockStyle.Fill; seat.Text = seatClass.ToString() + seatIndex.ToString(); seat.Name = seatIndex.ToString(); seat.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); seat.Click += new EventHandler(btnSeat_Click); _seatMap.Add(seat); _panelLayout.Controls.Add(seat, tempColumnIndex, rowIndex); seatIndex++; gridIndex++; } } }
private void LoadSeatMapData() { ClearTicketInfo(); _seatClass = rbtnUpperSeat.Checked ? Constants.SeatClass.B : rbtnLowerSeat.Checked ? Constants.SeatClass.A : Constants.SeatClass.S; _busId = cboBusName.SelectedValue.ToString(); _tourId = cboTour.SelectedValue.ToString(); _departureTime = dtDepartureTime.Value; ucSeatMap.InitSeatMap(_seatClass); var reservedTickets = new TicketBusiness().GetAll(_busId, _tourId, _seatClass.ToString(), _departureTime).ToList(); ucSeatMap.LoadTicket(reservedTickets); lblPrice.Text = CurrencyUtil.ToString(GetPriceBySeatClass(_seatClass.ToString())); _isEmptySeat = false; }
public void LoadCustomer(string seatNumber, Constants.SeatClass seatClass, Ticket ticket) { ClearTicketInfo(); lblPrice.Text = CurrencyUtil.ToString(GetPriceBySeatClass(_seatClass.ToString())); if (ticket != null) { SetValueToTicketControl(ticket); _isEmptySeat = false; _ticketUserId = ticket.user_id; } else { lblSeatNo.Text = seatClass + seatNumber; _isEmptySeat = true; _seatNumber = int.Parse(seatNumber); _ticketUserId = null; } }