public override void Execute(object parameter) { List <Category> categories = DB.CategoryRepository.Get(); List <CategoryModel> categoryModels = new List <CategoryModel>(); CategoryMapper categoryMapper = new CategoryMapper(); for (int i = 0; i < categories.Count; i++) { Category category = categories[i]; CategoryModel categoryModel = categoryMapper.Map(category); categoryModel.No = i + 1; categoryModels.Add(categoryModel); } Enumeration.Enumerate(categoryModels); CategoryViewModel categoryViewModel = new CategoryViewModel(); categoryViewModel.AllCategories = categoryModels; categoryViewModel.Categories = new ObservableCollection <CategoryModel>(categoryModels); CategoriesControl categoriesControl = new CategoriesControl(); categoriesControl.DataContext = categoryViewModel; MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(categoriesControl); }
public override void Execute(object parameter) { List <Order> orders = DB.OrderRepository.Get(); List <OrderModel> orderModels = new List <OrderModel>(); OrderMapper orderMapper = new OrderMapper(); for (int i = 0; i < orders.Count; i++) { Order order = orders[i]; OrderModel orderModel = orderMapper.Map(order); orderModel.No = i + 1; orderModels.Add(orderModel); } Enumeration.Enumerate(orderModels); OrderViewModel orderViewModel = new OrderViewModel(); orderViewModel.AllOrders = orderModels; orderViewModel.Orders = new ObservableCollection <OrderModel>(orderModels); OrdersControl ordersControl = new OrdersControl(); ordersControl.DataContext = orderViewModel; MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(ordersControl); }
public override void Execute(object parameter) { List <Customer> customers = DB.CustomerRepository.Get(); List <CustomerModel> customerModels = new List <CustomerModel>(); CustomerMapper customerMapper = new CustomerMapper(); for (int i = 0; i < customers.Count; i++) { Customer customer = customers[i]; CustomerModel customerModel = customerMapper.Map(customer); customerModel.No = i + 1; customerModels.Add(customerModel); } Enumeration.Enumerate(customerModels); CustomerViewModel customerViewModel = new CustomerViewModel(); customerViewModel.AllCustomers = customerModels; customerViewModel.Customers = new ObservableCollection <CustomerModel>(customerModels); CustomersControl customersControl = new CustomersControl(); customersControl.DataContext = customerViewModel; MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(customersControl); }
public override void Execute(object parameter) { List <Employee> employees = DB.EmployeeRepository.Get(); List <EmployeeModel> employeeModels = new List <EmployeeModel>(); EmployeeMapper employeeMapper = new EmployeeMapper(); for (int i = 0; i < employees.Count; i++) { Employee employee = employees[i]; EmployeeModel employeeModel = employeeMapper.Map(employee); employeeModel.No = i + 1; employeeModels.Add(employeeModel); } Enumeration.Enumerate(employeeModels); EmployeeViewModel employeeViewModel = new EmployeeViewModel(); employeeViewModel.AllEmployees = employeeModels; employeeViewModel.Employees = new ObservableCollection <EmployeeModel>(employeeModels); EmployeesControl employeesControl = new EmployeesControl(); employeesControl.DataContext = employeeViewModel; MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(employeesControl); }
public override void Execute(object parameter) { List <Customer> customers = DB.CustomerRepository.Get(); List <CustomerModel> customerModels = new List <CustomerModel>(); CustomerMapper customerMapper = new CustomerMapper(); for (int i = 0; i < customers.Count; i++) { Customer customer = customers[i]; CustomerModel customerModel = customerMapper.Map(customer); customerModels.Add(customerModel); } OrderAddWindow orderAddWindow = new OrderAddWindow(); OrderAddViewModel orderAddViewModel = new OrderAddViewModel { CurrentOrder = orderViewModel.CurrentOrder, CurrentWindow = orderAddWindow, Customers = customerModels }; orderAddWindow.DataContext = orderAddViewModel; orderAddWindow.WindowStyle = System.Windows.WindowStyle.None; orderAddWindow.AllowsTransparency = true; orderAddWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; orderAddWindow.ShowDialog(); List <Order> orders = DB.OrderRepository.Get(); List <OrderModel> orderModels = new List <OrderModel>(); OrderMapper orderMapper = new OrderMapper(); for (int i = 0; i < orders.Count; i++) { Order order = orders[i]; OrderModel orderModel = orderMapper.Map(order); orderModels.Add(orderModel); } Enumeration.Enumerate(orderModels); orderViewModel.AllOrders = orderModels; orderViewModel.Orders = new ObservableCollection <OrderModel>(orderModels); orderViewModel.CurrentOrder = new OrderModel(); }
public IActionResult Index() { ViewBag.Message = TempData["Message"]; List <Employee> employees = DB.EmployeeRepository.Get(); ViewModel <EmployeeModel> viewModel = new ViewModel <EmployeeModel>(); EmployeeMapper employeeMapper = new EmployeeMapper(); foreach (var employee in employees) { var employeeModel = employeeMapper.Map(employee); viewModel.Models.Add(employeeModel); } Enumeration <EmployeeModel> .Enumerate(viewModel.Models); return(View(viewModel)); }
public IActionResult Index() { ViewBag.Message = TempData["Message"]; List <Customer> customers = DB.CustomerRepository.Get(); ViewModel <CustomerModel> viewModel = new ViewModel <CustomerModel>(); CustomerMapper customerMapper = new CustomerMapper(); foreach (var customer in customers) { var customerModel = customerMapper.Map(customer); viewModel.Models.Add(customerModel); } Enumeration <CustomerModel> .Enumerate(viewModel.Models); return(View(viewModel)); }
public IActionResult Index() { ViewBag.Message = TempData["Message"]; List <Product> products = DB.ProductRepository.Get(); ViewModel <ProductModel> viewModel = new ViewModel <ProductModel>(); ProductMapper productMapper = new ProductMapper(); foreach (var product in products) { var productModel = productMapper.Map(product); viewModel.Models.Add(productModel); } Enumeration <ProductModel> .Enumerate(viewModel.Models); return(View(viewModel)); }
public IActionResult Index() { ViewBag.Message = TempData["Message"]; List <Category> categories = DB.CategoryRepository.Get(); ViewModel <CategoryModel> viewModel = new ViewModel <CategoryModel>(); CategoryMapper categoryMapper = new CategoryMapper(); foreach (var category in categories) { var categoryModel = categoryMapper.Map(category); viewModel.Models.Add(categoryModel); } Enumeration <CategoryModel> .Enumerate(viewModel.Models); return(View(viewModel)); }
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); } }
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); } }
public override void Execute(object parameter) { List <Product> products = DB.ProductRepository.Get(); List <ProductModel> productModels = new List <ProductModel>(); ProductMapper productMapper = new ProductMapper(); for (int i = 0; i < products.Count; i++) { Product product = products[i]; ProductModel productModel = productMapper.Map(product); productModels.Add(productModel); } Enumeration.Enumerate(productModels); ProductViewModel productViewModel = new ProductViewModel { AllProducts = productModels, Products = new ObservableCollection <ProductModel>(productModels) }; ProductsControl productsControl = new ProductsControl { DataContext = productViewModel }; MainWindow mainWindow = (MainWindow)mainViewModel.Window; mainWindow.GrdCenter.Children.Clear(); mainWindow.GrdCenter.Children.Add(productsControl); if (productViewModel.CurrentProduct.Name != null) { productViewModel.DeleteVisibility = Visibility.Visible; } }
public override void Execute(object parameter) { EmployeeAddWindow employeeAddWindow = new EmployeeAddWindow(); EmployeeAddViewModel employeeAddViewModel = new EmployeeAddViewModel { CurrentEmployee = employeeViewModel.CurrentEmployee, CurrentWindow = employeeAddWindow }; employeeAddWindow.DataContext = employeeAddViewModel; employeeAddWindow.WindowStyle = System.Windows.WindowStyle.None; employeeAddWindow.AllowsTransparency = true; employeeAddWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; employeeAddWindow.ShowDialog(); List <Employee> employees = DB.EmployeeRepository.Get(); List <EmployeeModel> employeeModels = new List <EmployeeModel>(); EmployeeMapper employeeMapper = new EmployeeMapper(); for (int i = 0; i < employees.Count; i++) { Employee employee = employees[i]; EmployeeModel employeeModel = employeeMapper.Map(employee); employeeModels.Add(employeeModel); } Enumeration.Enumerate(employeeModels); employeeViewModel.AllEmployees = employeeModels; employeeViewModel.Employees = new ObservableCollection <EmployeeModel>(employeeModels); employeeViewModel.CurrentEmployee = new EmployeeModel(); }
public override void Execute(object parameter) { CustomerAddWindow customerAddWindow = new CustomerAddWindow(); CustomerAddViewModel customerAddViewModel = new CustomerAddViewModel(); customerAddViewModel.CurrentCustomer = customerViewModel.CurrentCustomer; customerAddViewModel.CurrentWindow = customerAddWindow; customerAddWindow.DataContext = customerAddViewModel; customerAddWindow.WindowStyle = System.Windows.WindowStyle.None; customerAddWindow.AllowsTransparency = true; customerAddWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; customerAddWindow.ShowDialog(); // Refresh Customers list List <Customer> customers = DB.CustomerRepository.Get(); List <CustomerModel> customerModels = new List <CustomerModel>(); CustomerMapper customerMapper = new CustomerMapper(); for (int i = 0; i < customers.Count; i++) { Customer customer = customers[i]; CustomerModel customerModel = customerMapper.Map(customer); customerModels.Add(customerModel); } Enumeration.Enumerate(customerModels); customerViewModel.AllCustomers = customerModels; customerViewModel.Customers = new ObservableCollection <CustomerModel>(customerModels); customerViewModel.CurrentCustomer = new CustomerModel(); }
public override void Execute(object parameter) { CategoryAddWindow categoryAddWindow = new CategoryAddWindow(); CategoryAddViewModel categoryAddViewModel = new CategoryAddViewModel { CurrentCategory = categoryViewModel.CurrentCategory, CurrentWindow = categoryAddWindow }; categoryAddWindow.DataContext = categoryAddViewModel; categoryAddWindow.WindowStyle = System.Windows.WindowStyle.None; categoryAddWindow.AllowsTransparency = true; categoryAddWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; categoryAddWindow.ShowDialog(); List <Category> categories = DB.CategoryRepository.Get(); List <CategoryModel> categoryModels = new List <CategoryModel>(); CategoryMapper categoryMapper = new CategoryMapper(); for (int i = 0; i < categories.Count; i++) { Category category = categories[i]; CategoryModel categoryModel = categoryMapper.Map(category); categoryModels.Add(categoryModel); } Enumeration.Enumerate(categoryModels); categoryViewModel.AllCategories = categoryModels; categoryViewModel.Categories = new ObservableCollection <CategoryModel>(categoryModels); categoryViewModel.CurrentCategory = new CategoryModel(); }
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); } }
public override void Execute(object parameter) { //OrderAddViewModel addViewModel = new OrderAddViewModel(); //OrderAddWindow addWindow = new OrderAddWindow(); //addViewModel.DetailPanel = addWindow.DetailPanel; //addViewModel.DetailPanel.Children.Add(new SingleOrderDetailControl()); //addWindow.DataContext = addViewModel; //addWindow.ShowDialog(); //return; ProductAddWindow productAddWindow = new ProductAddWindow(); ProductAddViewModel productAddViewModel = new ProductAddViewModel { CurrentProduct = productViewModel.CurrentProduct, CurrentWindow = productAddWindow }; #region Category-for Combobox List <Category> categories = DB.CategoryRepository.Get(); List <CategoryModel> categoryModels = new List <CategoryModel>(); CategoryMapper categoryMapper = new CategoryMapper(); for (int i = 0; i < categories.Count; i++) { Category category = categories[i]; CategoryModel categoryModel = categoryMapper.Map(category); categoryModels.Add(categoryModel); } productAddViewModel.Categories = categoryModels; #endregion productAddWindow.DataContext = productAddViewModel; productAddWindow.WindowStyle = System.Windows.WindowStyle.None; productAddWindow.AllowsTransparency = true; productAddWindow.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; productAddWindow.ShowDialog(); // Refresh products list List <Product> products = DB.ProductRepository.Get(); List <ProductModel> productModels = new List <ProductModel>(); ProductMapper productMapper = new ProductMapper(); for (int i = 0; i < products.Count; i++) { Product product = products[i]; ProductModel productModel = productMapper.Map(product); productModels.Add(productModel); } Enumeration.Enumerate(productModels); productViewModel.AllProducts = productModels; productViewModel.Products = new ObservableCollection <ProductModel>(productModels); productViewModel.CurrentProduct = new ProductModel(); }