private void PrintLabel1() { string sPrinterName = Utility.XmlReadParam(CONFIG_FILE_PATH, "/Configuration/Printer/Name"); if (sPrinterName != null) { string sDateTime = String.Format("{0:D2}/{1:D2}/{2:D2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year % 100); string sBatch = Printing.GenerateBatch(labelMachineNumber.Text, System.DateTime.Now); Printing.PrintLabel(sPrinterName, labelProductLabel.Text, labelArticleNumber.Text, sBatch, labelBoxNumber.Text, labelWorkOrder.Text, sDateTime, labelGood.Text); } }
private void btnPrint_Click(object sender, EventArgs e) { if (Convert.ToInt32(txtBoxNumber.Text) > 0) { Cursor oldCursor = btnPrint.Cursor; btnPrint.Cursor = Cursors.WaitCursor; btnPrint.Enabled = false; int iTagInBox = registration.CountTotalTagInBoxInSeverAndLocalDatabase(txtWorkOrder.Text, txtBoxNumber.Text); btnPrint.Cursor = oldCursor; if (iTagInBox >= 0) { DateTime dateTime = Convert.ToDateTime(txtDateTime.Text); string sDate = String.Format("{0:D2}/{1:D2}/{2:D2}", dateTime.Day, dateTime.Month, dateTime.Year % 100); string sBatch = Printing.GenerateBatch(Convert.ToInt32(txtMachineNumber.Text), dateTime); Printing.PrintLabel( sPrinterName, txtLabelName.Text, txtArticleNumber.Text, sBatch, txtBoxNumber.Text, txtWorkOrder.Text, sDate, iTagInBox.ToString() ); } else { MessageBox.Show("Cannot get quantity in box.\n" + registration.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } btnPrint.Enabled = true; } else { MessageBox.Show("This tag is in bad tag.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }