private void Button_Listener(object sender, RoutedEventArgs e) { Button button = (Button)sender; switch (button.Name) { case "FormClose": this.Close(); break; case "btnChange": Helper.Level level = (Helper.Level)Enum.Parse(typeof(Helper.Level), lvl.SelectedItem.ToString().Trim()); // Convert string (Selected Level) to enum string new_value = "surname = '" + surname.Text.Trim() + "', " + "name = '" + name.Text.Trim() + "', " + "patronymic = '" + patronymic.Text.Trim() + "', " + "phone = '" + phone.Text.Trim() + "', " + "email = '" + email.Text.Trim() + "', " + "account = '" + login.Text.Trim() + "', " + "lvl = '" + level.GetHashCode().ToString() + "'"; SQLiteAdapter.ChangeValueById("employees", employee.id, new_value); Helper.RefreshOCollection(); this.Close(); break; default: break; } }
private void Button_Listener(object sender, RoutedEventArgs e) { Button button = (Button)sender; switch (button.Name) { case "FormClose": this.Close(); break; case "btnAdd": Helper.Level level = (Helper.Level)Enum.Parse(typeof(Helper.Level), lvl.SelectedItem.ToString().Trim()); // Convert string (Selected Level) to enum SQLiteAdapter.SetValue("employees", surname.Text.Trim(), name.Text.Trim(), patronymic.Text.Trim(), phone.Text.Trim(), email.Text.Trim(), login.Text.Trim(), level.GetHashCode().ToString() ); // Refresh ObservableCollection for update dataGrids Helper.RefreshOCollection(); /*Helper.OEmployees.Add(new Employee * { * id = (Helper.OEmployees.Count() + 1).ToString(), * surname = surname.Text.Trim(), * name = name.Text.Trim(), * patronymic = patronymic.Text.Trim(), * phone = phone.Text.Trim(), * email = email.Text.Trim(), * login = login.Text.Trim(), * lvl = level.GetHashCode().ToString() * });*/ this.Close(); break; default: break; } }