public void Return_Deep_Part() { IPartsService repo = new PartsService(new BadgerDataModel()); var part = repo.Find(1); Assert.IsTrue(part != null); }
private void dgOrderItems_CellClick(object sender, DataGridViewCellEventArgs e) { var dg = (DataGridView)sender; if (dg.DataSource != null) { if (dg.RowCount > 0) { PurchaseLineItem lineItem = (PurchaseLineItem)dg.CurrentRow.DataBoundItem; if (e.ColumnIndex == 1) { if (lineItem.PartID > 0) { PartForm partForm = new PartForm(); if (lineItem != null) { var part = partsService.Find(lineItem.PartID.Value); PartView partView = new PartView(part, _context); partForm.Controls.Add(partView); partView.Dock = DockStyle.Fill; partForm.Show(); } } } } } }
private void loadData(int partid) { // Pull the part from database _part = partService.Find(partid); // Hydrate the DTO _partMapper.Map(_part, _partDTO); bsPart.DataSource = _partDTO; bsResources.DataSource = _partDTO.Resources; dgResources.DataSource = bsResources; txtPartCategory.Text = partService.PartTypeName(_partDTO.PartTypeID); }
private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e) { IPartsService partService = new PartsService(_context); string foundBarCode = e.ValueRead.ToString(); if (foundBarCode != string.Empty) { int key = int.Parse(foundBarCode); var inv = partService.Find(key); if (inv != null) { Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = inv; })); Invoke(new MethodInvoker(() => { this.label1.Text = foundBarCode + " : Found"; })); } else { Invoke(new MethodInvoker(() => { this.propertyGrid1.SelectedObject = null; })); Invoke(new MethodInvoker(() => { this.label1.Text = foundBarCode + " : No Match Found"; })); } } }