public SeatDto GetSeatDetails(int?id) { SeatModel seatModel = _iSeatRepository.GetById(id); SeatDto seatDto = ObjectConverter <SeatModel, SeatDto> .Convert(seatModel); return(seatDto); }
public async Task <Object> AddSeatsConfiguration(SeatModel model) { var flight = await _context.Flights.FindAsync(int.Parse(model.Flight)); if (flight != null) { int firstNum = int.Parse(model.NumberOfFirstSeats); int businessNum = int.Parse(model.NumberOfBusinessSeats); int economicNum = int.Parse(model.NumberOfEconomicSeats); int numberOfAllSeats = firstNum + businessNum + economicNum; for (int i = 0; i < numberOfAllSeats; i++) { // initial Ticket newTicket = new Ticket() { TicketNumber = i + 1, IsTicketPurchased = false, IsQuickBooking = false, Flight = flight }; if (i <= firstNum - 1) { // add first class newTicket.CardType = CardType.FIRST_CLASS; newTicket.TicketPrice = double.Parse(model.FirstClassPrice); } else if (i <= firstNum + businessNum - 1) { // add business class newTicket.CardType = CardType.BUSINESS_CLASS; newTicket.TicketPrice = double.Parse(model.BusinessClassPrice); } else { // add economic class newTicket.CardType = CardType.ECONOMIC_CLASS; newTicket.TicketPrice = double.Parse(model.EconomicClassPrice); } try { var result = await _context.Tickets.AddAsync(newTicket); _context.SaveChanges(); } catch (Exception e) { throw e; } } return(Ok()); } else { return(BadRequest("Add seact configuration is unsuccessffully.Server not found selected flight.")); } }
private void ProcessDealtToLine(DealtToLine l) { SeatModel seat = GetSeat(l.PlayerName); seat.HoleCard0 = l.HoleCards.Card0; seat.HoleCard1 = l.HoleCards.Card1; }
public void ReserveSeat(int seatId, Button button) { if (button.Background == Brushes.LightGray) { SeatModel seat = new SeatModel() { Id = seatId, RoomId = CurrentRoom.Id, Row = Convert.ToInt32(Math.Ceiling(seatId / 12.0)) }; seat.Number = seatId - 12 * (seat.Row - 1); SeatsToReserve.Add(seat); NotifyOfPropertyChange(() => CanContinue); button.Background = Brushes.MediumSeaGreen; } else if (button.Background == Brushes.MediumSeaGreen) { SeatsToReserve.Remove(SeatsToReserve.Find(x => x.Id == seatId)); NotifyOfPropertyChange(() => CanContinue); button.Background = Brushes.LightGray; } }
public int UpdateSeat(SeatModel classObj) { string dataString = "EXEC spSeatDetails 2," + "" + classObj.ID + ",'" + classObj.SeatNumber + "','" + classObj.IsAvailable + "','" + classObj.BogieID + "'"; //EXEC spSeatDetails 2,1,'SHISHIR',1,1 int changeInRecord; try { using (SqlConnection sqlCon = new DbConnection().getConnection()) { using (SqlCommand sqlCommand = new SqlCommand(dataString, sqlCon)) { sqlCommand.CommandType = CommandType.Text; if (sqlCon.State != ConnectionState.Open) { sqlCon.Open(); } changeInRecord = sqlCommand.ExecuteNonQuery(); } } } catch (Exception ex) { throw; } return(changeInRecord); }
internal void Save(LayoutModel layoutModel) { var areas = layoutModel.Areas; foreach (var area in areas) { area.Seats.Clear(); } areas.Clear(); var areaIndex = 1; foreach (var area in ParentGrid.Children.Cast <AreaGrid>()) { var areaModel = new AreaModel { CoordX = GetColumn(area) + 1, CoordY = GetRow(area) + 1, Description = $"Area {areaIndex++}" }; foreach (var seat in area.ParentGrid.Children.Cast <SeatLabel>()) { var seatModel = new SeatModel() { Number = GetColumn(seat) + 1, Row = GetRow(seat) + 1 }; areaModel.Seats.Add(seatModel); } layoutModel.Areas.Add(areaModel); } }
public ActionResult BookTicket(int seatID, string seatNumber, int bogieID) { if (Session["UserID"] != null) { if (Session["seatNumber"] != null) { Session["seatNumber"] = Session["seatNumber"].ToString() + " | " + seatNumber; } else { Session["seatNumber"] = seatNumber; } ViewBag.User = "******"; ViewBag.UserName = Session["UserName"]; SeatModel seatModel = new SeatModel(); seatModel.ID = seatID; seatModel.IsAvailable = false; seatModel.SeatNumber = seatNumber; seatModel.BogieID = bogieID; new TrainDetailsDAL().UpdateSeat(seatModel); return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> Edit(int id, [Bind("SectionModelId,SeatModelId,RowSeat")] SeatModel seatModel) { // if (id != seatModel.SeatModelId) // { // return NotFound(); // } // // if (ModelState.IsValid) // { // try // { // _context.Update(seatModel); // await _context.SaveChangesAsync(); // } // catch (DbUpdateConcurrencyException) // { // if (!SeatModelExists(seatModel.SeatModelId)) // { // return NotFound(); // } // else // { // throw; // } // } // return RedirectToAction(nameof(Index)); // } // ViewData["SectionModelId"] = new SelectList(_context.Sektori, "SectionModelId", "SectionModelId", seatModel.SectionModelId); // return View(seatModel); return(null); }
public static void DeleteReservationData(SeatModel seatModel) { DeletePersonData(seatModel.PersonId); string sql = @"UPDATE dbo.SeatsTable SET PersonId = null WHERE PersonId = " + seatModel.PersonId + "; "; SqlDataAccess.SaveData(sql, new SeatModel()); }
public Task Handle(TicketScanStartedNotification notification, CancellationToken cancellationToken) { var seat = new SeatModel(notification.Seat.Number, notification.Seat.Letter); _ticketRepository.Add(new TicketScanModel(notification.Identifier, seat)); _eventAggregator.Publish(new TicketScanAdded(notification.Identifier)); _logger.LogDebug($"Published {nameof(TicketScanAdded)} event for transaction {notification.Identifier}"); return(Task.CompletedTask); }
private void ProcessSeatInitLine(SeatInitLine l) { SeatModel playerSeat = null; if (!current.Seats.Any(s => s.Player.Name == l.PlayerName)) { if (!seatList.ContainsKey(l.PlayerName)) { playerSeat = new SeatModel() { SeatNumber = l.SeatNumber, Chips = l.ChipCount }; playerSeat.Player = GetPlayer(l.PlayerName); seatList.Add(l.PlayerName, playerSeat); } else { playerSeat = seatList[l.PlayerName]; if (playerSeat.SeatNumber != l.SeatNumber) { seatList.Remove(l.PlayerName); playerSeat = new SeatModel() { SeatNumber = l.SeatNumber, Chips = l.ChipCount }; playerSeat.Player = GetPlayer(l.PlayerName); seatList.Add(l.PlayerName, playerSeat); } else { playerSeat.Chips = l.ChipCount; } } current.Seats.Add(playerSeat); } else { playerSeat = current.Seats.Where(s => s.Player.Name == l.PlayerName).FirstOrDefault(); if (playerSeat.SeatNumber != l.SeatNumber) { current.Seats.Remove(playerSeat); seatList.Remove(l.PlayerName); playerSeat = new SeatModel() { SeatNumber = l.SeatNumber, Chips = l.ChipCount }; playerSeat.Player = GetPlayer(l.PlayerName); seatList.Add(l.PlayerName, playerSeat); } else { playerSeat.Chips = l.ChipCount; } } }
public ViewResult Edit(SeatModel seatdata) { SeatModelUI seatData = new SeatModelUI { NumberSeat = seatdata.NumberSeat, IsReserve = seatdata.PersonId != null }; return(View(seatData)); }
public async Task <IActionResult> Create([Bind("SectionModelId,SeatModelId,RowSeat")] SeatModel seatModel) { // if (ModelState.IsValid) // { // _context.Add(seatModel); // await _context.SaveChangesAsync(); // return RedirectToAction(nameof(Index)); // } // ViewData["SectionModelId"] = new SelectList(_context.Sektori, "SectionModelId", "SectionModelId", seatModel.SectionModelId); // return View(seatModel); return(null); }
public void PressButton(SeatModel selected) { var seat = SeatsByAreaId.First(x => x.Id == selected.Id); if (seat.Number != -1) { SeatsByAreaId.First(x => x.Id == selected.Id).Number = -1; } else { SeatsByAreaId.First(x => x.Id == selected.Id).Number = 1; } }
public void ClickButton(SeatModel selected) { var seat = Seats.FirstOrDefault(x => x.Id == selected.Id); if (seat.Number != -1) { Seats.First(x => x.Id == selected.Id).Number = -1; } else { Seats.First(x => x.Id == selected.Id).Number = 1; } }
public static void InsertSeatModelElement(int numberSeat, Nullable <int> personId, int numberOfMovie) { int movieId = FindMovie(numberOfMovie); SeatModel data = new SeatModel { PersonId = personId, NumberSeat = numberSeat, MovieNumber = numberOfMovie }; string sql = @"insert into dbo.SeatsTable (PersonId, NumberSeat, MovieNumber, IdMovie) values(@PersonId, @NumberSeat, " + numberOfMovie + "," + movieId + "); "; SqlDataAccess.SaveData(sql, data); }
public ActionResult AddSeat(SeatModel sm) { if (sm.ID == 0) { HttpResponseMessage response = GlobalVariables.WebApiClient.PostAsJsonAsync("Seats", sm).Result; TempData["SuccessMessage"] = "Saved Successfully"; } else { HttpResponseMessage response = GlobalVariables.WebApiClient.PutAsJsonAsync("Seats/" + sm.ID, sm).Result; TempData["SuccessMessage"] = "Update Successfully"; } return(RedirectToAction("ViewSeats")); }
public List <SeatModel> SelectSeatByBogieID(int bogieID) { List <SeatModel> seatList = new List <SeatModel>(); string dataString = "Select * from SeatDetails Where bogieID=" + bogieID; try { using (SqlConnection sqlCon = new DbConnection().getConnection()) { using (SqlCommand sqlCommand = new SqlCommand(dataString, sqlCon)) { sqlCommand.CommandType = CommandType.Text; if (sqlCon.State != ConnectionState.Open) { sqlCon.Open(); } SqlDataReader dr = sqlCommand.ExecuteReader(); using (dr) { if (dr.HasRows) { while (dr.Read()) { SeatModel seat = new SeatModel(); seat.ID = Convert.ToInt16(dr.GetValue(0).ToString()); seat.SeatNumber = dr.GetValue(1).ToString(); seat.IsAvailable = Convert.ToBoolean(dr.GetValue(2).ToString()); seat.BogieID = Convert.ToInt16(dr.GetValue(3).ToString()); //trainDetailModel.departurePlace = dr.GetValue(3).ToString(); //trainDetailModel.destinationPlace = dr.GetValue(4).ToString(); //trainDetailModel.noOfBogie = Convert.ToInt16(dr.GetValue(5).ToString()); seatList.Add(seat); } } } return(seatList); } } } catch (Exception ex) { throw; } }
private void btnAddSeat_Click(object sender, EventArgs e) { frmAddSeat frm = new frmAddSeat(); if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Seat = frm.NumberSeat; SeatModel seatAdd = new SeatModel(); seatAdd.Seat = Seat; lstSeat.Add(seatAdd); OrderSlpitNew.ListSeatOfOrder = lstSeat; UCSeat ucSeat = new UCSeat(); ucSeat.lblSeat.Text = "Seat " + Seat; //ucSeat.Click += ucSeat_Click; lblSeat.Text = Seat.ToString(); flpNewTable.Controls.Add(ucSeat); } }
public async Task <IActionResult> Seat([FromBody] SeatModel seat) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = await _seatService.AddSeat(seat); return(StatusCode(result.StatusCode, result)); } catch (Exception ex) { _logger.LogError(ex.Message); throw ex; } }
public ViewResult Details(SeatModel seatdata) { PersonModel personModel = new PersonModel(); if (seatdata.PersonId != null) { personModel = DataProcessor.FindPerson(seatdata.PersonId); } SeatModelUI seatData = new SeatModelUI { NumberSeat = seatdata.NumberSeat, IsReserve = seatdata.PersonId != null, FirstName = personModel.FirstName, LastName = personModel.LastName }; return(View(seatData)); }
public ActionResult CreateSeat(SeatModelUI seatModelUI) { if (ModelState.IsValid) { SeatModel seatModel = new SeatModel { PersonId = null, MovieNumber = NumberMovie, NumberSeat = seatModelUI.NumberSeat }; DataProcessor.InsertSeatModelElement(seatModel.NumberSeat, default(int), NumberMovie); return(RedirectToAction("Manage_Seats")); } else { return(View(seatModelUI)); } }
public async Task <ResponseResult> AddSeat(SeatModel seat) { var res = await _unitOfWork.SeatRepository.AddSeat(_mapper.Map <SeatModel>(seat)); if (res != null && res.Equals(Constant.AddSeat)) { return(new ResponseResult(201, res, null)); } else if (res != null && res.Equals(Constant.SeatExists)) { return(new ResponseResult(403, res, null)); } else if (res != null && res.Equals(Constant.SeatNotFound)) { return(new ResponseResult(404, res, null)); } else { return(new ResponseResult(500, null, res)); } }
private static List <SeatModel> CreateAndFillDummySeatsData(int movieNumber) { List <SeatModel> dummyData = new List <SeatModel>(); { SeatModel seatModel; for (int i = 0; i < 42; i++) { seatModel = new SeatModel { MovieNumber = movieNumber, NumberSeat = i + 1, PersonId = null }; dummyData.Add(seatModel); InsertSeatModelElement(seatModel.NumberSeat, seatModel.PersonId, seatModel.MovieNumber); } }; return(dummyData); }
SeatModel GetSeat(string playerName) { SeatModel seat = null; if (current.Seats.Any(s => s.Player.Name == playerName)) { return(current.Seats.Where(s => s.Player.Name == playerName).FirstOrDefault()); } else { if (seatList.ContainsKey(playerName)) { seat = seatList[playerName]; current.Seats.Add(seat); } else { ErrorMessage("Cant find seat for " + playerName); } } return(seat); }
public static void UpdateSeatData(string firstName, string lastName, bool iReserve, int numberSeat, int movieNumber) { var person = FindPerson(firstName, lastName); string sql; if (person.Count() == 0) { PrepareReservation(firstName, lastName, "none", numberSeat, movieNumber); var lastPerson = GetLastPersonModel(); sql = "UPDATE dbo.SeatsTable SET PersonId = " + lastPerson.Id + " WHERE NumberSeat = " + numberSeat + "; "; } else { SeatModel data = new SeatModel { PersonId = person[0].Id, NumberSeat = numberSeat }; sql = @"UPDATE dbo.SeatsTable SET PersonId = @PersonId WHERE NumberSeat = @NumberSeat;"; SqlDataAccess.SaveData(sql, data); } }
private List <VenueModel> GetVenueModels() { var venueDtos = _venueService.ListVenues(); var venueModels = new List <VenueModel>(); foreach (var venueDto in venueDtos) { var layoutDtos = _venueService.GetVenueLayouts(venueDto.Id).Layouts; var layoutModels = new List <LayoutModel>(); foreach (var layoutDto in layoutDtos) { var areaDtos = _layoutService.GetLayoutAreas(layoutDto.Id).Areas; var areaModels = new List <AreaModel>(); foreach (var areaDto in areaDtos) { var seatDtos = _areaService.GetAreaSeats(areaDto.Id).Seats; var seatModels = new List <SeatModel>(); foreach (var seatDto in seatDtos) { var seatModel = new SeatModel { Id = seatDto.Id, AreaId = seatDto.AreaId, Number = seatDto.Number, Row = seatDto.Row, }; seatModels.Add(seatModel); } var areaModel = new AreaModel { Id = areaDto.Id, Description = areaDto.Description, CoordX = areaDto.CoordX, CoordY = areaDto.CoordY, LayoutId = areaDto.LayoutId, Seats = seatModels, }; areaModels.Add(areaModel); } var layoutModel = new LayoutModel { Id = layoutDto.Id, VenueId = layoutDto.VenueId, Description = layoutDto.Description, Areas = areaModels, }; layoutModels.Add(layoutModel); } var venueModel = new VenueModel { Id = venueDto.Id, Description = venueDto.Description, Address = venueDto.Address, Phone = venueDto.Phone, Layouts = layoutModels, }; venueModels.Add(venueModel); } return(venueModels); }
public void UpdateSeat(SeatDto seatDto) { SeatModel seatModel = ObjectConverter <SeatDto, SeatModel> .Convert(seatDto); _iSeatRepository.Insert(seatModel); }
/// <summary> /// Initializes a new instance of the <see cref="SeatViewModel" /> class. /// </summary> /// <param name="pos">The position.</param> /// <param name="id">The identifier.</param> public SeatViewModel(VRPosition pos, int id) { this.seatModel = new SeatModel(pos, id); this.Model = this.seatModel; }
public Task <IEnumerable <OrderModel> > GetPurchaseHistory(int userId) { var result = new List <OrderModel>(); var data = (from users in _context.UserRepository.GetList() join orders in _context.OrderRepository.GetList() on users.Id equals orders.UserId join purchasedSeats in _context.PurchasedSeatRepository.GetList() on orders.Id equals purchasedSeats.OrderId join seats in _context.EventSeatRepository.GetList() on purchasedSeats.SeatId equals seats.Id join eventAreas in _context.EventAreaRepository.GetList() on seats.EventAreaId equals eventAreas.Id join events in _context.EventRepository.GetList() on eventAreas.EventId equals events.Id join layouts in _context.LayoutRepository.GetList() on events.LayoutId equals layouts.Id join venues in _context.VenueRepository.GetList() on layouts.VenueId equals venues.Id where orders.UserId == userId select new { order = orders, seat = seats, area = eventAreas, currentEvent = events, layout = layouts, venue = venues, user = users }).ToList(); if (!data.Any()) { return(Task.FromResult(result.AsEnumerable())); } data.ForEach(x => { var order = result.Find(y => y.Order.Id == x.order.Id); var seatRow = new SeatModel { Seat = new EventSeatDto { State = (SeatState)x.seat.State, EventAreaId = x.seat.EventAreaId, Id = x.seat.Id, Number = x.seat.Number, Row = x.seat.Row }, Area = new EventAreaDto { Seats = new List <EventSeatDto>(), AreaDefaultId = x.area.AreaDefaultId, CoordX = x.area.CoordX, CoordY = x.area.CoordY, Description = x.area.Description, EventId = x.area.EventId, Id = x.area.Id, Price = x.area.Price }, Event = new EventDto { CreatedBy = x.currentEvent.CreatedBy, Date = x.currentEvent.Date, Description = x.currentEvent.Description, Id = x.currentEvent.Id, ImageURL = x.currentEvent.ImageURL, LayoutId = x.currentEvent.LayoutId, Title = x.currentEvent.Title }, Layout = new LayoutDto { AreaList = new List <AreaDto>(), Description = x.layout.Description, Id = x.layout.Id, VenueId = x.layout.VenueId }, Venue = new VenueDto { Address = x.venue.Address, Description = x.venue.Description, Id = x.venue.Id, LayoutList = new List <LayoutDto>(), Name = x.venue.Name, Phone = x.venue.Phone, Timezone = x.venue.Timezone } }; if (order == null) { result.Add(new OrderModel { Order = MapToOrderDtoWithTimezone(x.order, x.user.Timezone), PurchasedSeats = new List <SeatModel>() { seatRow } }); } else { order.PurchasedSeats.Add(seatRow); } }); result.OrderBy(x => x.Order.Date); return(Task.FromResult(result.AsEnumerable())); }
public void Reset() { Subject = null; Target = null; }
private void Awake() { _model = GetComponent <SeatModel> (); _view = GetComponent <SeatView> (); }