private void PartTimer_Tick(object sender, EventArgs e) { if (DataList.PartExists(partnum_txt.Text)) { try { UpdateDescField(); EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["MtlPartNum"] = partnum_txt.Text; EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["MtlPartNumPartDescription"] = desc_txt.Text; //Update UOM list try { DataTable ds = DataList.PartUOM(partnum_txt.Text); uom_cbo.DataSource = ds; uom_cbo.DisplayMember = "UOMCode"; uom_cbo.ValueMember = "UOMCode"; uom_cbo.Text = DataList.PartIUM(partnum_txt.Text); EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["UOMCode"] = uom_cbo.Text; } catch (Exception ex) { MessageBox.Show(ex.Message, "Could not retrieve UOM for this part number"); } Part part = new Part(DataList.EpicConn); bool morePages; PartListDataSet Pdata = part.GetList("PartNum >= '" + partnum_txt.Text + "'", 100, 0, out morePages); string Type = Pdata.Tables[0].Rows[0]["TypeCode"].ToString(); ViewAsAsm_chk.Checked = (Type == "M"); EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["ViewAsAsm"] = ViewAsAsm_chk.Checked; bool PullAsAssy = false; bool.TryParse(Pdata.Tables[0].Rows[0]["PhantomBOM"].ToString(), out PullAsAssy); PullAsAsm_chk.Checked = PullAsAssy; EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["PullAsAsm"] = PullAsAsm_chk.Checked; if (desc_txt.Text.Contains("COIL") || desc_txt.Text.Contains("SHEET")) { try { Item_SheetFactor Sheet = new Item_SheetFactor(qty_num.Value, partnum_txt.Text); //if you don't shut it off before the dialog it keeps popping up PartTimer.Enabled = false; Sheet.ShowDialog(); qty_num.Value = Sheet.FactoredWeight; EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["QtyPer"] = qty_num.Value; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } catch { desc_txt.Text = ""; } } PartTimer.Enabled = false; }
private void factor_btn_Click(object sender, EventArgs e) { Item_SheetFactor Sheet = new Item_SheetFactor(qty_num.Value,partnum_txt.Text); Sheet.ShowDialog(); qty_num.Value = Sheet.FactoredWeight; EngWBDS.Tables["ECOMtl"].Rows[BillDataGrid.CurrentCellAddress.Y]["QtyPer"] = qty_num.Value; Sheet.Dispose(); }