コード例 #1
0
        private void OnClickCreate(object sender, RoutedEventArgs e)
        {
            var repository = new AssortmentRepository();

            try
            {
                var item = new Item
                {
                    Code          = Convert.ToInt32(code.Text),
                    Tekla         = tekla.Text,
                    IdProfileType = Convert.ToInt32(idProfileType.Text),
                    Profile       = profile.Text,
                    IsShortA      = Convert.ToBoolean(isShortA.Text),
                    Price         = Convert.ToInt32(price.Text),
                    DefaultLength = defaultLength.Text,
                    DefaultWidth  = defaultWidth.Text,
                    BigCode       = bigCode.Text,
                    Standard      = standard.Text,
                    Weight        = Convert.ToDouble(weight.Text)
                };
                repository.Create(item);
            }
            catch (Exception)
            {
                MessageBox.Show("Data is incorrect");
            }
            finally
            {
                assortmentGrid.ItemsSource = repository.GetAll();
            }
        }
コード例 #2
0
        private void OnClickDelete(object sender, RoutedEventArgs e)
        {
            var repository = new AssortmentRepository();
            var item       = (Item)assortmentGrid.SelectedItem;

            repository.Delete(item.Id);
            assortmentGrid.ItemsSource = repository.GetAll();
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();

            var repository = new AssortmentRepository();

            assortmentGrid.ItemsSource = repository.GetAll();
        }
コード例 #4
0
        private void OnClickRefresh(object sender, RoutedEventArgs e)
        {
            var repository = new AssortmentRepository();

            assortmentGrid.ItemsSource = repository.GetAll();
        }