public MBarcode Apply(MBarcode dat) { MBarcode bc = new MBarcode(); bc.BatchNo = dat.BatchNo; bc.Url = dat.Url; bc.Product = dat.Product; bc.GeneratedDate = DateTime.Now; bc.IsActivated = false; bc.Path = dat.Path; bc.CompanyWebSite = dat.CompanyWebSite; bc.Barcode = dat.Barcode; bc.Product = dat.Product; if (IsMigration(dat)) { bc.SerialNumber = dat.SerialNumber; bc.Pin = dat.Pin; bc.PayloadUrl = dat.PayloadUrl; } else { bc.SerialNumber = RandomUtils.RandomStringNum(10); bc.Pin = RandomUtils.RandomStringNum(10); bc.PayloadUrl = string.Format("{0}/verification/{1}/{2}/{3}", bc.Url, bc.Path, bc.SerialNumber, bc.Pin); } string path = BarcodeUtils.BuildBarcodePath("barcodes", bc.SerialNumber, bc.Pin); var ctx = GetNoSqlContext(); ctx.PostData(path, bc); return bc; }
private bool IsBarcodeExisting(string serialNumber, string pin) { string bcPath = BarcodeUtils.BuildBarcodePath("barcodes", serialNumber, pin); MBarcode bc = ctx.GetObjectByKey <MBarcode>(bcPath); if (bc != null) { return(true); } return(false); }
static async Task CreateQRCode() { var options = new BarcodeOptions { Type = "QRCode", Content = "https://cn.etsoo.com/", ForegroundText = "#3f51b5", Width = 600, Height = 600 }; using var stream = File.Create("D:\\test.png"); await BarcodeUtils.CreateAsync(stream, options); Console.Write("QRCode created"); }
private void txt_TextChanged(object sender, EventArgs e) { if (_mode == DataActionMode.Add) { TextBox txt = sender as TextBox; if (txt.Name == "txtItemNo") { if (!String.IsNullOrEmpty(txtItemNo.Text)) { Image _barcode = BarcodeUtils.GenerateBitmapBarcode(txtItemNo.Text); barcodePic.Image = _barcode == null ? null : _barcode; // gen barcode } else { barcodePic.Image = null; } } } updateUI(); }
public int Apply(MRegistration dat) { ValidateRegistration(dat); string barcode = string.Format("{0}-{1}", dat.SerialNumber, dat.Pin); MBarcode bc = null; string bcPath = null; var ctx = GetNoSqlContext(); if ((dat.SerialNumber.Length > 3) && (dat.Pin.Length > 3)) { bcPath = BarcodeUtils.BuildBarcodePath("barcodes", dat.SerialNumber, dat.Pin); bc = ctx.GetObjectByKey <MBarcode>(bcPath); } if (bc == null) { string msg = PostData(dat, barcode, "NOTFOUND", "Serial number and PIN not found [{0}]"); throw (new ArgumentException(msg)); } dat.RegistrationDate = DateTime.Now; dat.LastMaintDate = DateTime.Now; ValidateActivation(dat, bc, barcode); //Update status back to barcode bc.IsActivated = GetActivateFlag(); bc.ActivatedDate = DateTime.Now; bc.LastMaintDate = DateTime.Now; ctx.PutData(bcPath, bc.Key, bc); PerformRegistrationAction(dat, barcode); return(0); }
public BarcodeUtils.BarcodeModel Get() { BarcodeUtils.BarcodeModel bmModel = BarcodeUtils.BarcodeCustomReader(); return(bmModel); }
private void Print(PrintingDocument pDoc) { try { //RViewer rview; LabelPrintDoc printDoc; switch (pDoc) { case PrintingDocument.Label: #region Label int sel = 0; List <string> ids = new List <string>(); foreach (DataGridViewRow r in dgvDespachos.Rows) { if (((DataGridViewCheckBoxCell)r.Cells["Imp_Etqueta"]).Value == null) { continue; } bool val = bool.Parse(((DataGridViewCheckBoxCell)r.Cells["Imp_Etqueta"]).Value.ToString()); if (val) { ids.Add(((DataGridViewTextBoxCell)r.Cells["GUIA_ID"]).Value.ToString()); } } //if (sel < 2) { MessageBox.Show("Debe seleccionar al menos 2 registros para imprimir etiquetas"); return; } if (ids.Count == 0) { MessageBox.Show("Debe seleccionar al menos 1 registro para imprimir etiquetas"); return; } //rview = new RViewer(); //rview.ReportType = RViewer.ActionType.Label; //rview.PrinterName = cbPrinterLabel.Text; controller.RequestObj.TransParms.Clear(); controller.RequestObj.TransParms.Add(new TransParm("gNo", JsonConvert.SerializeObject(ids.ToArray()))); List <V_GUIA_ETIQUETA> dSource = (List <V_GUIA_ETIQUETA>)controller.GetData((int)GuiasController.ActionType.GetLabels); printDoc = new LabelPrintDoc(400, 480); printDoc.Images.Add(Properties.Resources.logoblanconegro); printDoc.PrinterName = cbPrinterLabel.Text; printDoc.TypeDocToPrint = LabelPrintDoc.TypeDoc.Label; //List<GUIA_LABEL_DUO> ds = new List<GUIA_LABEL_DUO>(); for (int i = 0; i < dSource.Count; i++) { GUIA_LABEL_DUO d = new GUIA_LABEL_DUO(); if (i % 2 == 0) { d.GUIA_PREFIJO1 = dSource[i].GUIA_PREFIJO; d.GUIA_ID1 = dSource[i].GUIA_ID; d.NOMBRE1 = dSource[i].NOMBRE; d.DIRECCION1 = dSource[i].DIRECCION; d.CIUDAD1 = dSource[i].CUIDAD; d.REFERENCIA1 = dSource[i].REFERENCIA; d.CONSECUTIVO_CLIENTE1 = dSource[i].CONSECUTIVO_CLIENTE; d.BARCODE1 = BarcodeUtils.GenBarcode(d.GUIA_PREFIJO1 + d.GUIA_ID1.ToString()); } i++; if (i < dSource.Count) { d.GUIA_PREFIJO2 = dSource[i].GUIA_PREFIJO; d.GUIA_ID2 = dSource[i].GUIA_ID; d.NOMBRE2 = dSource[i].NOMBRE; d.DIRECCION2 = dSource[i].DIRECCION; d.CIUDAD2 = dSource[i].CUIDAD; d.REFERENCIA2 = dSource[i].REFERENCIA; d.CONSECUTIVO_CLIENTE2 = dSource[i].CONSECUTIVO_CLIENTE; d.BARCODE2 = BarcodeUtils.GenBarcode(d.GUIA_PREFIJO2 + d.GUIA_ID2.ToString()); } //ds.Add(d); printDoc.DataToPrint = d; printDoc.PrintDoc(); } //rview.D_Source = ds; //rview.ShowDialog(); #endregion break; case PrintingDocument.Guia: #region Guia //WITH VIEWER //rview = new RViewer(); //rview.ReportType = RViewer.ActionType.Guia; //rview.PrinterName = cbPrinterGuia.Text; controller.RequestObj.TransParms.Clear(); controller.RequestObj.TransParms.Add(new TransParm("gNo", _guiaNo.ToString())); //JObject o = JsonConvert.DeserializeObject<JObject>(JsonConvert.SerializeObject(controller.GetData((int)GuiasController.ActionType.GetGuia))); //rview.D_Source = o; //rview.ShowDialog(); //With LabelPrintDoc printDoc = new LabelPrintDoc(580, 820); printDoc.PrinterName = cbPrinterGuia.Text; printDoc.TypeDocToPrint = LabelPrintDoc.TypeDoc.Guia; JArray o = JsonConvert.DeserializeObject <JArray>(JsonConvert.SerializeObject(controller.GetData((int)GuiasController.ActionType.GetGuia))); if (o.Count == 0) { throw new Exception("Error cargando datos de guia"); } printDoc.DataToPrint = o[0].ToObject <JObject>(); printDoc.PrintDoc(); #endregion break; default: break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }