private void btn_addUser_Click(object sender, RoutedEventArgs e) { AddUserWindow addUserWindow = new AddUserWindow(db); addUserWindow.ShowDialog(); db.SaveChanges(); }
private void buttonAddUser_Click(object sender, EventArgs e) { AddUserWindow addUserWindow = new AddUserWindow(this); addUserWindow.StartPosition = FormStartPosition.CenterParent; addUserWindow.ShowDialog(); }
private void EditUser_Button_Click(object sender, System.Windows.RoutedEventArgs e) { AddUserWindow addUserWindow = new AddUserWindow(UsersGrid.SelectedItem); addUserWindow.ShowDialog(); UsersGrid.ItemsSource = специалистModel.Select(); }
/// <summary> /// Executes the edit command /// </summary> public void EditUserExecute() { try { if (User != null) { string firstname = User.FirstName; string lastname = User.LastName; AddUserWindow addUser = new AddUserWindow(User); addUser.ShowDialog(); UserList = new ObservableCollection <tblUser>(userData.GetAllUsers().ToList()); // Notification if ((addUser.DataContext as AddUserViewModel).IsUpdateUser == true) { InfoText = $"Updated the user {firstname} {lastname}"; InfoColor = "#FF8BC34A"; SnackInfo(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void addUser(TicketMastersEntities context) { AddUserWindow p = new AddUserWindow(); if (p.ShowDialog().Value) { User addNewUser = new User { FirstName = p.firstNameTxt.Text, LastName = p.lastNameTxt.Text, StreetAddress = p.streetAddressTxt.Text, City = p.cityTxt.Text, State = p.stateTxt.Text, ZipCode = p.zipCodeTxt.Text, PhoneNumber = p.phoneNumTxt.Text }; context.Users.AddObject(addNewUser); saveUser(); //fix still shows when data not saving useridLbl.Text = addNewUser.UserID.ToString(); firstLbl.Text = addNewUser.FirstName; lastLbl.Text = addNewUser.LastName; streetLbl.Text = addNewUser.StreetAddress; cityLbl.Text = addNewUser.City; stateLbl.Text = addNewUser.State; zipLbl.Text = addNewUser.ZipCode; phoneLbl.Text = addNewUser.PhoneNumber; } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { AddUserWindow auw = new AddUserWindow(); this.Close(); auw.ShowDialog(); }
public void JumpToAddUser(object parameter) { AddUserWindow a = new AddUserWindow(); a.ShowDialog(); LoadUserInfo(); ID = 0; }
public User AddUser() { addUserWindow = new AddUserWindow(); addUserViewModel = new AddUserViewModel() { AddCommand = new RelayCommand(ExecuteAddCommand), }; addUserWindow.DataContext = addUserViewModel; return(addUserWindow.ShowDialog() == true ? addUserViewModel.User : null); }
private void addButton_Click(object sender, RoutedEventArgs e) { var addUserWindow = new AddUserWindow(); addUserWindow.Owner = this; addUserWindow.ShowDialog(); if (addUserWindow.UserWasAdded) { RefreshUsersList(); } }
/// <summary> /// Executes the add user command /// </summary> private void AddUserExecute() { try { AddUserWindow addUser = new AddUserWindow(); addUser.ShowDialog(); UserList = new ObservableCollection <tblUser>(userData.GetAllUsers().ToList()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnAddUser_Click(object sender, RoutedEventArgs e) { AddUserWindow adduser = new AddUserWindow(); adduser.ShowDialog(); _context.Users.Add(new EFUser() { Name = adduser.NameAdd, Birthday = adduser.BirthAdd, ImageUrl = adduser.ImgUrlAdd }); _context.SaveChanges(); DG_Load(); }
/// <summary> /// Executes the edit command /// </summary> public void EditUserExecute() { try { if (User != null) { AddUserWindow addUser = new AddUserWindow(User); addUser.ShowDialog(); UserList = new ObservableCollection <tblUser>(userData.GetAllUsers().ToList()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnChangeUser_Click(object sender, RoutedEventArgs e) { EFUser cng = null; if (DG.SelectedItem != null) { EFUser select = DG.SelectedItem as User; AddUserWindow cnguser = new AddUserWindow(); cnguser.txtName.Text = select.Name; cnguser.dpbirthday.SelectedDate = select.Birthday; cnguser.txtImg.Text = select.ImageUrl; cnguser.ShowDialog(); cng = _context.Users.Where(u => u.Id == select.Id).First(); cng.Name = cnguser.NameAdd; cng.Birthday = cnguser.BirthAdd; cng.ImageUrl = cnguser.ImgUrlAdd; _context.SaveChanges(); DG_Load(); } }
/// <summary> /// Executes the add user command /// </summary> private void AddUserExecute() { try { AddUserWindow addUser = new AddUserWindow(); addUser.ShowDialog(); UserList = new ObservableCollection <tblUser>(userData.GetAllUsers().ToList()); // Notification if ((addUser.DataContext as AddUserViewModel).IsUpdateUser == true) { InfoText = $"Created a new user"; InfoColor = "#FF8BC34A"; SnackInfo(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Creates dialog window with user adding interface /// </summary> private void Add_Click(object sender, RoutedEventArgs e) { AddUserWindow addUserWindow = new AddUserWindow(); addUserWindow.ShowDialog(); }
private void NewUser_Click(object sender, RoutedEventArgs e) { AddUserWindow AUW = new AddUserWindow(); AUW.ShowDialog(); }
private void editUser(TicketMastersEntities context) { int idInfo = int.Parse(useridLbl.Text); User u = context.Users.First(userIdInEntity => userIdInEntity.UserID == idInfo); AddUserWindow p = new AddUserWindow(); p.firstNameTxt.Text = u.FirstName; p.lastNameTxt.Text = u.LastName; p.stateTxt.Text = u.State; p.streetAddressTxt.Text = u.StreetAddress; p.cityTxt.Text = u.City; p.zipCodeTxt.Text = u.ZipCode; p.phoneNumTxt.Text = u.PhoneNumber; if (p.ShowDialog().Value) { //change this so it binds directly u.FirstName = firstLbl.Text = p.firstNameTxt.Text; u.LastName = lastLbl.Text = p.lastNameTxt.Text; u.State = stateLbl.Text = p.stateTxt.Text; u.StreetAddress = streetLbl.Text = p.streetAddressTxt.Text; u.City = cityLbl.Text = p.cityTxt.Text; u.ZipCode = zipLbl.Text = p.zipCodeTxt.Text; u.PhoneNumber = phoneLbl.Text = p.phoneNumTxt.Text; } saveUser(); }