//----------------------------------------------------------------------------------------------------- public void DisplayOrderParts() { dtPart = new DataTable(); ClassLibrary.Part part = new ClassLibrary.Part(); int i = 1; foreach (DataRow row in dtParts.Rows) { part.Id = Convert.ToInt32(row.ItemArray[0]); dtPart = part.Get().Tables[0]; foreach (DataRow row2 in dtPart.Rows) { PartList2.Add(new PartsInTheOrder2 { item = i++, PartID = Convert.ToInt32(row2.ItemArray[0]), PartName = Convert.ToString(row2.ItemArray[1]), PartQuantity = Convert.ToInt32(row.ItemArray[1]), }); } } dataGridViewParts2.DataSource = PartList2; }
//----------------------------------------------------------------------------------------------------- private void btnSupplierChooser_Click(object sender, EventArgs e) { try { int id = (int)dataGridViewParts2.CurrentRow.Cells["PartID"].Value; int index = (int)dataGridViewParts2.CurrentRow.Cells["item"].Value; ClassLibrary.Part part = new ClassLibrary.Part(); part.Id = id; DataTable thisTable = part.Get().Tables[0]; DataRow[] rows = thisTable.Select(); foreach (DataRow row in rows) { frmChooseSupplier f = new frmChooseSupplier(id, index, this); f.MdiParent = this.MdiParent; f.StartPosition = FormStartPosition.CenterScreen; f.Show(); } } catch (Exception ex) { } }