private void Add_Users(object sender, RoutedEventArgs e) { if (Validations.IsNull(roles.SelectedItem.ToString(), add_login.Text, add_mail.Text, add_pass.Password)) { return; } var settings = new ServerMetaDats() { TypeClassSend = "Users", SendMessage = true, FuncAddBd = "Add" }; var user = new Users() { UserRoleId = _roles[roles.SelectedItem.ToString()], UserLogin = add_login.Text, UserMail = add_mail.Text, UserPassword = add_pass.Password }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(user)); Reload_Users(sender, e); }
private void AddUsers_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { BG.Visibility = Visibility.Hidden; web_site.Visibility = Visibility.Hidden; grid_h.Visibility = Visibility.Hidden; CloseBtn.Visibility = Visibility.Hidden; service_add.Visibility = Visibility.Hidden; search_needy.Visibility = Visibility.Hidden; data_service.Visibility = Visibility.Hidden; stats.Visibility = Visibility.Hidden; // add_users.Visibility = Visibility.Visible; var settings = new ServerMetaDats() { TypeClassSend = "Roles", SendMessage = true, GetItem = true }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(string.Empty)); _roles = GetDict(JsonSerializer.Deserialize <List <Role> >(DataSender.Message) .Select(x => x.RoleName).ToList()); roles.ItemsSource = JsonSerializer.Deserialize <List <Role> >(DataSender.Message) .Select(x => x.RoleName); }
private void ButtonRegister_Click(object sender, RoutedEventArgs e) { var messageBox = new CustomMessgeBox(); if (Validations.ValidRegister(Login.Text, Password.Password)) { var user = new Users() { UserLogin = Login.Text, UserMail = Mail.Text, UserPassword = Password.Password, UserRoleId = 2 }; var settings = new ServerMetaDats() { TypeClassSend = "Users", SendMessage = true, FuncAddBd = "Add" }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(user)); messageBox.Title = "Вы зарегестрированы"; messageBox.Info.Text = DataSender.Message; } else { messageBox.Title = "Ошибка"; messageBox.Info.Text = "Не правильные данные"; } messageBox.ShowDialog(); }
private void Reload_Users(object sender, RoutedEventArgs e) { var settings = new ServerMetaDats() { TypeClassSend = "Users", SendMessage = true, GetItem = true, GetType = 2 }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(string.Empty)); data_roles.ItemsSource = JsonSerializer.Deserialize <List <Users> >(DataSender.Message); }
private void Send_Button_Click(object sender, RoutedEventArgs e) { if (Validations.IsNull(needy_name.Text, needy_status.Text, needy_help.Text, service_list.SelectedItem.ToString())) { return; } var settings = new ServerMetaDats() { TypeClassSend = "Needys", SendMessage = true, FuncAddBd = "Add" }; var needy = new Needys() { NeedysName = needy_name.Text, NeedysStatus = needy_status.Text, NeedysRoleId = 2, NeedysServiceId = _services[service_list.SelectedItem.ToString()], NeedysHelp = needy_help.Text }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(needy)); var settings1 = new ServerMetaDats() { TypeClassSend = "Help", SendMessage = true, FuncAddBd = "Add" }; var helpSend = new Help() { HelpServiceId = _services[service_list.SelectedItem.ToString()], HelpDate = Convert.ToDateTime(DateTime.Now.ToShortDateString()), HelpMark = "Ожидается", HelpEmployeesName = curator_list.SelectedItem.ToString(), HelpNeedyName = needy_name.Text }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings1)); DataSender.OperationDataSend(JsonSerializer.Serialize(helpSend)); }
private void Stats_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { BG.Visibility = Visibility.Hidden; data_service.Visibility = Visibility.Hidden; grid_h.Visibility = Visibility.Hidden; CloseBtn.Visibility = Visibility.Hidden; web_site.Visibility = Visibility.Hidden; search_needy.Visibility = Visibility.Hidden; add_users.Visibility = Visibility.Hidden; service_add.Visibility = Visibility.Hidden; // stats.Visibility = Visibility.Visible; RemoveChart(chart_stats.Series); var settings = new ServerMetaDats() { TypeClassSend = "Get", SendMessage = true, GetItem = true, GetType = 1 }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(string.Empty)); var dict = JsonSerializer.Deserialize <Dictionary <string, int> >(DataSender.Message); var psc = new SeriesCollection(); foreach (var keyValuePair in dict) { psc.Add(new PieSeries() { Title = keyValuePair.Key, Values = new ChartValues <int> { keyValuePair.Value } }); } foreach (PieSeries ps in psc) { chart_stats.Series.Add(ps); } }
private void Check_Needy_Btn1(object sender, RoutedEventArgs e) { datagrid_search_needy.Visibility = Visibility.Hidden; datagrid_search_needy_curator.Visibility = Visibility.Visible; f1_btn.Visibility = Visibility.Visible; f2_btn.Visibility = Visibility.Visible; var settings = new ServerMetaDats() { TypeClassSend = "Help", SendMessage = true, GetItem = true, GetType = 2 }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(_employees.EmployeesName)); datagrid_search_needy_curator.ItemsSource = JsonSerializer.Deserialize <List <Help> >(DataSender.Message); }
private void Подпись_на_услугу_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { BG.Visibility = Visibility.Hidden; data_service.Visibility = Visibility.Hidden; grid_h.Visibility = Visibility.Hidden; CloseBtn.Visibility = Visibility.Hidden; web_site.Visibility = Visibility.Hidden; search_needy.Visibility = Visibility.Hidden; add_users.Visibility = Visibility.Hidden; stats.Visibility = Visibility.Hidden; // service_add.Visibility = Visibility.Visible; var settings = new ServerMetaDats() { TypeClassSend = "Employees", SendMessage = true, GetItem = true, GetType = 1 }; var curator = string.Empty; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(curator)); GetDict(JsonSerializer.Deserialize <List <string> >(DataSender.Message)); curator_list.ItemsSource = JsonSerializer.Deserialize <List <string> >(DataSender.Message); var settings1 = new ServerMetaDats() { TypeClassSend = "Service", SendMessage = true, GetItem = true }; var services = string.Empty; DataSender.OperationDataSend(JsonSerializer.Serialize(settings1)); DataSender.OperationDataSend(JsonSerializer.Serialize(services)); _services = GetDict(JsonSerializer.Deserialize <List <Service> >(DataSender.Message) .Select(x => x.ServiceName) .ToList()); service_list.ItemsSource = JsonSerializer.Deserialize <List <Service> >(DataSender.Message). Select(x => x.ServiceName); }
private void Услуги_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { BG.Visibility = Visibility.Hidden; web_site.Visibility = Visibility.Hidden; data_service.Visibility = Visibility.Visible; grid_h.Visibility = Visibility.Hidden; CloseBtn.Visibility = Visibility.Hidden; var settings = new ServerMetaDats() { TypeClassSend = "Service", SendMessage = true, GetItem = true }; var services = string.Empty; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(services)); data_service.ItemsSource = JsonSerializer.Deserialize <List <Service> >(DataSender.Message); }
private void Out_Click(object sender, RoutedEventArgs e) { var settings = new ServerMetaDats() { TypeClassSend = "Help", UpdateItem = true, SendMessage = true, GetType = 1 }; var needy = datagrid_search_needy_curator.SelectedItem as Help; var help = new Help() { HelpNeedyName = needy.HelpNeedyName, HelpMark = "Ожидается" }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(help)); Check_Needy_Btn1(sender, e); }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { if (Validations.IsNull(needy_name.Text)) { return; } var settings = new ServerMetaDats() { TypeClassSend = "Help", SendMessage = true, GetItem = true, GetType = 1 }; var helpNeedyName = needy_name.Text; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(helpNeedyName)); data_subscribe_service.ItemsSource = JsonSerializer.Deserialize <List <Help> >(DataSender.Message); }
private void Button_Click(object sender, RoutedEventArgs e) { var settings = new ServerMetaDats() { TypeClassSend = "Users", SendMessage = true, GetItem = true, GetType = 1 }; var userSend = new Users() { UserMail = Mail.Text, UserPassword = Password.Password, }; DataSender.OperationDataSend(JsonSerializer.Serialize(settings)); DataSender.OperationDataSend(JsonSerializer.Serialize(userSend)); var userGet = JsonSerializer.Deserialize <Users>(DataSender.Message); switch (userGet?.UserRoleId) { case 1: var settings2 = new ServerMetaDats() { TypeClassSend = "Employees", SendMessage = true, GetItem = true, GetType = 2 }; var admin = string.Empty; DataSender.OperationDataSend(JsonSerializer.Serialize(settings2)); DataSender.OperationDataSend(JsonSerializer.Serialize(admin)); var adm = (JsonSerializer.Deserialize <List <Employees> >(DataSender.Message)) .First(x => x.EmployeesMail == userGet.UserMail); var adminWindow = new AdminWindow(userGet, adm); adminWindow.Show(); Close(); break; case 2: var userWindow = new UserWindow(userGet); userWindow.Show(); Close(); break; case 3: var guestWindow = new GuestWindow(); guestWindow.Show(); Close(); break; case 4: var settings1 = new ServerMetaDats() { TypeClassSend = "Employees", SendMessage = true, GetItem = true, GetType = 2 }; var curator = string.Empty; DataSender.OperationDataSend(JsonSerializer.Serialize(settings1)); DataSender.OperationDataSend(JsonSerializer.Serialize(curator)); var eml = (JsonSerializer.Deserialize <List <Employees> >(DataSender.Message)) .First(x => x.EmployeesMail == userGet.UserMail); var employeesWindow = new EmployeeWindow(userGet, eml); employeesWindow.Show(); Close(); break; } }