Example #1
0
 private void UpdateListBox()
 {
     chekGoodsListBox.Items.Clear();
     var selectedCategory = chekCategoryComboBox.SelectedItem as ListBoxItem;
     var goods = db.Categories.Find(selectedCategory.Id).GoodsItems.ToList();
     foreach (var goodsItem in goods)
     {
         var item = new ComplexListBoxItem(goodsItem.Id, goodsItem.Name, goodsItem.UnitOfMeasure.ShortName);
         chekGoodsListBox.Items.Add(item);
     }
 }
Example #2
0
 private void UpdateListBox()
 {
     goodsItemListBox.Items.Clear();
     using (var db = new Model.BudgetModel())
     {
         var selectedCategory = goodsItemComboBox.SelectedItem as ListBoxItem;
         if (selectedCategory == null) return;
         var goods = db.Categories.Find(selectedCategory.Id).GoodsItems.ToList();
         foreach (var goodsItem in goods)
         {
             var item = new ComplexListBoxItem(goodsItem.Id, goodsItem.Name, goodsItem.UnitOfMeasure.ShortName);
             goodsItemListBox.Items.Add(item);
         }
     }
 }  
Example #3
0
 private void FillForm()
 {
     using (var db = new Model.BudgetModel())
     {
         var categories = db.Categories.ToList();
         foreach (var category in categories)
         {
             var item = new ListBoxItem(category.Id, category.Name);
             addGoodsCategoryComboBox.Items.Add(item);
         }
         var unitOfMeasures = db.UnitOfMeasures.ToList();
         foreach (var unitOfMeasure in unitOfMeasures)
         {
             var item = new ComplexListBoxItem(unitOfMeasure.Id, unitOfMeasure.Name, unitOfMeasure.ShortName);
             addGoodsUnitOfMeasureComboBox.Items.Add(item);
         }
     }
 }
Example #4
0
 private void UpdateListBox()
 {
     unitOfMeasureListBox.Items.Clear();
     using (var db = new Model.BudgetModel())
     {
         var unitOfMeasures = db.UnitOfMeasures.ToList();
         foreach (var unitOfMeasure in unitOfMeasures)
         {
             var item = new ComplexListBoxItem(unitOfMeasure.Id, unitOfMeasure.Name, unitOfMeasure.ShortName);
             unitOfMeasureListBox.Items.Add(item);
         }
     }
 }
Example #5
0
 private void AddGoodsUnitOfMeasureComboBoxSelectedIndexChanged(object sender, EventArgs e) => 
     SelectedUnitOfMeasure = addGoodsUnitOfMeasureComboBox.SelectedItem as ComplexListBoxItem;