Ejemplo n.º 1
0
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (ComboBoxIngredient.SelectedIndex < 0 ||
                TextBoxTotal.Text == "0" ||
                string.IsNullOrEmpty(TextBoxTotal.Text))
            {
                WindownsManager.getInstance().showMessageBoxSomeThingWrong();
                return;
            }
            decimal quantity = 0;

            decimal.TryParse(TextBoxQuantity.Text, out quantity);

            decimal price = 0;

            decimal.TryParse(TextBoxPrice.Text, out price);

            var ingredientId = (int)((ComboBoxItem)ComboBoxIngredient.SelectedItem).Tag;

            var importIngredientWithBill = new IngredientWithImportBill();

            importIngredientWithBill.IngredientId       = ingredientId;
            importIngredientWithBill.Ingredient         = IngredientManager.getInstance().IngredientList[ingredientId];
            importIngredientWithBill.Quantities         = (float)quantity;
            importIngredientWithBill.SinglePricePerUnit = price;

            LVIngredient.Items.Add(new ImportIngredientCell(importIngredientWithBill, this));
            reloadTotalBill();
        }
 public ImportIngredientCell(IngredientWithImportBill ingredientWithImportBill, ImportTab importTab = null)
 {
     InitializeComponent();
     _ingredientWithImportBill = ingredientWithImportBill;
     _importTab = importTab;
     reloadUI();
 }