//public string WareName //{ // get // { // string result = null; // if (NameTB.Text.Length > 0) // { // result = NameTB.Text; // } // return result; // } //} public void Fill() { ItemIntValue none = new ItemIntValue(); none.ID = -1; none.Name = " - не вибрано - "; List <ItemIntValue> items0 = new List <ItemIntValue>(); WareCategoriesLogic categories = new WareCategoriesLogic(manager); items0.Clear(); //items0.Add(none); foreach (var a in categories.GetCategoriesHierarchy().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items0.Add(i); } CategoriesCB.DataSource = items0; CategoriesCB.ValueMember = "ID"; CategoriesCB.DisplayMember = "Name"; CategoriesCB.Update(); WareManufacturersLogic manufacturers = new WareManufacturersLogic(manager); List <ItemIntValue> items1 = new List <ItemIntValue>(); items1.Clear(); items1.Add(none); foreach (var a in manufacturers.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items1.Add(i); } //ManufacturersCB.DataSource = manufacturers.GetAll(); ManufacturersCB.DataSource = items1; ManufacturersCB.ValueMember = "ID"; ManufacturersCB.DisplayMember = "Name"; ManufacturersCB.Update(); WareUnitsLogic units = new WareUnitsLogic(manager); List <ItemIntValue> items2 = new List <ItemIntValue>(); items2.Clear(); items2.Add(none); foreach (var a in units.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items2.Add(i); } UnitsCB.DataSource = items2; UnitsCB.ValueMember = "ID"; UnitsCB.DisplayMember = "Name"; UnitsCB.Update(); }
private void FillManufacturers() { ItemIntValue none = new ItemIntValue(); none.ID = -1; none.Name = " - не вибрано - "; WareManufacturersLogic manufacturers = new WareManufacturersLogic(manager); List <ItemIntValue> items1 = new List <ItemIntValue>(); items1.Clear(); items1.Add(none); foreach (var a in manufacturers.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items1.Add(i); } ManufacturersCB.DataSource = items1; ManufacturersCB.ValueMember = "ID"; ManufacturersCB.DisplayMember = "Name"; ManufacturersCB.Update(); }