Exemplo n.º 1
0
        public void SendExistBarcode_ReturnsOk()
        {
            // Arrange
            var sender    = _fixture.Merchant.YandexMoneyAccount;
            var testEvent = _fixture.Events[0];
            var email     = Generator.Email();

            _fixture.Api.SendPayment(sender, new YandexPaymentLabel(testEvent), email, testEvent.Roubles, testEvent.Roubles);
            var ticket = _fixture.Db.Tickets.First(t => t.Payment.Email == email);
            var scan   = new BarcodeScan(ticket.Number);

            // Act
            var response = _fixture.Api.VerifyBarcode(scan);

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            NHamcrest.XUnit.Assert.That(response.Content, new NotUsed());
            NHamcrest.XUnit.Assert.That(response.Content, new WithConcert("First Test Artist — 9 июля 2019"));

            AssertWithTimeout.That("Ticket should be expired",
                                   () => {
                _fixture.Db.Entry(ticket).State = EntityState.Detached;
                return(_fixture.Db.Find <Ticket>(ticket.Id).Expired);
            },
                                   Is.True());
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> PostProduct(BarcodeScan product)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            return(await ProcessScanBarcode(product.Barcode, product.Latitude, product.Longitude, product.RetailerId));

            //return Ok(product);



            //db.Products.Add(product);

            //try
            //{
            //    await db.SaveChangesAsync();
            //}
            //catch (DbUpdateException)
            //{
            //    if (ProductExists(product.Id))
            //    {
            //        return Conflict();
            //    }
            //    else
            //    {
            //        throw;
            //    }
            //}

            //return CreatedAtRoute("DefaultApi", new { id = product.Id }, product);
        }
Exemplo n.º 3
0
        public void SendNotExistBarcode_ReturnsNotFound()
        {
            // Arrange
            var scan = new BarcodeScan("-1");

            // Act
            var response = _fixture.Api.VerifyBarcode(scan);

            // Assert
            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.Equal(new NotFoundAnswer().ToString(), response.Content);
        }
Exemplo n.º 4
0
        public int AddNewScanning(BarcodeScan scan)
        {
            int add = 0;

            try
            {
                SqlCommand cmd = DataAccess.GetCommand();
                cmd.CommandText = "dbo.AddScanning";
                cmd.Parameters.AddWithValue("@Command", "NewScanning");
                cmd.Parameters.AddWithValue("@Scanresult", scan.Code);
                cmd.Parameters.AddWithValue("@ScanImageUrl", scan.imageurl);
                cmd.Parameters.AddWithValue("@StateName", scan.State);
                cmd.Parameters.AddWithValue("@UserId", scan.UserId);
                add = Convert.ToInt32(DataAccess.ExecureScaler(cmd));
            }
            catch (Exception ex)
            {
            }
            return(add);
        }
Exemplo n.º 5
0
        public JsonResult MyImageResult(BarcodeScan barcode)
        {
            string img = Regex.Match(barcode.image, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase).Groups[1].Value;

            string storePath = "wwwroot/UploadsImg/";
            string filepath  = SaveImage(img, storePath);

            barcode.imageurl = filepath;
            if (string.IsNullOrWhiteSpace(Convert.ToString(barcode.State)))
            {
                barcode.State = 0;
            }
            if (string.IsNullOrWhiteSpace(Convert.ToString(barcode.UserId)))
            {
                barcode.UserId = 0;
            }
            int result = BusinessScan.AddScanning(barcode);

            return(Json(result));
        }
Exemplo n.º 6
0
        void ReleaseDesignerOutlets()
        {
            if (asRingPlusVersion != null)
            {
                asRingPlusVersion.Dispose();
                asRingPlusVersion = null;
            }

            if (BarcodeOption != null)
            {
                BarcodeOption.Dispose();
                BarcodeOption = null;
            }

            if (BarcodeScan != null)
            {
                BarcodeScan.Dispose();
                BarcodeScan = null;
            }

            if (batteryImage != null)
            {
                batteryImage.Dispose();
                batteryImage = null;
            }

            if (buzzerButton != null)
            {
                buzzerButton.Dispose();
                buzzerButton = null;
            }

            if (buzzerTextField != null)
            {
                buzzerTextField.Dispose();
                buzzerTextField = null;
            }

            if (Inventory != null)
            {
                Inventory.Dispose();
                Inventory = null;
            }

            if (labelBluetoothAddr != null)
            {
                labelBluetoothAddr.Dispose();
                labelBluetoothAddr = null;
            }

            if (labelDemoVer != null)
            {
                labelDemoVer.Dispose();
                labelDemoVer = null;
            }

            if (labelFirmwareVer != null)
            {
                labelFirmwareVer.Dispose();
                labelFirmwareVer = null;
            }

            if (LockMemory != null)
            {
                LockMemory.Dispose();
                LockMemory = null;
            }

            if (logoImage != null)
            {
                logoImage.Dispose();
                logoImage = null;
            }

            if (mainScrollView != null)
            {
                mainScrollView.Dispose();
                mainScrollView = null;
            }

            if (ReadMemory != null)
            {
                ReadMemory.Dispose();
                ReadMemory = null;
            }

            if (regionLabel != null)
            {
                regionLabel.Dispose();
                regionLabel = null;
            }

            if (RFIDOption != null)
            {
                RFIDOption.Dispose();
                RFIDOption = null;
            }

            if (snLabel != null)
            {
                snLabel.Dispose();
                snLabel = null;
            }

            if (ufVersion != null)
            {
                ufVersion.Dispose();
                ufVersion = null;
            }

            if (vibratorButton != null)
            {
                vibratorButton.Dispose();
                vibratorButton = null;
            }

            if (vibratorTextField != null)
            {
                vibratorTextField.Dispose();
                vibratorTextField = null;
            }

            if (WriteMemory != null)
            {
                WriteMemory.Dispose();
                WriteMemory = null;
            }
        }