public override global::System.Data.DataSet Clone() { BarcodeLabel cln = ((BarcodeLabel)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public PrintingList(DataTable itemList, String printerName) { this.printerName = printerName; DataRow item = itemList.Rows[0]; int i = 0; int count = 0; BarcodeLabel label; var printer = new ZebraPrinter(printerName); do { label = null; count = Int32.Parse(item[5].ToString()); label = new BarcodeLabel() { Barcode = item[4].ToString(), ItemId = item[1].ToString(), Description = item[3].ToString(), Currency = item[8].ToString(), PriceWithTax = Decimal.Parse(item[9].ToString()), Count = Int32.Parse(item[5].ToString()), PackingDate = item[10].ToString(), ExpairyDate = item[11].ToString(), NeedMasing = (bool)item[12] }; if (label != null) { try { string tempLog = string.Format("{0:dd MMM yyyy HH:mm:ss}{1}", DateTime.Now, label.ELN); const string file = "log.txt"; using (StreamWriter w = File.AppendText(file)) { w.WriteLine(tempLog); } } catch (Exception) { Debug.Assert(true, "Loging error"); } printer.Print(label.ELN); } itemList.Rows.Remove(item); item = itemList.Rows[0]; //Int32.TryParse(item[5].ToString(), out temp); //((Barcode)item[7]).NumberOfPrint = temp; //tempStr = (item[0]).ToString(); //Boolean.TryParse(tempStr , out f); //tempStr = (item[2]).ToString(); //Boolean.TryParse(tempStr, out f); //this.Add((Barcode)item[7]); } while (itemList.Rows.Count > 0); //this.print(); }
private void button_FromJSON_Click(object sender, EventArgs e) { Label = (BarcodeLabel)JsonConvert.DeserializeObject(txt_JSON.Text.Trim(), BarcodeLabel._type); this.elementCtrl_Barcode.ElementText = Label.Barcode.Text; if (OnChanged != null) { OnChanged(this, EventArgs.Empty); } }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { BarcodeLabel ds = new BarcodeLabel(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public BarcodeDisplayCtrl() { InitializeComponent(); _label = new BarcodeLabel(); _printDoc = new PrintDocument(); _printDoc.DefaultPageSettings = new PageSettings { Landscape = true }; _printDoc.PrintPage += _printDoc_PrintPage; }
public BarcodeLabelCtrl() { InitializeComponent(); _label = new BarcodeLabel(); ctrl_BarcodeElements = new BarcodeElementsCtrl(); ctrl_BarcodeElements.Dock = DockStyle.Fill; ctrl_BarcodeElements.OnChanged += ctrl_BarcodeElements_OnChanged; splitContainer1.Panel1.Controls.Add(ctrl_BarcodeElements); ctrl_BarcodeDisplay = new BarcodeDisplayCtrl(); ctrl_BarcodeDisplay.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(ctrl_BarcodeDisplay); }
public static bool TryMakeLabelFromJSON(string json, out BarcodeLabel label) { label = null; try { label = (BarcodeLabel)JsonConvert.DeserializeObject(json, BarcodeLabel._type); return(true); } catch (Exception err) { MessageBox.Show(err.Message, err.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Information); } return(false); }
public MainViewModel(BarcodeLabel label, ApplicationPrinter printer, IEventAggregator eventAggregator) { this.Label = label; this.AppPrinter = printer; string printerName; if (BarcodePrinter.Properties.Settings.Default.DefaultPrinterName == null || BarcodePrinter.Properties.Settings.Default.DefaultPrinterName.Length == 0) { printerName = printer.DefaultZebraPrinter; } else { printerName = BarcodePrinter.Properties.Settings.Default.DefaultPrinterName; } this.SelectedPrinter = printerName; this.eventAggregator = eventAggregator; logger = LogManager.GetLog(GetType()); }
public static bool GetBarcodLabelFromDB(string name, out BarcodeLabel label) { label = null; SqlConnection conn = null; try { if (MakeConnection(out conn)) { if (conn != null && conn.State != ConnectionState.Open) { conn.Open(); } SqlCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "LIS.GetBarcodeLabelTemplateByName"; cmd.CommandTimeout = 90; cmd.Parameters.AddWithValue("Name", name); SqlDataReader reader = cmd.ExecuteReader(); DataTable data = new DataTable(); data.Load(reader); reader.Close(); if (data.Rows.Count == 1) { return(Common.TryMakeLabelFromJSON(data.Rows[0]["JSON"].ToString(), out label)); } } } catch (Exception err) { MessageBox.Show(err.Message, err.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); } } return(false); }
private void button_ReloadFromDB_Click(object sender, EventArgs e) { LabelTabInfo info = Tag as LabelTabInfo; if (info == null) { MessageBox.Show("Something went terribly wrong...but everything's OK!", "Unknown Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (MessageBox.Show(string.Format("Reload ({0}) from DB?", info.Title), string.Format("Reload {0}...", info.Title), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { BarcodeLabel label; if (DB.GetBarcodLabelFromDB(info.Title, out label)) { Label = label; } else { MessageBox.Show(string.Format("Could not retrieve a label definition using the name:\r\n{0}", info.Title), "Label not found...", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public static bool AddBarcodLabelToDB(string name, BarcodeLabel label) { SqlConnection conn = null; try { if (MakeConnection(out conn)) { if (conn != null && conn.State != ConnectionState.Open) { conn.Open(); } SqlCommand cmd = conn.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "LIS.AddBarcodeLabelTemplate"; cmd.CommandTimeout = 90; cmd.Parameters.AddWithValue("Name", name); cmd.Parameters.AddWithValue("JSON", label.ToJSON()); int result = cmd.ExecuteNonQuery(); return(result == 1); } } catch (Exception err) { MessageBox.Show(err.Message, err.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); } } return(false); }
private void AddTabPage(bool isNew, string title, BarcodeLabel label) { BarcodeLabelCtrl bclCtrl = new BarcodeLabelCtrl(); bclCtrl.Dock = DockStyle.Fill; bclCtrl.Tag = new LabelTabInfo { IsNew = isNew, Title = title }; bclCtrl.Label = label; MenuItem mitab = new MenuItem(); mitab.Text = "Close"; mitab.Click += mitab_Click; TabPage page = new TabPage(title); page.Controls.Add(bclCtrl); page.ContextMenu = new System.Windows.Forms.ContextMenu(); page.ContextMenu.MenuItems.Add(mitab); page.ContextMenu.Tag = page; tabControl_Labels.TabPages.Add(page); }
public BarcodeElementsCtrl() { InitializeComponent(); _label = new BarcodeLabel(); }
void ctrl_BarcodeElements_OnChanged(object sender, EventArgs e) { ctrl_BarcodeDisplay.Label = _label = ctrl_BarcodeElements.Label; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); BarcodeLabel ds = new BarcodeLabel(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "BarcodeDSDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }