12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Media.Media3D;
- using System.Windows.Shapes;
- using wpf_connection3.model;
- namespace wpf_connection3.Windows
- {
- public partial class EditingMaterialWindow : Window
- {
- public List<model.Material> MaterialList { get; set; }
- public int ID { get; set; }
- public EditingMaterialWindow(int currentProductID)
- {
- InitializeComponent();
- ID = currentProductID;
- DataContext = this;
- MaterialList = Globals.dataProvider.getMaterials();
- }
- private void SaveButton_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var material = new ProductMaterial();
- material.ProductId = ID;
- material.Count = Convert.ToInt32(CountTextBox.Text);
- material.MaterialId = (MaterialTypeComboBox.SelectedItem as model.Material).ID;
- Globals.dataProvider.addProductMaterial(material);
- DialogResult = true;
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- }
|