public async Task <IActionResult> PutCreateTicket(int id, CreateTicket createTicket)
        {
            if (id != createTicket.TicketId)
            {
                return(BadRequest());
            }

            _context.Entry(createTicket).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CreateTicketExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task Submit_Data_Ticket()
        {
            // Create HttpRequestMessage
            var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/");

            MultipartFormDataContent data = new MultipartFormDataContent("----------" + DateTime.Now.Ticks.ToString("x"));

            data.Add(new StringContent("*****@*****.**"), "email");
            data.Add(new StringContent("I would like to request statistics on my page | Je souhaite obtenir les statistiques de ma page"), "reasonOneVal");
            data.Add(new StringContent("gcx-gce.gc.ca"), "pageURL");
            data.Add(new StringContent("2021-02-01"), "startDate");
            data.Add(new StringContent("2021-02-28"), "endDate");
            data.Add(new StringContent("true"), "isOngoing");
            data.Add(new StringContent("I would like some data."), "ticketDescription");
            request.Content = data;

            var httpConfig = new HttpConfiguration();

            request.SetConfiguration(httpConfig);

            CreateTicket._ticketClientWrapper = new TicketClientMock("Ticket Submitted");
            var result = await CreateTicket.Run(req : request, log : log);

            Assert.AreEqual("\"Finished\"", result.Content.ReadAsStringAsync().Result);
        }
        public async Task <ActionResult <CreateTicket> > PostCreateTicket(CreateTicket createTicket)
        {
            _context.CreateTickets.Add(createTicket);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCreateTicket", new { id = createTicket.TicketId }, createTicket));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            PrintTicketForm PT = this.Owner as PrintTicketForm;

            CreateTicket?.Invoke(this, new ShowTicketOnScreenEventArgs(printedTicket));

            MessageBox.Show("Талон распечатан", "Готово", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Close();
        }
Beispiel #5
0
        public IActionResult Create([FromBody] CreateTicketInput createTicket)
        {
            var res = new CreateTicket(repository, createTicket).Execute();

            if (res == -1)
            {
                return(Conflict());
            }
            return(Ok(res));
        }
        public async Task <IActionResult> Create(CreateTicket request)
        {
            if (ModelState.IsValid)
            {
                await _mediator.Send(request);

                return(Redirect(nameof(Index)));
            }
            return(View(request));
        }
Beispiel #7
0
        public void ShouldFailCreatingTicket()
        {
            var input          = new CreateTicketInput(0, TicketState.Open, "test", 0, "problem", DateTime.Now);
            var mockTicketRepo = new Mock <ITicketRepository>();

            mockTicketRepo.Setup(m => m.Create(It.IsAny <Ticket>())).Returns(-1);

            var res = new CreateTicket(mockTicketRepo.Object, input).Execute();

            Assert.AreEqual(-1, res);
        }
Beispiel #8
0
        private void PrintMethod()
        {
            if (auxVenta != null)
            {
                CreateTicket ticket  = new CreateTicket();
                Printer      printer = new Printer("EPSON TM-T20II Receipt5");
                printer.AlignCenter();
                //IMAGEN

                /*Bitmap image = new Bitmap(Bitmap.FromFile("Icon.bmp"));
                 * printer.Image(image);*/
                printer.Append("CHECKPOINT SA DE CV");
                printer.Append("MMC110808MA8");
                printer.Append("LIB. OCEGUERA KM11 COLA.M. DE LEON");
                printer.AlignLeft();
                printer.NewLine();
                printer.Separator();
                printer.NewLine();
                string cashierName = App._userApplication.Nombres + " " + App._userApplication.ApellidoPaterno + " " + App._userApplication.ApellidoMaterno;
                printer.Append("CAJERO: " + cashierName);
                printer.Append("VENTA # " + auxVenta.folioVenta);
                printer.Append("FECHA: " + auxVenta.fecha);
                printer.NewLine();
                printer.Separator();
                printer.NewLine();
                printer.Append("DESCRIPCION             N#     PRECIO      TOTAL");
                printer.PrintDocument();
                foreach (AddProductSale product in auxVenta.productos)
                {
                    ticket.AgregaArticulo(product.Productos.NombreProducto, product.cantidad, product.Productos.PrecioVenta, product.monto);
                }
                ticket.TextoIzquierda("");
                ticket.lineasGuion();
                ticket.AgregarTotalesCentrado("SUBTOTAL:", auxVenta.subtotal);
                ticket.AgregarTotalesCentrado("IVA:", auxVenta.impuestos);
                ticket.AgregarTotalesCentrado("TOTAL:", auxVenta.total);
                ticket.TextoIzquierda("");
                ticket.AgregarTotalesCentrado("SU PAGO:", auxVenta.pagado);
                ticket.AgregarTotalesCentrado("CAMBIO:", auxVenta.cambio);
                ticket.lineasGuion();
                ticket.TextoIzquierda("");
                ticket.ImprimirTicket("EPSON TM-T20II Receipt5");

                Printer printerEnd = new Printer("EPSON TM-T20II Receipt5");
                printerEnd.AlignCenter();
                printerEnd.NewLines(2);
                printerEnd.Code39(auxVenta.folioVenta.ToString());
                printerEnd.Append(auxVenta.folioVenta.ToString());
                printerEnd.AlignLeft();
                printerEnd.FullPaperCut();
                printerEnd.PrintDocument();
                printerEnd.OpenDrawer();
            }
        }
Beispiel #9
0
        public void ShouldCreateTicket()
        {
            var domain         = new Ticket(0, TicketState.Open, "test", 0, "problem", DateTime.Now);
            var input          = new CreateTicketInput(0, TicketState.Open, "test", 0, "problem", DateTime.Now);
            var mockTicketRepo = new Mock <ITicketRepository>();

            mockTicketRepo.Setup(m => m.Create(domain)).Returns(0);

            var res = new CreateTicket(mockTicketRepo.Object, input).Execute();

            Assert.AreEqual(0, res);
        }
        public async Task Submit_Ticket_Without_UserEmail()
        {
            // Create HttpRequestMessage
            var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/");

            MultipartFormDataContent data = new MultipartFormDataContent("----------" + DateTime.Now.Ticks.ToString("x"));

            data.Add(new StringContent("I have no email"), "ticket");
            request.Content = data;

            var httpConfig = new HttpConfiguration();

            request.SetConfiguration(httpConfig);

            var result = await CreateTicket.Run(req : request, log : log);

            Assert.AreEqual("\"E0NoUserEmail\"", result.Content.ReadAsStringAsync().Result);
        }
        public async Task Submit_Ticket_With_Email()
        {
            // Create HttpRequestMessage
            var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/");

            MultipartFormDataContent data = new MultipartFormDataContent("----------" + DateTime.Now.Ticks.ToString("x"));

            data.Add(new StringContent("*****@*****.**"), "email");
            request.Content = data;

            var httpConfig = new HttpConfiguration();

            request.SetConfiguration(httpConfig);

            CreateTicket._ticketClientWrapper = new TicketClientMock("Ticket Submitted");
            var result = await CreateTicket.Run(req : request, log : log);

            Assert.AreEqual("\"Finished\"", result.Content.ReadAsStringAsync().Result);
        }
        public ActionResult Create(CreateTicket NewTicket)
        {
            Ticket newTicket = new Ticket();

            newTicket.UserID      = User.Identity.GetUserId();
            newTicket.TicketDate  = DateTime.Now;
            newTicket.TicketTitle = NewTicket.TicketTitle;
            newTicket.TicketBody  = NewTicket.TicketBody;
            //newTicket.UserID = NewTicket.UserID;

            Debug.WriteLine(User.Identity.GetUserId());
            //Debug.WriteLine(newTicket.User.Id);
            //Debug.WriteLine(newTicket.UserID);

            string url = "TicketData/AddTicket";

            Debug.WriteLine(jss.Serialize(newTicket));
            HttpContent content = new StringContent(jss.Serialize(newTicket));

            content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            HttpResponseMessage response = client.PostAsync(url, content).Result;

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    int ticketId = response.Content.ReadAsAsync <int>().Result;
                    return(RedirectToAction("Details", new
                    {
                        id = ticketId
                    }));
                }
                catch (Exception e)
                {
                    Debug.WriteLine(NewTicket);
                    return(RedirectToAction("List"));
                }
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
        public async Task Request_Query_With_RandomError()
        {
            // Create HttpRequestMessage
            var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/");

            MultipartFormDataContent data = new MultipartFormDataContent("----------" + DateTime.Now.Ticks.ToString("x"));

            data.Add(new StringContent("*****@*****.**"), "email");
            data.Add(new StringContent("Other (please specify) | Autre (veuillez préciser)"), "reasonOneVal");
            data.Add(new StringContent("gcx-gce.gc.ca"), "pageURL");
            data.Add(new StringContent("I have something I don't know.."), "ticketDescription");
            request.Content = data;

            var httpConfig = new HttpConfiguration();

            request.SetConfiguration(httpConfig);

            CreateTicket._ticketClientWrapper = new TicketClientMock(null);
            var result = await CreateTicket.Run(req : request, log : log);

            Assert.AreEqual("\"E1BadRequest\"", result.Content.ReadAsStringAsync().Result);
        }
        public async Task Submit_Assistance_Ticket()
        {
            // Create HttpRequestMessage
            var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/");

            MultipartFormDataContent data = new MultipartFormDataContent("----------" + DateTime.Now.Ticks.ToString("x"));

            data.Add(new StringContent("*****@*****.**"), "email");
            data.Add(new StringContent("I need assistance using gcxchange | J'ai besoin d'aide avec gcéchange"), "reasonOneVal");
            data.Add(new StringContent("gcx-gce.gc.ca"), "pageURL");
            data.Add(new StringContent("I am having assistance."), "ticketDescription");
            request.Content = data;

            var httpConfig = new HttpConfiguration();

            request.SetConfiguration(httpConfig);

            CreateTicket._ticketClientWrapper = new TicketClientMock("Ticket Submitted");
            var result = await CreateTicket.Run(req : request, log : log);

            Assert.AreEqual("\"Finished\"", result.Content.ReadAsStringAsync().Result);
        }
Beispiel #15
0
        private void PrintMethod()
        {
            CreateTicket ticket  = new CreateTicket();
            Printer      printer = new Printer("EPSON TM-T20II Receipt5");

            printer.AlignCenter();
            //IMAGEN

            /*Bitmap image = new Bitmap(Bitmap.FromFile("Icon.bmp"));
             * printer.Image(image);*/
            printer.Append("RETIRO # " + retirosToSave.IdRetiro);
            printer.AlignLeft();
            string cashierName = App._userApplication.Nombres + " " + App._userApplication.ApellidoPaterno + " " + App._userApplication.ApellidoMaterno;

            printer.Append("CAJERO: " + cashierName);
            printer.Append("FECHA: " + retirosToSave.Hora);
            printer.NewLine();
            printer.Separator();
            printer.NewLine();
            printer.PrintDocument();

            ticket.AgregarTotalesCentrado("RETIRO:", (float)retirosToSave.Cantidad);
            ticket.TextoIzquierda("");
            ticket.lineasGuion();
            ticket.TextoIzquierda("");
            ticket.TextoIzquierda("COMENTARIOS: " + retirosToSave.Comentarios);
            ticket.TextoIzquierda("");
            ticket.lineasGuion();
            ticket.TextoIzquierda("");
            ticket.TextoIzquierda("");
            ticket.TextoIzquierda("");
            ticket.TextoIzquierda("");
            ticket.TextoExtremos("X", "X                   ");
            ticket.TextoExtremos("___________________", "____________________");
            ticket.TextoExtremos(cashierName, cashierName);
            ticket.TextoExtremos("    Supervisor", "Cajero       ");
            ticket.CortaTicket();
            ticket.ImprimirTicket("EPSON TM-T20II Receipt5");
        }
Beispiel #16
0
 public IActionResult RegisterTicket(CreateTicket request)
 {
     _mediator.Send(request);
     return(Ok());
 }
Beispiel #17
0
        private void PrintCashClose()
        {
            if (cortesAux.IdCorte != 0 && cortesAux != null)
            {
                CreateTicket ticket  = new CreateTicket();
                Printer      printer = new Printer("EPSON TM-T20II Receipt5");
                printer.AlignCenter();
                printer.Append("CORTE Z");
                printer.Append("N° " + cortesAux.IdCorte);

                printer.AlignLeft();
                printer.Append("Fecha " + cortesAux.FechaInicio.ToString());
                printer.Append(cortesAux.Caja.Nombre + " " + cortesAux.Turno.Nombre);
                printer.Separator();
                printer.BoldMode("Total de venta: " + cortesAux.TotalVenta.ToString("C2"));
                printer.Separator();
                printer.PrintDocument();
                printer = new Printer("EPSON TM-T20II Receipt5");
                double sumTipoPago = 0;
                foreach (CortePagos tipoPago in cortePagoList)
                {
                    ticket.TextoExtremos(tipoPago.TipoPago, tipoPago.Total.ToString("C2"));
                    sumTipoPago += tipoPago.Total;
                }
                ticket.TextoCentro("");
                ticket.AgregarTotalesCentrado("Suma: ", (float)sumTipoPago);
                ticket.ImprimirTicket("EPSON TM-T20II Receipt5");

                printer.Separator();
                printer.BoldMode("Total de impuestos: " + totalTaxe.ToString("C2"));
                printer.Separator();
                printer.PrintDocument();
                printer = new Printer("EPSON TM-T20II Receipt5");
                double sumTipoPagoTax = 0;
                foreach (VentaImpuestos impuesto in impuestoList)
                {
                    ticket.TextoExtremos(impuesto.TipoImpuesto, impuesto.Total.ToString("C2"));
                    sumTipoPagoTax += impuesto.Total;
                }
                ticket.TextoCentro("");
                ticket.AgregarTotalesCentrado("Suma: ", (float)sumTipoPagoTax);
                ticket.ImprimirTicket("EPSON TM-T20II Receipt5");

                printer.Separator();
                printer.BoldMode("Total de venta: " + cortesAux.TotalVenta.ToString("C2"));
                printer.Separator();
                printer.PrintDocument();
                printer = new Printer("EPSON TM-T20II Receipt5");
                double sumTasa = 0;
                foreach (TasaImpuesto tasaTax in tasaList)
                {
                    ticket.TextoExtremos(tasaTax.Nombre, tasaTax.Total.ToString("C2"));
                    sumTasa += tasaTax.Total;
                }
                ticket.TextoCentro("");
                ticket.AgregarTotalesCentrado("Suma: ", (float)sumTasa);
                ticket.ImprimirTicket("EPSON TM-T20II Receipt5");

                printer.Separator();
                printer.BoldMode("Total de devoluciones: " + totalReturns.ToString("C2"));
                printer.Separator();
                printer.PrintDocument();
                printer = new Printer("EPSON TM-T20II Receipt5");
                double sumDevoluciones = 0;
                foreach (TasaImpuesto returns in returnList)
                {
                    ticket.TextoExtremos(returns.Nombre, returns.Total.ToString("C2"));
                    sumDevoluciones += returns.Total;
                }
                ticket.TextoCentro("");
                ticket.AgregarTotalesCentrado("Suma: ", (float)sumDevoluciones);
                ticket.CortaTicket();
                ticket.ImprimirTicket("EPSON TM-T20II Receipt5");
                cleanView();
            }
        }
Beispiel #18
0
        public CreateTicketStruct CreateTicket(string phone, double amount, string btcAddr, string email = "", bool withDelay = true)
        {
            CreateTicket model = new CreateTicket()
            {
                httpRequest   = httpRequest,
                BASE_URL      = BASE_URL,
                phone         = phone,
                amount        = amount,
                btcAddr       = btcAddr,
                TICKET_ACTION = PAIR
            };

            try
            {
                Random r = new Random();

                model.MainPage();
                App.actionsLog.Append(new ActionDataItem(phone, "MainPage loaded success"));

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));
                }
                model.Step1Page();

                App.actionsLog.Append(new ActionDataItem(phone, "Step1Page loaded success"));

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));
                }
                model.Step2Page(email);

                App.actionsLog.Append(new ActionDataItem(phone, "Step2Page loaded success"));

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_each_step_from, App.settings.cache365.delay_before_each_step_to));
                }
                model.Step3Page();

                App.actionsLog.Append(new ActionDataItem(phone, "Step3Page loaded success"));

                string finalContent = model.finalStepContent;

                if (withDelay)
                {
                    Thread.Sleep(r.Next(App.settings.cache365.delay_before_get_qiwi_number_from, App.settings.cache365.delay_before_get_qiwi_number_to));
                }

                var qiwiNumber = model
                                 .GetQIWINumber()
                                 .GetPhone();

                App.actionsLog.Append(new ActionDataItem(phone, "qiwiNumber loaded success"));

                return(new CreateTicketStruct()
                {
                    content = finalContent,
                    qiwiNumber = qiwiNumber
                });
            }
            catch (Exception) { return(new CreateTicketStruct()); }
        }
Beispiel #19
0
 public Task <OpenIddictValidationEventState> HandleAsync(CreateTicket notification)
 {
     throw new NotImplementedException();
 }