예제 #1
0
        private void Add()
        {
            wAddContract add = new wAddContract(ref context);

            if (add.ShowDialog() == true)
            {
                TContract contract;
                contract = add.contract;

                context.TContract.Add(contract);
                context.SaveChanges();

                MessageBox.Show("Новый 'договор' добавлен");

                Filter();
                MessageBox.Show("Обьект добавлен");
            }
        }
예제 #2
0
        private void Update()
        {
            var item = (TContract)dgdContract.SelectedItem as TContract;

            if (item == null)
            {
                MessageBox.Show("Сперва выберите элемент из списка");
                return;
            }

            wAddContract update = new wAddContract(false, ref context);

            update.contract = item;
            if (update.ShowDialog() == true)
            {
                context.SaveChanges();
                Filter();
            }
        }