/// <summary> /// Очистка полей ввода /// </summary> private void ClearText() { NameText.Clear(); SurnameText.Clear(); PosText.Clear(); BirthdayText.Clear(); DepComboEdit.SelectedIndex = -1; }
private void AddProject_Click(object sender, RoutedEventArgs e) { try { if (AllPrListBox.SelectedItem.ToString() != NameText.Text) { Customer customer = null; lc.Cust = new List <Customer>(); lc = Serialization.Deserialze(lc); foreach (var item in lc.Cust) { if (CustomerComboBox.SelectedItem.ToString() == item.Name) { customer = item; } } Project proj = new Project(NameText.Text, Description.Text, ManagerComboBox.Text, customer, int.Parse(People.Text), int.Parse(Money.Text), Date.Text); lp.Proj.Add(proj); Log.logging("Добавлен проект: " + proj.Name + " " + DateTime.Now); Serialization.Serialize_proj(lp); lp = Serialization.Deserialze_proj(lp); MessageBox.Show("Сохранено!"); AllPrListBox.Items.Clear(); foreach (var item in lp.Proj) { AllPrListBox.Items.Add(item.Name); } } else { MessageBox.Show("Такой проект уже существует"); } AllPrListBox.SelectedItem = -1; NameText.Clear(); Description.Clear(); ManagerComboBox.SelectedIndex = -1; CustomerComboBox.SelectedIndex = -1; People.Clear(); Money.Clear(); Date.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message); Log.logging("Ошибка: " + ex); } }
private void ClearForm() { UserNameText.Clear(); EmailText.Clear(); NameText.Clear(); PasswordText.Clear(); ChangePasswordChk.Checked = false; ActiveChk.Checked = false; }
private void Clear_Click(object sender, RoutedEventArgs e) { NameText.Clear(); Description.Clear(); ManagerComboBox.SelectedIndex = -1; CustomerComboBox.SelectedIndex = -1; People.Clear(); Money.Clear(); Date.Clear(); }
private void EditClientForm_FormClosing(object sender, FormClosingEventArgs e) { NameText.Clear(); PhoneText.Clear(); EmailText.Clear(); INNText.Clear(); ScoreText.Clear(); AddressText.Clear(); bsToShow = null; }
private void button1_Click(object sender, EventArgs e) { NameText.Clear(); PhoneText.Clear(); EmailText.Clear(); INNText.Clear(); ScoreText.Clear(); AddressText.Clear(); Close(); }
private void DeleteProject_Click(object sender, RoutedEventArgs e) { try { foreach (Project pr in lp.Proj) { if (AllPrListBox.SelectedItem != null) { if (pr.Name == AllPrListBox.SelectedItem.ToString()) { NameText.Text = pr.Name; Description.Text = pr.Description; ManagerComboBox.Text = pr.Employee; CustomerComboBox.Text = pr.Customer.Name; People.Text = pr.People.ToString(); Money.Text = pr.Money.ToString(); Date.Text = pr.Date.ToString(); Log.logging("Удален проект: " + pr.Name + " " + DateTime.Now); lp.Proj.Remove(pr); break; } } } Serialization.Serialize_proj(lp); AllPrListBox.Items.Clear(); foreach (var item in lp.Proj) { AllPrListBox.Items.Add(item.Name); } NameText.Clear(); Description.Clear(); ManagerComboBox.SelectedIndex = -1; CustomerComboBox.SelectedIndex = -1; People.Clear(); Money.Clear(); Date.Clear(); MessageBox.Show("Удалено!"); } catch (Exception ex) { MessageBox.Show(ex.Message); Log.logging("Ошибка: " + ex); } }
private void AddLeagueButton_Click(object sender, RoutedEventArgs e) { foreach (var item in Base.Leagues) { if (item.Name == NameText.Text) { MessageBox.Show("Ошибка. Лига с таким названием уже существует!\nВведите другое название!"); NameText.Clear(); return; } } if (string.IsNullOrEmpty(CoText.Text) || string.IsNullOrEmpty(NameText.Text) || string.IsNullOrWhiteSpace(CoText.Text) || string.IsNullOrWhiteSpace(NameText.Text)) { MessageBox.Show("Некорректный ввод. Пустая строка или введен пробел!"); NameText.Clear(); CoText.Clear(); return; } League league = new League(NameText.Text, CoText.Text, _clubs: null, _logoPath: LogoText.Text); if (ClubsBox.SelectedIndex != 1) { var list = new List <Club>(); for (int i = 2, j = ClubsBox.Items.Count; i < j; i++) { CheckBox o = (CheckBox)ClubsBox.Items.GetItemAt(i); if (o.IsChecked == true) { foreach (var it in Base.Clubs) { if (it.Name == (string)o.Content) { it.League = league; Base.freeLeague.Clubs.Remove(it); list.Add(it); break; } } } } league.Clubs = list; Base.Leagues.Add(league); } else { Base.Leagues.Add(league); } MessageBox.Show("Лига добавлена"); DialogResult = true; }
private void UpdateBTN_Click(object sender, EventArgs e) { connect.Open(); SqlCommand command = new SqlCommand("update Customer set CustomerID='" + CustomerIDText.Text.ToString() + "',Name='" + NameText.Text.ToString() + "',Surname='" + SurnameText.Text.ToString() + "',Address='" + AddressText.Text.ToString() + "',Telephone='" + TelephoneText.Text.ToString() + "',Email='" + EmailText.Text.ToString() + "'where CustomerID=" + CustomerID + "", connect); command.ExecuteNonQuery(); connect.Close(); viewdetails(); CustomerIDText.Clear(); NameText.Clear(); SurnameText.Clear(); AddressText.Clear(); TelephoneText.Clear(); EmailText.Clear(); }
private void listUserIds_SelectionChanged(object sender, SelectionChangedEventArgs e) { FriendGrid.Items.Clear(); FavoriteGrid.Items.Clear(); dataGrid.Items.Clear(); StarsText.Clear(); FansText.Clear(); NameText.Clear(); YelSinceText.Clear(); LatText.Clear(); if (listUserIds.SelectedIndex > -1) { string info = "select firstname, avgstars, joindate, lat, long from users where userid= '" + listUserIds.SelectedItem.ToString() + "';"; } }
private async void Button_update_user_Click(object sender, RoutedEventArgs e) { try { if (WorkClass.role == 1) { person.personid = WorkClass.trener.trenerid; } else if (WorkClass.role == 0) { person.personid = WorkClass.sportsman.sportsmanid; } else { throw new Exception("Не выбрана роль"); } if (!string.IsNullOrEmpty(NameText.Text) && !string.IsNullOrEmpty(SnameText.Text) && !string.IsNullOrEmpty(PhoneText.Text) && !string.IsNullOrEmpty(AgeText.Text)) { person.name = NameText.Text; person.sname = SnameText.Text; person.phone = Convert.ToInt32(PhoneText.Text); person.age = Convert.ToInt32(AgeText.Text); await UpdateInfoAsync(); NameText.Clear(); SnameText.Clear(); PhoneText.Clear(); AgeText.Clear(); Name.Text = String.Empty; Sname.Text = String.Empty; Age.Text = String.Empty; Phone.Text = String.Empty; await ReadInfoAsync(); } else { throw new Exception("Поля не заполнены"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DeleteBTN_Click(object sender, EventArgs e) { connect.Open(); SqlCommand komut = new SqlCommand("Delete From Customer Where CustomerID=(" + sira + ")", connect); komut.ExecuteNonQuery(); connect.Close(); viewdetails(); viewdetails(); CustomerIDText.Clear(); NameText.Clear(); SurnameText.Clear(); AddressText.Clear(); TelephoneText.Clear(); EmailText.Clear(); }
private void Save_Click(object sender, EventArgs e) { Resturant rest = new Resturant(NameText.Text, AddressText.Text, PhoneNumberText.Text, ZipCodeText.Text, RatingText.Text, ReviewText.Text); if (!listOfRestruants.Contains(rest)) { listOfRestruants.Add(rest); } else { listOfRestruants.Add(rest); } NameText.Clear(); AddressText.Clear(); ZipCodeText.Clear(); PhoneNumberText.Clear(); RatingText.Clear(); ReviewText.Clear(); }
private void ClearControls() { NameText.Clear(); AgeText.Clear(); GenderCombo.SelectedItem = null; }
private void AddClubButton_Click(object sender, RoutedEventArgs e) { bool error = false; foreach (var item in Base.Clubs) { if (item.Name == NameText.Text) { MessageBox.Show("Ошибка. Клуб с таким названием уже существует!\nВведите другое название!"); error = true; NameText.Clear(); } } if (string.IsNullOrWhiteSpace(NameText.Text) || string.IsNullOrEmpty(NameText.Text)) { MessageBox.Show("Некорректный ввод. Пустая строка названия клуба или введен пробел!"); error = true; NameText.Clear(); } if (string.IsNullOrEmpty(CoachText.Text) || string.IsNullOrWhiteSpace(CoachText.Text)) { MessageBox.Show("Некорректный ввод. Пустая строка тренера или введен пробел!"); error = true; CoachText.Clear(); } if (error) { return; } Club club = new Club(NameText.Text, CoachText.Text, null, null, LogoIm, LogoText.Text); if (AddLeBox.Text != "Вне лиги") { int index = 0; foreach (var item in Base.Leagues) { if (item.Name == AddLeBox.Text) { club.League = item; if (Base.Leagues[index].Clubs == null) { List <Club> list = new List <Club> { club }; Base.Leagues[index].Clubs = list; } else { Base.Leagues[index].Clubs.Add(club); } break; } index++; } if (index == Base.Leagues.Count) { MessageBox.Show("Такая лига не найдена. \nВыберите из списка сушествующих или Вне лиги, обозначающее что клуб не входит в лигу!"); AddLeText.Text = "Вне лиги"; AddLeBox.SelectedIndex = 0; return; } } else { club.League = Base.freeLeague; if (Base.freeLeague.Clubs == null) { List <Club> list = new List <Club> { club }; Base.freeLeague.Clubs = list; } else { Base.freeLeague.Clubs.Add(club); } } if (PlayerCmBox.SelectedIndex != 1) { var list = new List <Player>(); for (int i = 2, j = PlayerCmBox.Items.Count; i < j; i++) { CheckBox o = (CheckBox)PlayerCmBox.Items.GetItemAt(i); if (o.IsChecked == true) { foreach (var it in Base.Players) { if (it.Name == (string)o.Content) { it.Club = club; Base.freeClub.Players.Remove(it); list.Add(it); break; } } } } club.Players = list; Base.Clubs.Add(club); } else { Base.Clubs.Add(club); } MessageBox.Show(messageBoxText: "Клуб добавлен"); DialogResult = true; }
private void ClearForm() { NameText.Clear(); CodeText.Clear(); }
private void ChangeProject_Click(object sender, RoutedEventArgs e) { try { foreach (var pr in lp.Proj) { if (AllPrListBox.SelectedItem != null) { if (AllPrListBox.SelectedItem.ToString() == pr.Name) { int k = lp.Proj.IndexOf(pr); lp.Proj.RemoveAt(k); break; } } } Customer customer = null; lc.Cust = new List <Customer>(); lc = Serialization.Deserialze(lc); foreach (var item in lc.Cust) { if (CustomerComboBox.SelectedItem.ToString() == item.Name) { customer = item; } } Project proj = new Project(NameText.Text, Description.Text, ManagerComboBox.Text, customer, int.Parse(People.Text), int.Parse(Money.Text), Date.Text); lp.Proj.Add(proj); Log.logging("Изменен проект: " + proj.Name + " " + DateTime.Now); Serialization.Serialize_proj(lp); MessageBox.Show("Сохранено!"); AllPrListBox.Items.Clear(); foreach (var item in lp.Proj) { AllPrListBox.Items.Add(item.Name); } NameText.Clear(); Description.Clear(); ManagerComboBox.SelectedIndex = -1; CustomerComboBox.SelectedIndex = -1; People.Clear(); Money.Clear(); Date.Clear(); AllPrListBox.SelectedItem = -1; } catch (Exception ex) { MessageBox.Show(ex.Message); Log.logging("Ошибка: " + ex); } }