private async void HandleBuy()
        {
            List <Ticket> tickets = new List <Ticket>();

            bought  = true;
            loading = true;

            foreach (var seat in choosenSeats)
            {
                tickets.Add(new Ticket
                {
                    Id        = MiniGuids.MiniGuid.NewGuid(),
                    ForDateId = PlayDateTime.Id,
                    Seat      = seat.Seat
                });

                PlayDateTime.SeatsTaken.Add(seat.Seat);
            }

            Console.WriteLine($"Update PlayDatetime: {PlayDateTime.Id}");
            await PlayDateTimeRepo.Update(PlayDateTime);

            Console.WriteLine($"Add tickets:");
            await TicketRepo.Add(tickets);

            tickets.ForEach(x => Console.WriteLine($"---- Id: {x.Id}"));

            await Task.Delay(2000);

            loading = false;
            StateHasChanged();
            _ = OnClosed.InvokeAsync(this);
        }
Ejemplo n.º 2
0
 public TicketController(BugTrackerDbContext context, TicketRepo _ticketRepo, UserRepo _userRepo, ManipulateRoles _userManipulator)
 {
     _context         = context;
     ticketRepo       = _ticketRepo;
     userRepo         = _userRepo;
     rolesManipulator = _userManipulator;
 }
Ejemplo n.º 3
0
        public object Post(AddTicket request)
        {
            var ticket = TicketRepo.CreateTicket(ToCreateTicket(request));

            return(new AddTicketResponse()
            {
                Status = (int)CommonStatus.Success,
                Data = ticket.ConvertTo <ServiceModel.Types.Ticket>()
            });
        }
Ejemplo n.º 4
0
        private IReceipt SubmitReceipt(SubmitReceipt request)
        {
            //Check ticket is available
            var ticket = TicketRepo.GetTicket(request.TicketId);

            if (ticket == null)
            {
//                throw new Exception(TicketMessage.TicketDoesNotFound);
            }

            if (ticket.Status.Equals((int)TicketConstant.Lock))
            {
//                throw new Exception(TicketMessage.TicketIsNotAvail);
            }

            //Check departure date
            if (!DateTime.TryParseExact(request.DepartureDate, "dd-MM-yyyy", CultureInfo.InvariantCulture,
                                        DateTimeStyles.None, out var departureDate))
            {
//                throw new Exception(TicketMessage.InvalidDepartureDate);
            }

            //Check ticket does not booking before
            var status =
                TicketStatusRepo.GetTicketStatus(ticket.UserAuthId, ticket.Code, departureDate, ticket.DepartureTime);

            if (status.Status != (int)TicketStatusConstant.Available)
            {
//                throw new Exception(TicketMessage.TicketIsNotAvail);
            }

            //Create new receipt
            var newReceipt = new Receipt.Repository.OrmLite.Receipt();

            newReceipt.PopulateWith(ticket);
            newReceipt.AgentId       = Convert.ToInt32(base.UserSession.UserAuthId);
            newReceipt.DepartureDate = departureDate;
            newReceipt.Note          = request.Note;
            newReceipt.Status        = (int)ReceiptStatusConstant.Submited;

            //Generate new code
            var code = ReceiptRepo.GenerateNewCode(ConfigUtils.GetAppSetting("receipt.code.len", 6));

            newReceipt.Code = code;

            //Create new receipt
            var receipt = ReceiptRepo.CreateReceipt(newReceipt);

            //Update ticket status
            var newStatus = TicketStatusRepo.UpdateTicketStatus(ticket.UserAuthId, ticket.Code, departureDate,
                                                                ticket.DepartureTime, (int)TicketStatusConstant.Booked);

            return(receipt);
        }
Ejemplo n.º 5
0
 public Controller(ShowRepo sr, TicketRepo tr, UserRepo ur)
 {
     cstring       = "Data Source=(localdb)\\Projects;Initial Catalog=ShowManagement;Integrated Security=SSPI;";
     sqlConnection = new SqlConnection(cstring);
     sRepo         = sr;
     tRepo         = tr;
     uRepo         = ur;
     this.readShows();
     this.readTickets();
     this.readUsers();
 }
Ejemplo n.º 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ShowRepo   sr = new ShowRepo();
            UserRepo   ur = new UserRepo();
            TicketRepo tr = new TicketRepo();

            Controller cont = new Controller(sr, tr, ur);

            Application.Run(new Form1(cont));
        }
 private void frmPrintedTicket_Load(object sender, EventArgs e)
 {
     try
     {
         ReportDataSource ds = new ReportDataSource("DataSet1", TicketRepo.printTicket(this.Phone));
         this.reportViewer1.LocalReport.DataSources.Clear();
         this.reportViewer1.LocalReport.DataSources.Add(ds);
         this.reportViewer1.RefreshReport();
     }
     catch (Exception error)
     {
         MessageBox.Show($"Error fetching data\n{error.Message}");
     }
 }
 private void cashierTicketControl2_Load(object sender, EventArgs e)
 {
     try
     {
         this.dgvCashierSchedule.AutoGenerateColumns = false;
         this.dgvCashierSchedule.DataSource          = TicketRepo.getSchedule(MainControl.cashierFrom, MainControl.cashierTo, MainControl.cashierBusType, MainControl.cashierJourneyDate);
         this.dgvCashierSchedule.ClearSelection();
         this.dgvCashierSchedule.Refresh();
     }
     catch (Exception grid)
     {
         MessageBox.Show("Error fetching gridview data!" + grid.Message);
     }
 }
