private void EditUerButton_Click(object sender, RoutedEventArgs e) { LicensePlateUserModel listBoxItem = (LicensePlateUserModel)LicensePlateList.SelectedItem; var user = new UserModel(); if (!string.IsNullOrEmpty(listBoxItem.UserName)) { user = _userManagement.GetUser(listBoxItem.LicensePlate); } else { user.LicensePlate = listBoxItem.LicensePlate; } InfoUserWindow infoUserWindow = new InfoUserWindow(LicensePlateUserModel.ConvertToLincensePlateUserModel(user)); if (infoUserWindow.ShowDialog() == true) { } else { int index = LicensePlateList.SelectedIndex; LicensePlateList.Items.RemoveAt(index); var licensePlate = InfoUserWindow.LicensePlateUserModel; LicensePlateList.Items.Insert(index, licensePlate); } }
public static LicensePlateUserModel ConverToLicensePlateUserModel(UserModel userModel) { LicensePlateUserModel lincensePlateUserModel = new LicensePlateUserModel(); lincensePlateUserModel.LicensePlate = userModel.LicensePlate; lincensePlateUserModel.UserName = userModel.Name; lincensePlateUserModel.Address = userModel.Address; lincensePlateUserModel.Email = userModel.Email; return(lincensePlateUserModel); }
public static UserModel ConverToUserModel(LicensePlateUserModel licensePlateUser) { UserModel userModel = new UserModel(); userModel.Name = licensePlateUser.UserName; userModel.LicensePlate = licensePlateUser.LicensePlate; userModel.Address = licensePlateUser.Address; userModel.Email = licensePlateUser.Email; return(userModel); }
public InfoUserWindow(LicensePlateUserModel licensePlateUser) { InitializeComponent(); LicensePlateUserModel = licensePlateUser; _userManager = new UserManager(); UserNameTextBox.Text = licensePlateUser.UserName; LicensePlateTextBox.Text = licensePlateUser.LicensePlate; AddressTextBox1.Text = licensePlateUser.Address; EmailTextBox.Text = licensePlateUser.Email; }
private void InfoNumberListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { LicensePlateUserModel listBoxItem = (LicensePlateUserModel)InfoNumberListBox.SelectedItem; if (listBoxItem != null) { LicensePlateModel licensePlate = MemoryDictionaryHelper.GetLicensePlate(listBoxItem.LicensePlate); if (licensePlate != null) { CarImage.Source = licensePlate.Image; ImageOriginal.Source = licensePlate.ImageLicensePlate; } } }