internal static List<BarcodeEntity> GetBarcodeDetails(string quoteNumber) { List<BarcodeEntity> allBarcodeData = null; DataSet result = null; try { SqlParameter pQuoteNumber = new SqlParameter(); pQuoteNumber.ParameterName = "QuoteNumber"; pQuoteNumber.Value = quoteNumber; result = SQLHelper.ExecuteStoredProcedure(StoredProcedures.GetBarcodeDetails, pQuoteNumber); if (result == null || result.Tables == null || result.Tables.Count == 0 || result.Tables[0].Rows.Count == 0) { return allBarcodeData; } BarcodeEntity tempBarCode = null; allBarcodeData = new List<BarcodeEntity>(); for (int rowIndex = 0; rowIndex < result.Tables[0].Rows.Count; rowIndex++) { tempBarCode = new BarcodeEntity(); tempBarCode.LastName = result.Tables[0].Rows[rowIndex][ColumnNames.LastName].ToString(); tempBarCode.FirstName = result.Tables[0].Rows[rowIndex][ColumnNames.FirstName].ToString(); tempBarCode.SalesOrder = result.Tables[0].Rows[rowIndex][ColumnNames.SONumber].ToString(); tempBarCode.Worksheet = result.Tables[0].Rows[rowIndex][ColumnNames.WSNumber].ToString(); tempBarCode.OrderDate = result.Tables[0].Rows[rowIndex][ColumnNames.CreatedOn].ToString(); tempBarCode.CustomerPO = result.Tables[0].Rows[rowIndex][ColumnNames.CustomerPO].ToString(); tempBarCode.Description = result.Tables[0].Rows[rowIndex][ColumnNames.Description].ToString(); tempBarCode.SqFt = result.Tables[0].Rows[rowIndex][ColumnNames.SqFt].ToString(); tempBarCode.Size = result.Tables[0].Rows[rowIndex][ColumnNames.Dimension].ToString(); tempBarCode.Logo = result.Tables[0].Rows[rowIndex][ColumnNames.IsLogo].ToString() == "False" ? "No" : "Yes"; tempBarCode.Quantity = result.Tables[0].Rows[rowIndex][ColumnNames.Quantity].ToString(); tempBarCode.Line = result.Tables[0].Rows[rowIndex][ColumnNames.LineID].ToString(); tempBarCode.DueDate = result.Tables[0].Rows[rowIndex][ColumnNames.RequestedShipDate].ToString(); tempBarCode.Shape = result.Tables[0].Rows[rowIndex][ColumnNames.Shape].ToString(); if (tempBarCode.Shape.Equals("Quadrilateral")) { tempBarCode.Shape = "Square"; } allBarcodeData.Add(tempBarCode); } } catch (Exception ex) { Logger.LogException(ex); } return allBarcodeData; }
internal static BarcodeEntity GetSpecificBarcodeDetail(string wsNumber, int lineID) { BarcodeEntity barcode = null; try { SqlParameter pWsNumber = new SqlParameter(); pWsNumber.ParameterName = "wsNumber"; pWsNumber.Value = wsNumber; SqlParameter pLineID = new SqlParameter(); pLineID.ParameterName = "lineID"; pLineID.Value = lineID; var result = SQLHelper.ExecuteStoredProcedure(StoredProcedures.GetSpecificBarcodeDetail, pWsNumber, pLineID); if (result == null || result.Tables == null || result.Tables.Count == 0 || result.Tables[0].Rows.Count == 0) return barcode; barcode = new BarcodeEntity(); for (int rowIndex = 0; rowIndex < result.Tables[0].Rows.Count; rowIndex++) { barcode.LastName = result.Tables[0].Rows[0][ColumnNames.LastName].ToString(); barcode.FirstName = result.Tables[0].Rows[0][ColumnNames.FirstName].ToString(); barcode.SalesOrder = result.Tables[0].Rows[0][ColumnNames.SONumber].ToString(); barcode.Worksheet = result.Tables[0].Rows[0][ColumnNames.WSNumber].ToString(); barcode.OrderDate = result.Tables[0].Rows[0][ColumnNames.CreatedOn].ToString(); barcode.CustomerPO = result.Tables[0].Rows[0][ColumnNames.CustomerPO].ToString(); barcode.Description = result.Tables[0].Rows[0][ColumnNames.Description].ToString(); barcode.SqFt = result.Tables[0].Rows[0][ColumnNames.SqFt].ToString(); barcode.Size = result.Tables[0].Rows[0][ColumnNames.Dimension].ToString(); barcode.Logo = result.Tables[0].Rows[0][ColumnNames.IsLogo].ToString() == "False" ? "No" : "Yes"; barcode.Quantity = result.Tables[0].Rows[0][ColumnNames.Quantity].ToString(); barcode.Line = result.Tables[0].Rows[0][ColumnNames.LineID].ToString(); barcode.DueDate = result.Tables[0].Rows[0][ColumnNames.RequestedShipDate].ToString(); barcode.Shape = result.Tables[0].Rows[0][ColumnNames.Shape].ToString(); if (barcode.Shape.Equals("Quadrilateral")) { barcode.Shape = "Square"; } } } catch (Exception ex) { Logger.LogException(ex); } return barcode; }
private Result PrintIndividualLineItem(Engine btEngine, string fileName, BarcodeEntity barcode, Result result, int itemID, string wsNumber) { // Open a label format specifying the default printer LabelFormatDocument btFormat = btEngine.Documents.Open(fileName); btFormat = GetBarcodeLabel(btFormat, barcode, itemID, wsNumber); string printerName = cmbPrinterSelection.SelectedValue.ToString(); btFormat = btEngine.Documents.Open(fileName, printerName); // Print the label int waitForCompletionTimeout = 10000; // 10 seconds Messages messages; string messageString = "\n\nMessages:"; result = btFormat.Print("test", waitForCompletionTimeout, out messages); foreach (Seagull.BarTender.Print.Message message in messages) { messageString += "\n\n" + message.Text; } if (result == Result.Failure) { string labelInfo = string.Format("WS: {0} ID: {1} Message: {2} ->", wsNumber, itemID, messageString); //MessageBox.Show("Print Failed for: " + messageString); Logger.LogMessage("Error:" + labelInfo); } else { string labelInfo = string.Format("WS: {0} ID: {1} Message: {2} ->", wsNumber, itemID, messageString); //MessageBox.Show("Label was successfully sent to printer." + messageString); Logger.LogMessage("Log:" + labelInfo); } return result; }
private Result PrintLineItem(Engine btEngine, string fileName, BarcodeEntity barcode) { Result result = Result.Failure; try { int currentLineItemQuantity = int.Parse(barcode.Quantity); for (int index = 0; index < currentLineItemQuantity; index++) { result = PrintIndividualLineItem(btEngine, fileName, barcode, result, index, txtWSNumber.Text); } } catch (Exception ex) { Logger.LogException(ex); } return result; }
private LabelFormatDocument GetBarcodeLabel(LabelFormatDocument btFormat, BarcodeEntity barcode, int itemID, string wsNumber) { if (btFormat.SubStrings[BarCodeConstants.CustomerName] != null) { btFormat.SubStrings[BarCodeConstants.CustomerName].Value = barcode.LastName + " " + barcode.FirstName; } if (btFormat.SubStrings[BarCodeConstants.CurrentQuantity] != null) { btFormat.SubStrings[BarCodeConstants.CurrentQuantity].Value = (itemID + 1).ToString(); } if (btFormat.SubStrings[BarCodeConstants.TotalQuantity] != null) { btFormat.SubStrings[BarCodeConstants.TotalQuantity].Value = barcode.Quantity; } if (btFormat.SubStrings[BarCodeConstants.SalesOrder] != null) { btFormat.SubStrings[BarCodeConstants.SalesOrder].Value = barcode.SalesOrder; } if (btFormat.SubStrings[BarCodeConstants.OrderDate] != null) { btFormat.SubStrings[BarCodeConstants.OrderDate].Value = barcode.OrderDate; } if (btFormat.SubStrings[BarCodeConstants.CustomerPO] != null) { btFormat.SubStrings[BarCodeConstants.CustomerPO].Value = barcode.CustomerPO; } if (btFormat.SubStrings[BarCodeConstants.Worksheet] != null) { btFormat.SubStrings[BarCodeConstants.Worksheet].Value = barcode.Worksheet; } if (btFormat.SubStrings[BarCodeConstants.Size] != null) { btFormat.SubStrings[BarCodeConstants.Size].Value = barcode.Size; } if (btFormat.SubStrings[BarCodeConstants.SQFT] != null) { btFormat.SubStrings[BarCodeConstants.SQFT].Value = barcode.SqFt; } if (btFormat.SubStrings[BarCodeConstants.Logo] != null) { btFormat.SubStrings[BarCodeConstants.Logo].Value = barcode.Logo; } if (btFormat.SubStrings[BarCodeConstants.Description] != null) { btFormat.SubStrings[BarCodeConstants.Description].Value = barcode.Description; } if (btFormat.SubStrings[BarCodeConstants.BarcodeItem] != null) { btFormat.SubStrings[BarCodeConstants.BarcodeItem].Value = wsNumber + "-" + barcode.Line + "-" + (itemID + 1).ToString(); } if (btFormat.SubStrings[BarCodeConstants.DueDate] != null) { btFormat.SubStrings[BarCodeConstants.DueDate].Value = barcode.DueDate; } if (btFormat.SubStrings[BarCodeConstants.GlassShape] != null) { btFormat.SubStrings[BarCodeConstants.GlassShape].Value = barcode.Shape; } return btFormat; }