private Ticket CreateUpdateTicket(Ticket ticket = null, int seatNo = 0) { if (ticket == null) { ticket = new Ticket(); ticket.id = IDGenerator.TicketId(); ticket.bus_id = _busId; ticket.tour_id = _tourId; ticket.user_id = SystemParam.CurrentUser.id; ticket.cost = GetPriceBySeatClass(_seatClass.ToString()); ticket.created_date = DateTime.Now; ticket.seat_class = _seatClass.ToString(); ticket.seat_number = seatNo != 0 ? seatNo : _seatNumber; ticket.status = Constants.TicketStatus.Paid.ToString(); ticket.departure_time = _ticketBusiness.GetDepartureDateTime(_departureTime); } ticket.passenger_id_card_no = tbIDCardNumber.Text.Trim(); ticket.pickup_location = tbPickupLocation.Text.Trim(); ticket.passenger_name = tbPassengerName.Text.Trim(); ticket.phone = tbPhoneNumber.Text.Trim(); return(ticket); }