Beispiel #1
0
        public override void Execute(object parameter)
        {
            SureDialogViewModel sureViewModel = new SureDialogViewModel();

            sureViewModel.DialogText = UIMessages.DeleteSureMessage;

            SureDialog dialog = new SureDialog();

            dialog.DataContext = sureViewModel;
            dialog.ShowDialog();

            if (dialog.DialogResult == true)
            {
                SubjectMapper mapper = new SubjectMapper();

                Subject subject = mapper.Map(viewModel.CurrentSubject);
                subject.IsDeleted = true;
                subject.Creator   = Kernel.CurrentUser;

                DB.SubjectRepository.Update(subject);

                int no = viewModel.SelectedSubject.No;

                viewModel.CurrentSituation = (int)Situation.NORMAL;
                viewModel.Subjects.Remove(viewModel.SelectedSubject);

                List <SubjectModel> modelList = viewModel.Subjects.ToList();
                EnumerationUtil.Enumerate(modelList, no - 1);
                viewModel.AllSubjects = modelList;
                viewModel.UpdateDataFiltered();

                viewModel.SelectedSubject = null;
                viewModel.CurrentSubject  = new SubjectModel();
            }
        }
    /// <summary>
    /// Выдать пользователю диалоговое окно 'Уверены, что хотите выйти?'. Выходит при подтверждении.
    /// </summary>
    public static void SureQuit()
    {
        var dialog = new SureDialog("Уверены, что хотите выйти?");

        dialog.ShowDialog();
        if (dialog.result == SureDialog.Result.Yes)
        {
            Quit();
        }
    }
        public override void Execute(object parameter)
        {
            SureDialogViewModel sureViewModel = new SureDialogViewModel
            {
                DialogText = UIMessages.DeleteSureMessage
            };

            SureDialog dialog = new SureDialog
            {
                DataContext = sureViewModel
            };

            dialog.ShowDialog();
            if (dialog.DialogResult == true)
            {
                EmployeeMapper mapper = new EmployeeMapper();

                Employee employee = mapper.Map(employeeViewModel.CurrentEmployee);
                employee.IsDeleted = true;
                employee.Creator   = Kernel.CurrentUser;

                DB.EmployeeRepository.Update(employee);

                int no = employeeViewModel.SelectedEmployee.No;

                employeeViewModel.Employees.Remove(employeeViewModel.SelectedEmployee);

                List <EmployeeModel> employeeModelList = employeeViewModel.Employees.ToList();
                Enumeration.Enumerate(employeeModelList, no - 1);

                employeeViewModel.AllEmployees = employeeModelList;
                employeeViewModel.UpdateDataFiltered();

                employeeViewModel.SelectedEmployee = null;
                employeeViewModel.CurrentEmployee  = new EmployeeModel();

                MessageBox.Show(UIMessages.OperationSuccessMessage, "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Beispiel #4
0
        public override void Execute(object parameter)
        {
            SureDialogViewModel sureViewModel = new SureDialogViewModel
            {
                DialogText = UIMessages.DeleteSureMessage
            };

            SureDialog dialog = new SureDialog();

            dialog.DataContext = sureViewModel;
            dialog.ShowDialog();
            if (dialog.DialogResult == true)
            {
                CustomerMapper mapper = new CustomerMapper();

                Customer customer = mapper.Map(customerViewModel.CurrentCustomer);
                customer.IsDeleted = true;
                customer.Creator   = Kernel.CurrentUser;

                DB.CustomerRepository.Update(customer);

                int no = customerViewModel.SelectedCustomer.No;


                customerViewModel.Customers.Remove(customerViewModel.SelectedCustomer);

                List <CustomerModel> modelList = customerViewModel.Customers.ToList();
                Enumeration.Enumerate(modelList, no - 1);

                customerViewModel.AllCustomers = modelList;
                customerViewModel.UpdateDataFiltered();

                customerViewModel.SelectedCustomer = null;
                customerViewModel.CurrentCustomer  = new CustomerModel();

                MessageBox.Show(UIMessages.OperationSuccessMessage, "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Beispiel #5
0
        public override void Execute(object parameter)
        {
            SureDialogViewModel sureDialogViewModel = new SureDialogViewModel();

            sureDialogViewModel.DialogText = UIMessages.DeleteSureMessage;

            SureDialog sureDialog = new SureDialog();

            sureDialog.DataContext = sureDialogViewModel;
            sureDialog.ShowDialog();

            if (sureDialog.DialogResult == true)
            {
                QuestionMapper questionMapper = new QuestionMapper();

                Question question = questionMapper.Map(viewModel.CurrentQuestion);
                question.IsDeleted = true;
                question.Creator   = Kernel.CurrentUser;

                DB.QuestionRepository.Update(question);

                int no = viewModel.SelectedQuestion.No;

                viewModel.CurrentSituation = (int)Situation.NORMAL;
                viewModel.Questions.Remove(viewModel.SelectedQuestion);

                List <QuestionModel> modelList = viewModel.Questions.ToList();

                EnumerationUtil.Enumerate(modelList, no - 1);
                viewModel.AllQuestions = modelList;

                viewModel.UpdateDataFiltered();

                viewModel.SelectedQuestion = null;
                viewModel.CurrentQuestion  = new QuestionModel();
            }
        }
Beispiel #6
0
        public override void Execute(object parameter)
        {
            SureDialogViewModel sureViewModel = new SureDialogViewModel();

            sureViewModel.DialogText = UIMessages.DeleteSureMessage;

            SureDialog dialog = new SureDialog();

            dialog.DataContext = sureViewModel;
            dialog.ShowDialog();
            if (dialog.DialogResult == true)
            {
                ProductMapper mapper = new ProductMapper();

                Product product = mapper.Map(productViewModel.CurrentProduct);
                product.IsDeleted = true;
                product.Creator   = Kernel.CurrentUser;

                DB.ProductRepository.Update(product);

                int no = productViewModel.SelectedProduct.No;

                productViewModel.Products.Remove(productViewModel.SelectedProduct);

                List <ProductModel> productModelList = productViewModel.Products.ToList();
                Enumeration.Enumerate(productModelList, no - 1);

                productViewModel.AllProducts = productModelList;
                productViewModel.UpdateDataFiltered();

                productViewModel.SelectedProduct = null;
                productViewModel.CurrentProduct  = new ProductModel();

                MessageBox.Show(UIMessages.OperationSuccessMessage, "Information", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }