private void AddRow(string productCode, int containerID, int quantity, bool empty, int dataSetCol, bool quantityLocked) { //if (String.IsNullOrEmpty(productCode)) // return; //if (String.IsNullOrEmpty(categoryName)) // return; //if (quantity == 0) // return; sol_Product = new Sol_Product(); if (productCode == "Pallets") { sol_Product.ProductID = -1; sol_Product.ProName = productCode; } else if (productCode == "EmptyBags") { sol_Product.ProductID = 0; sol_Product.ProName = productCode; } //if (String.IsNullOrEmpty(productCode)) //{ //if(empty) // sol_Product.ProName = "Empty"; //Undefined"; //else // sol_Product.ProName = ""; //Undefined"; //} else { sol_Product = sol_Product_Sp.SelectProductCode(productCode); if (sol_Product == null) { sol_Product = new Sol_Product(); sol_Product.ProName = "Undefined"; } } this.dataGridViewShippingContainers.Rows.Add(); int colIndex = 0; int rowIndex = this.dataGridViewShippingContainers.Rows.Count - 1; this.dataGridViewShippingContainers.Rows[rowIndex].Cells[colIndex].Value = sol_Product.ProName; colIndex++; this.dataGridViewShippingContainers.Rows[rowIndex].Cells[colIndex].Value = containerID; colIndex++; this.dataGridViewShippingContainers.Rows[rowIndex].Cells[colIndex].Value = quantity; this.dataGridViewShippingContainers.Rows[rowIndex].Cells[colIndex].ReadOnly = quantityLocked; colIndex++; this.dataGridViewShippingContainers.Rows[rowIndex].Cells[colIndex].Value = empty; colIndex++; this.dataGridViewShippingContainers.Rows[rowIndex].Cells[colIndex].Value = sol_Product.ProductID; }
//private void timer1_Tick(object sender, System.EventArgs e) //{ // DateTime t = DateTime.Now; // toolStripStatusLabelTimer.Text = t.ToShortTimeString(); // toolStripStatusLabelToday.Text = t.ToShortDateString(); //} private void textBoxTagNumber_Leave(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBoxTagNumber.Text)) { return; } if (buttonClicked != "&New") { return; } //was a barcode read? string barCode = textBoxTagNumber.Text.Trim(); string x = barCode; if (x.Length > 7) { //x = x.Substring(x.Length - 7); //int intValue = 0; //Int32.TryParse(x, out intValue); //if (intValue > 0) // textBoxTagNumber.Text = String.Format("{0}", intValue); //else //{ // MessageBox.Show("Error parsing the Tag Number!"); // textBoxTagNumber.Focus(); // return; //} //search for product from barcode /* 0000 1006 00000 0004209 * 4 = vendorID * 4 = productCode = ItemTypes (CRIS) * 5 = quantity * 7 = tagNumber * 7 + 5 + 4 * */ x = barCode; if (x.Length > 19) { int i = x.Length - 16; x = x.Substring(i, 4); } if (sol_Product_Sp == null) { sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString); } //search for product sol_Product = sol_Product_Sp.SelectProductCode(x); if (sol_Product != null) { comboBoxProducts.SelectedValue = sol_Product.ProductID; textBoxQuantity.Focus(); //textBoxDozen.Focus(); } } }