Beispiel #1
0
        static void Main(string[] args)
        {
            var setup   = new SetUpService();
            var catalog = setup.CreateCatalogue();

            var scanService  = new ScanService(catalog);
            var totalService = new TotalUpService(catalog);

            Console.WriteLine("Checkout service");
            Console.WriteLine("Please enter the code for each item and press enter. Entering 'DONE' will return the total");

            var checkOut = false;

            while (!checkOut)
            {
                var line = Console.ReadLine();
                if (line == "DONE")
                {
                    checkOut = true;
                    Console.WriteLine("Total: " + totalService.TotalUp(scanService.ScannedItems).ToString());
                    Console.ReadLine();
                }
                else
                {
                    try
                    {
                        scanService.Scan(line);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Beispiel #2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            _bindingList.Clear();

            IPAddress minimum;
            IPAddress maximum;

            if (!IPAddress.TryParse(_txtMimimum.Text, out minimum))
            {
                MessageBox.Show(
                    this,
                    @"Неправильно указан минимальный адрес.",
                    @"Scan Service",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            if (!IPAddress.TryParse(_txtMaximum.Text, out maximum))
            {
                MessageBox.Show(
                    this,
                    @"Неправильно указан максимальный адрес.",
                    @"Scan Service",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            _scanServiceConfigration.Minimum = minimum;
            _scanServiceConfigration.Maximum = maximum;

            using (var scanner = new ScanService(_scanServiceConfigration))
            {
                var list = await scanner.ScanNetworkAsync();

                if (list == null || list.Count == 0)
                {
                    MessageBox.Show(
                        this,
                        @"Видеокамеры не найдены.",
                        @"Scan Service",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    return;
                }

                foreach (var ipAddressData in list)
                {
                    if (ipAddressData == null)
                    {
                        return;
                    }

                    _bindingList.Add(ipAddressData);
                }
            }
        }
Beispiel #3
0
 public CapturaQR(string placa, string celular)
 {
     InitializeComponent();
     scanservice = new ScanService();
     Placa       = placa;
     Celular     = celular;
 }
Beispiel #4
0
 public HomeController(ILogger <HomeController> logger, ApplicationDbContext context, ScanService scanService, SearchService searchService)
 {
     _logger       = logger;
     Context       = context;
     ScanService   = scanService;
     SearchService = searchService;
 }
Beispiel #5
0
        public void TestMethod5()
        {
            ScanService service = new ScanService();

            string err;

            bool result = service.Init(out err);

            if (!result)
            {
                Debug.WriteLine(err);
                Assert.Fail("初始化失败");
            }

            Action <string, string> action = (l, k) =>
            {
                Debug.WriteLine(l);
                Debug.WriteLine(k);
            };

            service.StartEngine(action);

            while (true)
            {
                Debug.WriteLine("running...");

                Thread.Sleep(3000);
            }
        }
Beispiel #6
0
        public MainViewModel()
        {
            //Singleton
            instance = this;

            //Create observable collections
            Menu      = new ObservableCollection <MenuItemViewModel>();
            Products  = new ObservableCollection <ProductItemViewModel>();
            Customers = new ObservableCollection <Customer>();
            Pins      = new ObservableCollection <Pin>();
            Orders    = new ObservableCollection <OrderItemViewModel>();

            //Create views
            NewLogin        = new LoginViewModel();
            UserLoged       = new UserViewModel();
            CurrentCustomer = new CustomerItemViewModel();
            NewCustomer     = new CustomerItemViewModel()
            {
                UserName = "******", Phone = "ss", FirstName = "aaa", LastName = "bbb", Address = "dir", CityId = 19, DepartmentId = 15
            };

            //Create instences service
            dataService       = new DataService();
            apiService        = new ApiService();
            netService        = new NetService();
            navigationService = new NavigationService();
            scanService       = new ScanService();

            LoadMenu();
            LoadProducts();
            LoadCustomers();
            LoadOrders();
        }
Beispiel #7
0
        public VentasPg()
        {
            InitializeComponent();
            cargar();
            scanservice   = new ScanService();
            ServidorEscon = new Servidor();

            ServidorEscon.servidor = "http://calidad.escondatagate.net";
            ServidorEscon.url      = "/wsParser/rest/parserWS";
            //ServidorEscon.usuario = "20542471256King02";
            //ServidorEscon.clave = "King2018*";
            //emi.numeroDocId = "20542471256";

            ServidorEscon.usuario = "20557103920ad_escon";
            ServidorEscon.clave   = "Escon2018*";
            emi.numeroDocId       = "20557103920";

            emi.tipoDocId         = "6";
            emi.nombreComercial   = "INGENIERIA E INFORMATICA KING SOFTWARE SAC";
            emi.razonSocial       = "KSOFT";
            emi.ubigeo            = "150131";
            emi.direccion         = "A.H. BELLA DURMIENTE MZ B LOTE 19";
            emi.urbanizacion      = "";
            emi.provincia         = "HUANUCO";
            emi.distrito          = "HUANUCO";
            emi.departamento      = "HUANUCO";
            emi.codigoPais        = "PE";
            emi.telefono          = "998887099";
            emi.correoElectronico = "*****@*****.**";
        }
Beispiel #8
0
        public void Web_Service_For_Scan_Completion()
        {
            // pick a device to test
            var device = new LinqMetaData().Device.FirstOrDefault(x => x.ScansAvailable > 0);

            Assert.IsNotNull(device);

            // setup service call
            var output  = new StringWriter();
            var service = new ScanService();
            var url     = new Uri("http://localhost/" + service.GetProperties().Url + "/scancomplete", UriKind.Absolute);

            HttpContext.Current = new HttpContext(
                new HttpRequest(url.AbsolutePath, url.AbsoluteUri, url.Query),
                new HttpResponse(output));
            HttpContext.Current.User = new RolePrincipal(new GenericIdentity(device.UniqueIdentifier));
            Thread.CurrentPrincipal  = HttpContext.Current.User;

            // report the completed scan
            var count = service.ScanComplete(new ScanRecord
            {
                ScanStartTime = DateTime.UtcNow,
                ScanType      = ScanType.ClearViewScan
            });

            // compare the completed count before and after
            Assert.AreEqual(device.ScansUsed + 1, count.ScansCompleted);
        }
 public void Setup()
 {
     logger       = Substitute.For <ILogger <SvxLinkService> >();
     repositories = Substitute.For <IRepositories>();
     scanService  = new ScanService(Substitute.For <ILogger <ScanService> >(), new TelemetryClient());
     telemetry    = new TelemetryClient();
     iniService   = Substitute.For <IIniService>();
 }
        public void ScanServiceTestSetUp()
        {
            var catalog = new Catalogue();

            catalog.AddProduct(new Product("A13", 0.50m, "Apple"));
            catalog.AddProduct(new Product("C45", 1.50m, "Chicken"));
            catalog.AddProduct(new Product("B15", 2.50m, "Beans"));
            catalog.AddProduct(new Product("T23", 1.00m, "Tea"));

            ScanService = new ScanService(catalog);
        }
Beispiel #11
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            string test = "检验流水号: 11003718083100081"
                          + "号牌号码: 京EBX815"
                          + "车辆类型: 小型轿车"
                          + "检测项目: 制动,灯光,策划,悬架,底盘,动态底盘,外观"
                          + "检测次数: 制动 1 次,灯光 10 次"
                          + "引车员: 尚小楠"
                          + "检测时间: 2018-09-01 08:11:26";

            ScanService.EnQueue(test);
        }
        void On_ClickedScan(object sender, EventArgs eventArgs)
        {
            //TODO: Once moved to VM, this will be injected via IoC
            var scanService = new ScanService();

            scanService.InitializeService();
            scanService.OnScanComplete += _scanComplete;

            Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            {
                scannerReady.IsVisible = true;
            });
        }
Beispiel #13
0
        public void ScanService_return_list_of_items(string inputData)
        {
            //given
            var expected = typeof(IEnumerable <ScannedProducts>);

            ItemstoScan items = new ItemstoScan(inputData);
            var         sut   = new ScanService();

            //when
            var actual = sut.Scan(items);

            //then
            Assert.IsAssignableFrom(expected, actual);
        }
        public void Scan()
        {
            var website = WebsiteRepository.GetNextScanTargets(1).FirstOrDefault();

            if (website == null)
            {
                throw new NoWebsiteException();
            }

            var scan = ScanService.TriggerScan(website.Hostname);

            scan.Wait();
            ScanRepository.AddWebsiteToScan(scan.Result, website.Id);
            WebsiteRepository.UpdateLastScanDateToNow(website.Id);
        }
Beispiel #15
0
        public async Task <IActionResult> Scan(string url, int depth, int amount)
        {
            if (!ModelState.IsValid || !Uri.IsWellFormedUriString(url, UriKind.Absolute))
            {
                ViewBag.Message = $"Введите корректные данные";
                return(View());
            }
            var result = await ScanService.ScanUrl(url, depth, amount);

            foreach (var urlContent in result)
            {
                await Context.UrlContents.AddAsync(urlContent);
            }

            await Context.SaveChangesAsync();

            ViewBag.Message = $"Количество просканированных страниц: {result.Count}";
            return(View());
        }
        public MainViewModel()
        {
            //


            //aqui ya tengo el objeto instanciado(usted es la instancia)
            //singleton
            instance = this;


            //create observable collection
            Menu      = new ObservableCollection <MenuItemViewModel>();
            Products  = new ObservableCollection <ProductsItemViewMOdel>();
            Customers = new ObservableCollection <CustomerItemView>( );
            Pins      = new ObservableCollection <Pin>();


            //Instance service
            dataService       = new DataService();
            apiService        = new ApiService();
            netService        = new NetService();
            navigationService = new NavigationService();
            scanService       = new ScanService();

            //Create views
            //Solo neceisto el login solo al entrar al servicio:
            NewLogin = new LoginViewModel();
            //aqui me trae la propiedad fullname
            UserLoged = new UserViewModel();

            CurrentCustomer = new CustomerItemView();
            NewCustomer     = new CustomerItemView();


            //load data:
            //traigo el nombre completo del usuario actual:
            //LoadUser();
            //Menu
            LoadMenu();
            LoadProduct();
            LoadCustomers();
        }
Beispiel #17
0
        private static void RunFromConsole()
        {
            ConsoleManager.Show();

            var service = new ScanService(Settings.Default.Port);

            try
            {
                service.Start();
                Console.WriteLine("Press any key to stop service");
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            finally
            {
                service.Stop();
            }
        }
Beispiel #18
0
        public void Web_Service_For_Scans_Available()
        {
            // pick a device to test
            var device = new LinqMetaData().Device.FirstOrDefault(x => x.ScansAvailable > 0);

            Assert.IsNotNull(device);

            // setup service call
            var output  = new StringWriter();
            var service = new ScanService();
            var url     = new Uri("http://localhost/" + service.GetProperties().Url + "/getcount", UriKind.Absolute);

            HttpContext.Current = new HttpContext(
                new HttpRequest(url.AbsolutePath, url.AbsoluteUri, url.Query),
                new HttpResponse(output));
            HttpContext.Current.User = new RolePrincipal(new GenericIdentity(device.UniqueIdentifier));
            Thread.CurrentPrincipal  = HttpContext.Current.User;

            // get count reported by service
            var count = service.GetCount();

            // compare service count to device from database
            Assert.AreEqual(device.ScansAvailable, count.ScansAvailable);
        }
Beispiel #19
0
        /// <summary>
        /// Проверка доступности порта.
        /// </summary>
        /// <param name="portNumber">Номер порта.</param>
        /// <returns>True, если порт доступен, и false, если порт занят.</returns>

        private bool CheckPortAvailability(int portNumber)
        {
            var scanService       = new ScanService(portNumber);
            var resultCheckServer = scanService.CheckServer();

            if (resultCheckServer != null)
            {
                string error;
                if (resultCheckServer.Code == 32)
                {
                    error = "Порт " + portNumber + " занят другим процессом. ";
                }
                else
                {
                    error = "Непредусмотренная ошибка. Отправьте это сообщение разработчикам." + Environment.NewLine + Environment.NewLine + resultCheckServer.Text + Environment.NewLine + Environment.NewLine;
                }

                error += "Попробуйте изменить или освободить порт.";
                MessageBox.Show(error);

                return(false);
            }
            return(true);
        }
Beispiel #20
0
 public void Setup()
 {
     _dataRepositoryMock = new Mock <IDataRepository>();
     _sut = new ScanService(_dataRepositoryMock.Object);
 }
 public TestableSvxlinkService(ILogger <SvxLinkService> logger, IRepositories repositories, ScanService scanService, TelemetryClient telemetry, IIniService iniService) : base(logger, repositories, scanService, telemetry, iniService)
 {
 }
Beispiel #22
0
 private void ChargeForm_Shown(object sender, EventArgs e)
 {
     ScanService.SetAction(ExplainText);
     ScanService.Work();
     ScanService.Satrt();
 }
Beispiel #23
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     ScanService.Close();
 }
Beispiel #24
0
 public ScanHub(ScanService scanService)
 {
     _scanService = scanService;
 }
Beispiel #25
0
 public HomeView()
 {
     _scanService = new ScanService();
 }
Beispiel #26
0
 private void Init()
 {
     ScanService.SetAction(Print);
     ScanService.Work();
     ScanService.Satrt();
 }