//кнопка создания private void Btn_UserCreate_Click(object sender, RoutedEventArgs e) { //selectAccount = (Accounts)grid_UserAcc.SelectedItem; Accounts newAcc = new Accounts(); #region Поля для аккаута newAcc.ID = Guid.NewGuid(); newAcc.DateBrth = DateTime.Now; if (Properties.Settings.Default.User_RoleName == "Агент" || Properties.Settings.Default.User_RoleName == "Разработчик") { newAcc.UserRole = Guid.Parse("7BB39BE3-8866-46A2-A38D-FB1EAE13531E"); } #endregion AccountWindows AW = new AccountWindows(newAcc); if (AW.ShowDialog() == true) { if (App.bd.CreateUser(newAcc) == false) { return; } UpdateData(newAcc); } }
//кнопка изменения private void Btn_UserEdite_Click(object sender, RoutedEventArgs e) { selectAccount = (Accounts)grid_UserAcc.SelectedItem; if (selectAccount != null) { AccountWindows AW = new AccountWindows(selectAccount); if (AW.ShowDialog() == true) { if (App.bd.EditUser(selectAccount) == false) { return; } UpdateData(selectAccount); } } }