Exemple #1
0
        /*
         * public void ItemAdd(int ParentID)
         * {
         *  Window v = null;
         *  if (ClassName.Equals((new bank_account()).ToString()))
         *  {
         *      v = new BankAccountEditView(ParentID);
         *
         *      //(v as BankAccountEditView). = -1;
         *  }
         *  else
         *      v.ShowDialog();
         *  LoadItems();
         * }*/

        public void ItemEdit()
        {
            if (dgItems.SelectedItem == null)
            {
                MessageBox.Show("Не выбрана запись для редактирования!");
                return;
            }
            Window v = null;

            if (ClassName.Equals((new account()).ToString()))
            {
                v = new AccountsEditView();
                (v as AccountsEditView).LoadItem((dgItems.SelectedItem as account).id);
            }
            if (ClassName.Equals((new warehouse()).ToString()))
            {
                v = new WarehousesEditView();
                (v as WarehousesEditView).LoadItem((dgItems.SelectedItem as warehouse).id);
            }
            if (ClassName.Equals((new bank()).ToString()))
            {
                v = new BanksEditView();
                (v as BanksEditView).LoadItem((dgItems.SelectedItem as bank).id);
            }
            if (ClassName.Equals((new brand()).ToString()))
            {
                v = new BrandsEditView();
                (v as BrandsEditView).LoadItem((dgItems.SelectedItem as brand).id);
            }
            if (ClassName.Equals((new car_producer()).ToString()))
            {
                v = new CarProducersEditView();
                (v as CarProducersEditView).LoadItem((dgItems.SelectedItem as car_producer).id);
            }
            if (ClassName.Equals((new unit()).ToString()))
            {
                v = new UnitsEditView();
                (v as UnitsEditView).LoadItem((dgItems.SelectedItem as unit).id);
            }
            if (ClassName.Equals((new bank_account()).ToString()))
            {
                v = new BankAccountEditView();
                (v as BankAccountEditView).LoadItem((dgItems.SelectedItem as BankAccountView).id);
            }
            if (ClassName.Equals((new BankAccountView()).ToString()))
            {
                v = new BankAccountEditView();
                (v as BankAccountEditView).LoadItem((dgItems.SelectedItem as BankAccountView).id);
            }
            if (ClassName.Equals((new spare_group()).ToString()))
            {
                MessageBox.Show("Группы можно редактировать только из дерева групп!");
                return;
                //v = new SpareGroupEditView();
                //(v as SpareGroupEditView).LoadItem((dgItems.SelectedItem as spare_group).name);
            }
            v.ShowDialog();
            LoadItems();
        }
