private void Fill() { CWCarModelsLogic models = new CWCarModelsLogic(manager); CWCategoriesLogic categories = new CWCategoriesLogic(manager); CategoriesCB.DisplayMember = "Name"; CategoriesCB.ValueMember = "ID"; CategoriesCB.DataSource = categories.GetAll(); if (mode == "edit") { CWCarModel model = models.Get(Convert.ToInt32(id)); if (model != null) { NameTB.Text = model.Name; BrandImagePB.SizeMode = PictureBoxSizeMode.Zoom; _image = Helpers.ImageOperations.ByteArrayToImage(model.Image); image = model.Image; BrandImagePB.Image = _image; foreach (object category in CategoriesCB.Items) { if (((CWCategory)category).ID == model.CategoryID) { CategoriesCB.SelectedItem = category; } } } } }
private void Fill() { CWCarsLogic cars = new CWCarsLogic(manager); CWCategoriesLogic categories = new CWCategoriesLogic(manager); CategoriesCB.DisplayMember = "Name"; CategoriesCB.ValueMember = "ID"; CategoriesCB.DataSource = categories.GetAll(); FillBrands(); if (mode == "edit") { CWCar car = cars.Get(Convert.ToInt32(id)); if (car != null) { foreach (object category in CategoriesCB.Items) { if (((CWCategory)category).ID == car.CategoryID) { CategoriesCB.SelectedItem = category; } } } } }
private void Fill() { CWCategoriesLogic Categories = new CWCategoriesLogic(manager); DataGV.AutoGenerateColumns = false; DataGV.DataSource = Categories.GetAll(); DataGV.Update(); }
/// <summary> /// заповнення категорій автомобілів /// </summary> public void FillCategories() { CWCategoriesLogic categories = new CWCategoriesLogic(manager); CarCategoriesCB.DisplayMember = "Name"; CarCategoriesCB.ValueMember = "ID"; CWCategory c0 = new CWCategory(); c0.ID = -1; c0.Name = "-не обрано-"; CarCategoriesCB.Items.Add(c0); foreach (CWCategory category in categories.GetAll()) { CarCategoriesCB.Items.Add(category); } }