private void editProfileButton_Click(object sender, EventArgs e) { if (firstNameTextBox.Enabled == false) { firstNameTextBox.Enabled = true; lastNameTextBox.Enabled = true; editProfileButton.Text = "Подтвердить изменения"; } else { Person person = new Person() { FirstName = firstNameTextBox.Text, LastName = lastNameTextBox.Text, Login = loginLabel.Text.Split()[1] }; PersonStorage personStorage = new PersonStorage(); List <Person> persons = personStorage.EditPerson(Person, person); personStorage.SavePersons(); firstNameTextBox.Enabled = false; lastNameTextBox.Enabled = false; editProfileButton.Text = "Изменить данные"; MessageBox.Show("Изменения вступят после перезагрузки"); } }
public void SaveSections(List <Section> sections) { PersonStorage personStorage = new PersonStorage(); personStorage.persons[personStorage.LoginSearch(Login)].Sections = sections; personStorage.SavePersons(); }
public void SaveStatistic(List <PersonStatistic> personStatistics) { PersonStorage personStorage = new PersonStorage(); personStorage.persons[personStorage.LoginSearch(Login)].PersonStatistics = personStatistics; personStorage.SavePersons(); }
private void deletePersonButton_Click(object sender, EventArgs e) { PersonStorage personStorage = new PersonStorage(); List <Person> persons = personStorage.DeletePerson(Person); personStorage.SavePersons(); Person.FirstName = null; this.Close(); }
private void newPersonButton_Click(object sender, EventArgs e) { Person person = new Person() { FirstName = firstNameTextBox.Text, LastName = lastNameTextBox.Text, Login = loginTextBox.Text }; if (!personStorage.LoginInStorage(person.Login)) { Persons = personStorage.AddPerson(person); personStorage.SavePersons(); MessageBox.Show("Пользователь добавлен."); this.Close(); } else { MessageBox.Show("Такой логин уже существует, измените логин!"); } }