private void loadRecords() { try { this.Cursor = Cursors.WaitCursor; gridData.Rows.Clear(); IList records = r_part.GetAll(); foreach (Part d in records) { int row = gridData.Rows.Add(d.CODE, d.NAME, d.ACTIVE, d.BARCODE); d.PART_GROUP = (PartGroup)Utils.FindEntityInList(d.PART_GROUP.ID, m_partGroupList); //(PartGroup)RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.PART_GROUP_REPOSITORY).GetById(d.PART_GROUP); d.UNIT = (Unit)Utils.FindEntityInList(d.UNIT.ID, m_unitList); //RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.UNIT_REPOSITORY).GetById(d.UNIT); d.CURRENCY = (Currency)Utils.FindEntityInList(d.CURRENCY.ID, m_currencyList); //RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.CURRENCY_REPOSITORY).GetById(d.CURRENCY); d.PART_CATEGORY = (PartCategory)Utils.FindEntityInList(d.PART_CATEGORY.ID, m_partCategoryList); //RepositoryFactory.GetInstance().GetRepository(RepositoryFactory.PART_GROUP_REPOSITORY).GetById(d.PART_CATEGORY); gridData.Rows[row].Tag = d; } if (gridData.Rows.Count > 0) { gridData.Rows[0].Selected = true; } gridData_SelectionChanged(null, null); this.Cursor = Cursors.Default; foundtoolStripLabel.Text = "Found " + gridData.Rows.Count.ToString() + " item(s)"; } catch (Exception x) { KryptonMessageBox.Show(x.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { this.Cursor = Cursors.Default; } }
private void initDataSource() { m_partGroupList = r_group.GetAll(); m_partGroupList.Add(new PartGroup(0, "ALL")); partGroupkryptonComboBox1.DataSource = m_partGroupList; m_partCategoryList = r_category.GetAll(); m_partCategoryList.Add(new PartCategory(0, "ALL")); partCategorykryptonComboBox5.DataSource = m_partCategoryList; m_priceCategoryList = r_pricecategory.GetAll(); m_priceCategoryList.Add(new PriceCategory(0, "ALL")); pricecategorykryptonComboBox4.DataSource = m_priceCategoryList; m_currencyList = r_ccy.GetAll(); currencykryptonComboBox4.DataSource = m_currencyList; m_partList = r_part.GetAll(); m_partList.Add(new Part(0, "ALL")); partkryptonComboBox1.DataSource = m_partList; //typekryptonComboBox1.DataSource = Enum.GetValues(typeof(MarkUpDownSellingPriceType)); baseonkryptonComboBox2.DataSource = Enum.GetValues(typeof(MarkUpDownSellingPriceBaseOn)); marktypekryptonComboBox3.DataSource = Enum.GetValues(typeof(MarkUpDownSellingPriceMarkType)); roundTypekryptonComboBox4.DataSource = Enum.GetValues(typeof(RoundType)); partGroupkryptonComboBox1.Text = "ALL"; partCategorykryptonComboBox5.Text = "ALL"; pricecategorykryptonComboBox4.Text = "ALL"; currencykryptonComboBox4.Text = "ALL"; partkryptonComboBox1.Text = "ALL"; initDictionary(); }
public void when_getting_all_parts_from_repository() { var repository = new PartRepository(_db); var parts = repository.GetAll(x => true); _output.WriteLine(parts.ToJson()); }
public void WhenGetAllFromEmptyDatabase_ThenReturnsEmptyCollection() { var repository = new PartRepository(new DatabaseFactory()); IEnumerable<Part> actual = repository.GetAll(); Assert.NotNull(actual); var actualList = new List<Part>(actual); Assert.Equal(0, actualList.Count); }
public void TestPartsGetAllMemory() { // arrange var repo = new PartRepository <Memory>(_context, _mapper); // act var result = repo.GetAll(); // assert Assert.Equal(MockData.Memories.Count(), result.Count()); }
public SelectPartForm(int id) { InitializeComponent(); this.id = id; parts = PartRepository.GetAll(); foreach (SpareParts part in parts) { partsCombobox.Items.Add(part.Name); } partsCombobox.SelectedIndex = 0; }