Ejemplo n.º 9
0
        public ActionResult EnterNew(AddTicketViewModel model)
        {
            Ticket ticket = new Ticket
            {
                Name    = model.Name,
                Numbers = new int[6] {
                    model.Numbers1, model.Numbers2, model.Numbers3,
                    model.Numbers4, model.Numbers5, model.Numbers6
                }
            };

            TicketRepo.Add(ticket);
            return(View("DisplayTicket", TicketRepo.GetAll().LastOrDefault()));
            //if !IsValid: return View(model);
        }
Ejemplo n.º 10
0
        public object Post(UpdateTicket request)
        {
            var existingTicket = TicketRepo.GetTicket(request.Id);

            if (existingTicket == null)
            {
//                throw new Exception(TicketMessage.TicketDoesNotFound);
            }
            var ticket = TicketRepo.UpdateTicket(existingTicket, ToUpdateTicket(existingTicket, request));

            return(new AddTicketResponse()
            {
                Status = (int)CommonStatus.Success,
                Data = ticket.ConvertTo <ServiceModel.Types.Ticket>()
            });
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (!this.FillEntity())
            {
                return;
            }

            Ticket ticket = new Ticket();

            ticket.CustomerName  = this.txtName.Text;
            ticket.CustomerPhone = this.txtPhnNumber.Text;
            ticket.JourneyDate   = MainControl.cashierJourneyDate;
            ticket.SeatNo        = MainControl.booking.Seats;
            ticket.ScheduleId    = MainControl.booking.ScheduleId;
            ticket.Fare          = TicketRepo.GetFare(ticket.ScheduleId);
            ticket.TotalFare     = (int.Parse(ticket.Fare) * MainControl.selectedSeatCount).ToString();
            this.booking         = MainControl.booking;
            try
            {
                BookingRepo.Save(this.booking);
            }
            catch (Exception save)
            {
                MessageBox.Show("Can not save into Booking Table" + save.Message);
            }

            try
            {
                TicketRepo.Insert(ticket);
                this.SaveSalesAmount(ticket.ScheduleId);
                frmPrintedTicket printT = new frmPrintedTicket();
                printT.Phone = this.txtPhnNumber.Text;
                printT.Show();
                this.ClearUserInput();
            }
            catch (Exception save)
            {
                MessageBox.Show("Can not save into Ticket Table" + save.Message);
            }
        }
Ejemplo n.º 12
0
        private IReceipt CancelReceipt(CancelReceipt request)
        {
            //Check receipt is available
            var existingReceipt = ReceiptRepo.GetReceipt(request.Code);

            if (existingReceipt == null)
            {
//                throw new Exception(ReceiptMessage.ReceiptDoesNotExist);
            }

            //Check ticket is available
            var ticket = TicketRepo.GetTicket(existingReceipt.TicketId);

            if (ticket == null)
            {
//                throw new Exception(TicketMessage.TicketDoesNotFound);
            }

            //Check ticket does not sold before
            var status = TicketStatusRepo.GetTicketStatus(ticket.UserAuthId, ticket.Code, existingReceipt.DepartureDate,
                                                          ticket.DepartureTime);

            if (status.Status.Equals((int)TicketStatusConstant.Sold))
            {
//                throw new Exception(TicketMessage.TickerIsSold);
            }

            //Update receipt
            var newReceipt = ReceiptRepo.UpdateReceipt(existingReceipt, ToCancelReceipt(existingReceipt, request));

            //Update ticket status
            var newStatus = TicketStatusRepo.UpdateTicketStatus(ticket.UserAuthId, ticket.Code,
                                                                newReceipt.DepartureDate, ticket.DepartureTime, (int)TicketStatusConstant.Available);

            return(newReceipt);
        }
Ejemplo n.º 13
0
        public ActionResult FindTicket(int id)
        {
            Ticket ticket = TicketRepo.Get(id);

            return(View("DisplayTicket", ticket));
        }
Ejemplo n.º 14
0
 public TicketService(TicketRepo TicketRepo)
 {
     _ticketRepo = TicketRepo;
 }
Ejemplo n.º 15
0
 public TicketController(BugTrackerDbContext dbContext)
 {
     _repo = new TicketRepo(dbContext);
 }
Ejemplo n.º 16
0
 public void Setup()
 {
     ticketRepro = new TicketRepo(ticketTestContext);
 }
Ejemplo n.º 17
0
 public void Start()
 {
     TicketRepo ticketRepo = new TicketRepo();
 }
 public StatisticController(TicketRepo injectedTicktRepo, ProjectRepo injectedProjectRepo)
 {
     ticketRepo  = injectedTicktRepo;
     projectRepo = injectedProjectRepo;
 }
Ejemplo n.º 19
0
 public TicketBL()
 {
     _repo = new TicketRepo();
 }