public void Update() { var services = WildberriesEntities1.GetContext().Services.ToList(); switch (SortCategory.SelectedIndex) { case 5: services = services.ToList(); break; case 0: services = services.Where(p => Convert.ToString(p.IdCategory).Contains("1")).ToList(); break; case 1: services = services.Where(p => Convert.ToString(p.IdCategory).Contains("2")).ToList(); break; case 2: services = services.Where(p => Convert.ToString(p.IdCategory).Contains("3")).ToList(); break; case 3: services = services.Where(p => Convert.ToString(p.IdCategory).Contains("4")).ToList(); break; case 4: services = services.Where(p => Convert.ToString(p.IdCategory).Contains("5")).ToList(); break; } ListClient.ItemsSource = services; }
private void BtnAddClient_Click(object sender, RoutedEventArgs e) { if (_ccurrnetClients.Id == 0) { WildberriesEntities1.GetContext().Custumers.Add(_ccurrnetClients); } try { WildberriesEntities1.GetContext().SaveChanges(); MessageBox.Show("Поставщик успешно сохранен"); NavManager.AccountFrame.Navigate(new PageCustumers()); } catch (DbEntityValidationException ex) { if (ApplicationConfig.IsDev) { foreach (var errors in ex.EntityValidationErrors) { foreach (var validationError in errors.ValidationErrors) { MessageBox.Show(validationError.ErrorMessage); } } } else { MessageBox.Show("Произошла ошибка", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
public PageServices(string header) { InitializeComponent(); ListClient.ItemsSource = WildberriesEntities1.GetContext().Services.ToList(); Header.Text = header; SortCategory.ItemsSource = WildberriesEntities1.GetContext().Categoris.ToList(); }
private void BtndelService_Click(object sender, RoutedEventArgs e) { Clients currentService = (sender as Button).DataContext as Clients; if (MessageBox.Show("Вы действительно хотите удалить клиента " + currentService.Fullname + "?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { WildberriesEntities1.GetContext().Clients.Remove(currentService); WildberriesEntities1.GetContext().SaveChanges(); NavManager.AccountFrame.Navigate(new PageClients(NavManager.BtClients.Content + "")); } }
private void BtndelService_Click_1(object sender, RoutedEventArgs e) { Categoris currentService = (sender as Button).DataContext as Categoris; if (MessageBox.Show("Вы действительно хотите удалить категорию " + currentService.Name + "?", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { WildberriesEntities1.GetContext().Categoris.Remove(currentService); WildberriesEntities1.GetContext().SaveChanges(); NavManager.AccountFrame.Navigate(new PageCategorys()); } }
public PageAddEditService(Services selectService) { InitializeComponent(); if (selectService != null) { _ccurrnetServices = selectService; CBoxServices.SelectedItem = selectService.Categoris; CBoxCustumers.SelectedItem = selectService.Custumers; } DataContext = _ccurrnetServices; CBoxServices.ItemsSource = WildberriesEntities1.GetContext().Categoris.ToList(); CBoxCustumers.ItemsSource = WildberriesEntities1.GetContext().Custumers.ToList(); }
public PageAddEditClientService(ClientService selectClientService) { InitializeComponent(); if (selectClientService != null) { _ccurrnetClientService = selectClientService; CBoxServices.SelectedItem = selectClientService.Services; CBoxClients.SelectedItem = selectClientService.Clients; } DataContext = _ccurrnetClientService; CBoxServices.ItemsSource = WildberriesEntities1.GetContext().Services.ToList(); CBoxClients.ItemsSource = WildberriesEntities1.GetContext().Clients.ToList(); }
public PageReports(string header) { InitializeComponent(); Header.Text = header; ChatPayments.ChartAreas.Add(new System.Windows.Forms.DataVisualization.Charting.ChartArea()); ChatPayments.Series.Add("Прибыль"); // Add this line var payments = WildberriesEntities1.GetContext().ClientService.ToList(); foreach (var r in payments) { ChatPayments.Series["Прибыль"].Points.AddXY(r.Date, r.Services.Cost); } ChatPayments.DataBind(); }
private void BtnAddservice_Click(object sender, RoutedEventArgs e) { if (_ccurrnetServices.Cost <= 0) { MessageBox.Show("Цена должна быть больше 0"); return; } Categoris p = (Categoris)CBoxServices.SelectedItem; _ccurrnetServices.IdCategory = p.Id; Custumers o = (Custumers)CBoxCustumers.SelectedItem; _ccurrnetServices.IdCustumer = p.Id; if (_ccurrnetServices.Id == 0) { WildberriesEntities1.GetContext().Services.Add(_ccurrnetServices); } try { WildberriesEntities1.GetContext().SaveChanges(); MessageBox.Show("Услуга успешно сохранена"); NavManager.AccountFrame.Navigate(new PageServices(NavManager.BtnServices.Content + "")); } catch (DbEntityValidationException ex) { if (ApplicationConfig.IsDev) { foreach (var errors in ex.EntityValidationErrors) { foreach (var validationError in errors.ValidationErrors) { MessageBox.Show(validationError.ErrorMessage); } } } else { MessageBox.Show("Произошла ошибка", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
private void BtnAddservice_Click(object sender, RoutedEventArgs e) { Services p = (Services)CBoxServices.SelectedItem; Clients o = (Clients)CBoxClients.SelectedItem; _ccurrnetClientService.IdService = p.Id; _ccurrnetClientService.IdClient = o.Id; if (_ccurrnetClientService.Id == 0) { WildberriesEntities1.GetContext().ClientService.Add(_ccurrnetClientService); } try { WildberriesEntities1.GetContext().SaveChanges(); MessageBox.Show("Продажа успешно сохранена"); NavManager.AccountFrame.Navigate(new PageClientService(NavManager.BtnClientService.Content + "")); } catch (DbEntityValidationException ex) { if (ApplicationConfig.IsDev) { foreach (var errors in ex.EntityValidationErrors) { foreach (var validationError in errors.ValidationErrors) { MessageBox.Show(validationError.ErrorMessage); } } } else { MessageBox.Show("Произошла ошибка", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
public PageClients(string header) { InitializeComponent(); Header.Text = header; DGridClients.ItemsSource = WildberriesEntities1.GetContext().Clients.ToList(); }
public PageCategorys() { InitializeComponent(); Header.Text = "Категории"; DGridClients.ItemsSource = WildberriesEntities1.GetContext().Categoris.ToList(); }
private void BtnSignInAdmin_Click(object sender, RoutedEventArgs e) { var user = WildberriesEntities1.GetContext().Admins.ToList(); if (ApplicationConfig.IsDev) { user = user.Where(p => p.Login.ToLower().Contains("director".ToLower())).ToList(); user = user.Where(p => p.Password.ToLower().Contains("1234".ToLower())).ToList(); } else { StringBuilder erros = new StringBuilder(); if (String.IsNullOrEmpty(Login.Text)) { erros.AppendLine("Введите логин"); } else if (String.IsNullOrEmpty(Password.Password)) { erros.AppendLine("Введите пароль"); } if (erros.Length > 0) { MessageBox.Show(erros.ToString()); return; } user = user.Where(p => p.Login.ToLower().Contains(Login.Text.ToLower())).ToList(); user = user.Where(p => p.Password.ToLower().Contains(Password.Password.ToLower())).ToList(); } Admins searchuser = user.FirstOrDefault(); if (searchuser == null) { MessageBox.Show("Наверный логин или пароль", "внимание", MessageBoxButton.OK, MessageBoxImage.Warning); return; } CurrentUser.PermissionName = searchuser.Permissions.Name; if (searchuser.Permissions.AccessClients == 1) { CurrentUser.AccessClients = true; } else { CurrentUser.AccessClients = false; } if (searchuser.Permissions.AccessServices == 1) { CurrentUser.AccessServices = true; } else { CurrentUser.AccessServices = false; } if (searchuser.Permissions.AccessClientService == 1) { CurrentUser.AccessClientsServicrs = true; } else { CurrentUser.AccessClientsServicrs = false; } if (searchuser.Permissions.AccessReports == 1) { CurrentUser.AccessReport = true; } else { CurrentUser.AccessReport = false; } NavManager.MainFrame.Navigate(new Account()); }