private void Connect(DataGrid grid) { try { adoDB = new ADOModel(); IEnumerable <Category> categories = adoDB.Categories.Include(c => c.WHs).Where(c => c.NameCategory == selectedCategory.NameCategory).ToList(); IEnumerable <WH> parts = categories.SelectMany(p => p.WHs).ToList(); foreach (var a in parts) { List <string> str = a.Categories.Select(c => c.NameCategory).ToList(); foreach (string s in str) { AllResullt res = new AllResullt(); res.Manufacturer = a.Manufacturer; res.Model = a.Model; res.Count = a.Count; res.Price = a.Price; res.CategoryName = s; grid.Items.Add(res); } } } catch (Exception ex) { MessageBox.Show(" Error: " + ex.Message); } }
private void Connect() { adoDB = new ADOModel(); IEnumerable <Category> allCategory = adoDB.Categories.Include(p => p.WHs); foreach (var a in allCategory) { Category resCategory = new Category(); resCategory.CategoryID = a.CategoryID; resCategory.NameCategory = a.NameCategory; CategoryGrid.Items.Add(resCategory); } }
private void Connect() { adoDB = new ADOModel(); IEnumerable <Category> allCategory = adoDB.Categories.Include(p => p.WHs); foreach (var a in allCategory) { Category resCategory = new Category(); resCategory.CategoryID = a.CategoryID; resCategory.NameCategory = a.NameCategory; CategoryGrid.Items.Add(resCategory); } Manufacturer.Text = resultIn.Manufacturer; Model.Text = resultIn.Model; Count.Text = resultIn.Count.ToString(); Price.Text = resultIn.Price.ToString(); }
private void Wharehouse_Button_Click(object sender, RoutedEventArgs e) { MainGrid.Items.Clear(); adoDB = new ADOModel(); IEnumerable <WH> allLine = adoDB.WHs; foreach (var a in allLine) { List <string> str = a.Categories.Select(c => c.NameCategory).ToList(); AllResullt res = new AllResullt(); res.Manufacturer = a.Manufacturer; res.Model = a.Model; res.Count = a.Count; res.Price = a.Price; foreach (string s in str) { res.CategoryName = s; } MainGrid.Items.Add(res); } }
private void Connect() { MainGrid.Items.Clear(); adoDB = new ADOModel(); IEnumerable <WH> allLine = adoDB.WHs.Include(p => p.Categories); foreach (var a in allLine) { List <string> str = a.Categories.Select(c => c.NameCategory).ToList(); foreach (string s in str) { AllResullt res = new AllResullt(); res.IdPart = a.ID_Pard; res.Manufacturer = a.Manufacturer; res.Model = a.Model; res.Count = a.Count; res.Price = a.Price; res.CategoryName = s; MainGrid.Items.Add(res); } } }