Exemple #2
0
        public void ItemAdd()
        {
            Window v = null;

            if (ClassName.Equals((new account()).ToString()))
            {
                v = new AccountsEditView();
                (v as AccountsEditView)._id = -1;
            }
            if (ClassName.Equals((new bank()).ToString()))
            {
                v = new BanksEditView();
                (v as BanksEditView)._ID = -1;
            }
            if (ClassName.Equals((new warehouse()).ToString()))
            {
                v = new WarehousesEditView();
                (v as WarehousesEditView)._id = -1;
            }
            if (ClassName.Equals((new brand()).ToString()))
            {
                v = new BrandsEditView();
                (v as BrandsEditView)._id = -1;
            }
            if (ClassName.Equals((new car_producer()).ToString()))
            {
                v = new CarProducersEditView();
                (v as CarProducersEditView)._id = -1;
            }
            if (ClassName.Equals((new unit()).ToString()))
            {
                v = new UnitsEditView();
                (v as UnitsEditView)._id = -1;
            }
            if (ClassName.Equals((new spare_group()).ToString()))
            {
                MessageBox.Show("Группы можно создавать только из дерева групп!");
                return;
                //v = new SpareGroupEditView();
                //(v as SpareGroupEditView).p = -1;
            }
            if (ClassName.Equals((new bank_account()).ToString()))
            {
                v = new BankAccountEditView(ParentItemID);

                //(v as BankAccountEditView). = -1;
            }
            if (ClassName.Equals((new BankAccountView()).ToString()))
            {
                v = new BankAccountEditView(ParentItemID);

                //(v as BankAccountEditView). = -1;
            }

            //else
            v.ShowDialog();
            LoadItems();
        }
        public void ItemAdd()
        {
            Window v = null;
            if (ClassName.Equals((new account()).ToString()))
            {
                v = new AccountsEditView();
                (v as AccountsEditView)._id = -1;
            }
            if (ClassName.Equals((new bank()).ToString()))
            {
                v = new BanksEditView();
                (v as BanksEditView)._ID = -1;
            }
            if (ClassName.Equals((new warehouse()).ToString()))
            {
                v = new WarehousesEditView();
                (v as WarehousesEditView)._id = -1;
            }
            if (ClassName.Equals((new brand()).ToString()))
            {
                v = new BrandsEditView();
                (v as BrandsEditView)._id = -1;
            }
            if (ClassName.Equals((new car_producer()).ToString()))
            {
                v = new CarProducersEditView();
                (v as CarProducersEditView)._id = -1;
            }
            if (ClassName.Equals((new unit()).ToString()))
            {
                v = new UnitsEditView();
                (v as UnitsEditView)._id = -1;
            }
            if (ClassName.Equals((new spare_group()).ToString()))
            {
                MessageBox.Show("Группы можно создавать только из дерева групп!");
                return;
                //v = new SpareGroupEditView();
                //(v as SpareGroupEditView).p = -1;
            }
            if (ClassName.Equals((new bank_account()).ToString()))
            {
                v = new BankAccountEditView(ParentItemID);

                //(v as BankAccountEditView). = -1;
            }
            if (ClassName.Equals((new BankAccountView()).ToString()))
            {
                v = new BankAccountEditView(ParentItemID);

                //(v as BankAccountEditView). = -1;
            }

            //else
            v.ShowDialog();
            LoadItems();
        }
        /*
        public void ItemAdd(int ParentID)
        {
            Window v = null;
            if (ClassName.Equals((new bank_account()).ToString()))
            {
                v = new BankAccountEditView(ParentID);

                //(v as BankAccountEditView). = -1;
            }
            else
                v.ShowDialog();
            LoadItems();
        }*/
        public void ItemEdit()
        {
            if (dgItems.SelectedItem == null)
            {
                MessageBox.Show("Не выбрана запись для редактирования!");
                return;
            }
            Window v = null;
            if (ClassName.Equals((new account()).ToString()))
            {
                v = new AccountsEditView();
                (v as AccountsEditView).LoadItem((dgItems.SelectedItem as account).id);
            }
            if (ClassName.Equals((new warehouse()).ToString()))
            {
                v = new WarehousesEditView();
                (v as WarehousesEditView).LoadItem((dgItems.SelectedItem as warehouse).id);
            }
            if (ClassName.Equals((new bank()).ToString()))
            {
                v = new BanksEditView();
                (v as BanksEditView).LoadItem((dgItems.SelectedItem as bank).id);
            }
            if (ClassName.Equals((new brand()).ToString()))
            {
                v = new BrandsEditView();
                (v as BrandsEditView).LoadItem((dgItems.SelectedItem as brand).id);
            }
            if (ClassName.Equals((new car_producer()).ToString()))
            {
                v = new CarProducersEditView();
                (v as CarProducersEditView).LoadItem((dgItems.SelectedItem as car_producer).id);
            }
            if (ClassName.Equals((new unit()).ToString()))
            {
                v = new UnitsEditView();
                (v as UnitsEditView).LoadItem((dgItems.SelectedItem as unit).id);
            }
            if (ClassName.Equals((new bank_account()).ToString()))
            {
                v = new BankAccountEditView();
                (v as BankAccountEditView).LoadItem((dgItems.SelectedItem as BankAccountView).id);
            }
            if (ClassName.Equals((new BankAccountView()).ToString()))
            {
                v = new BankAccountEditView();
                (v as BankAccountEditView).LoadItem((dgItems.SelectedItem as BankAccountView).id);
            }
            if (ClassName.Equals((new spare_group()).ToString()))
            {
                MessageBox.Show("Группы можно редактировать только из дерева групп!");
                return;
                //v = new SpareGroupEditView();
                //(v as SpareGroupEditView).LoadItem((dgItems.SelectedItem as spare_group).name);
            }
            v.ShowDialog();
            LoadItems();
        }