Esempio n. 1
0
        private void lnkAdvanceBC_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            CreateBarcode go = new CreateBarcode();

            go.MdiParent = this.ParentForm;
            go.Show();
        }
Esempio n. 2
0
        public virtual CreateBarcode GetCreateBarcodeOperation()
        {
            FactoryBusinessOperation.SetNoSqlContext(ctx);
            FactoryBusinessOperation.SetLoggerFactory(FactoryConsoleApplication.GetLoggerFactory());
            CreateBarcode opr = (CreateBarcode)FactoryBusinessOperation.CreateBusinessOperationObject("CreateBarcode");

            return(opr);
        }
        public async void OnClick(View v)
        {
            if (!(View is ViewGroup root))
            {
                return;
            }
            CloseKeyboard();
            TextView results = root.FindViewById <TextView>(Resource.Id.resultData);

            _details          = "";
            _barcodeImage     = null;
            _showResultsLabel = false;
            results.Text      = _details;
            TextView resultLabel = root.FindViewById <TextView>(Resource.Id.resultLabel);

            resultLabel.Visibility = ViewStates.Gone;
            switch (_item.Id)
            {
            case "1":
                var barcode = root.FindViewById <ImageView>(Resource.Id.barcode);
                barcode.SetImageBitmap(_barcodeImage);

                var barcodeText = root.FindViewById <EditText>(Resource.Id.barcodeText);
                var includeText = root.FindViewById <CheckBox>(Resource.Id.includeText);
                var barcodeType = root.FindViewById <Spinner>(Resource.Id.barcodeTypes);
                var symbology   = Enum.Parse <Symbology>(barcodeType.SelectedItem.ToString().Replace('-', '_'));
                try
                {
                    // Call to external Zebra Create Barcode API
                    var barcodeBytes = await CreateBarcode.CreateAsync(symbology, barcodeText.Text, _density * 3, Rotation.Normal, includeText.Checked);

                    OnPostExecute(barcodeBytes);
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }
                return;

            case "2":
                EditText searchText = root.FindViewById <EditText>(Resource.Id.fdaSearchTerm);
                try
                {
                    // Call to external Zebra FDA Device Recall Search API
                    var deviceSearchJson = await FDARecall.DeviceSearchAsync(searchText.Text);

                    OnPostExecute(JToken.Parse(deviceSearchJson).ToString(Formatting.Indented));
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }

                try
                {
                    // Call to external Zebra FDA Drug Recall Search API
                    var drugSearchJson = await FDARecall.DrugSearchAsync(searchText.Text);

                    OnPostExecute(JToken.Parse(drugSearchJson).ToString(Formatting.Indented));
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }
                return;

            case "3":
                EditText lookupText = root.FindViewById <EditText>(Resource.Id.upc);
                try
                {
                    // Call to external Zebra UPC Lookup API
                    var upcLookupJson = await UPCLookup.LookupAsync(lookupText.Text);

                    OnPostExecute(JToken.Parse(upcLookupJson).ToString(Formatting.Indented));
                }
                catch (Exception e)
                {
                    OnPostExecute(e);
                }
                return;
            }
        }
Esempio n. 4
0
        public virtual MBarcode InsertData(MBarcode bc)
        {
            CreateBarcode opr = GetCreateBarcodeOperation();

            return(opr.Apply(bc));
        }
        protected override int Execute()
        {
            logger = GetLogger();

            Hashtable args       = GetArguments();
            string    payloadUrl = args["url"].ToString();
            string    batch      = args["batch"].ToString();
            string    prof       = args["profile"].ToString();
            string    outputPath = args["outpath"].ToString();

            string generate = (string)args["generate"];

            if (generate == null)
            {
                generate = "";
            }

            bool imageGenerate = generate.Equals("Y");

            BarcodeProfileBase prf = (BarcodeProfileBase)BarcodeProfileFactory.CreateBarcodeProfileObject(prof);
            INoSqlContext      ctx = GetNoSqlContextWithAuthen("FirebaseNoSqlContext");

            FactoryBusinessOperation.SetNoSqlContext(ctx);
            FactoryBusinessOperation.SetLoggerFactory(FactoryConsoleApplication.GetLoggerFactory());
            CreateBarcode opr = (CreateBarcode)FactoryBusinessOperation.CreateBusinessOperationObject("CreateBarcode");

            int quantity = Int32.Parse(args["quantity"].ToString());

            MBarcode param = new MBarcode();

            param.BatchNo = batch;
            param.Url     = payloadUrl;

            string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss");

            generator.TemplateFile = prf.TemplateFile;
            generator.Setup();

            CreateExportFile(prof, param, outputPath, timeStamp);

            for (int i = 1; i <= quantity; i++)
            {
                string chunk   = ((i - 1) / imgPerFolder).ToString().PadLeft(6, '0');
                string urlPath = string.Format("{0}_{1}_{2}/{3}", prof, param.BatchNo, timeStamp, chunk);
                string dir     = string.Format("{0}/{1}", outputPath, urlPath);

                if (!Directory.Exists(dir) && imageGenerate)
                {
                    Directory.CreateDirectory(dir);
                }

                param.Path           = urlPath;
                param.CompanyWebSite = prf.CompanyWebSite;
                param.Barcode        = prf.Barcode;
                param.Product        = prf.Product;
                MBarcode bc = opr.Apply(param);

                string fileName = string.Format("{0}/{1}-{2}.png", dir, bc.SerialNumber, bc.Pin);
                if (imageGenerate)
                {
                    generator.RenderToFile(bc, fileName);
                }

                progressFunc(bc, dir);
                WriteExportFile(prf, bc, param);

                if ((i % progressPerImage) == 0)
                {
                    int remain = quantity - i;
                    LogUtils.LogInformation(logger, "Generated {0} barcodes, {1} barcodes to go...", i, remain);
                }
            }

            CloseExportFiles();

            generator.Cleanup();
            LogUtils.LogInformation(logger, "Done generating {0} barcodes.", quantity);

            int shipped = UpdateTotalShipped(quantity);

            LogUtils.LogInformation(logger, "Updated shipped number to {0}.", shipped);


            return(0);
        }