public UserService() { _cryptographyLibrary = new CryptographyLibrary(); _authentificationLibrary = new AuthentificationLibrary(); _mailingLibrary = new MailingLibrary(); _userSharedService = new UserSharedService(); }
private async void btnCreate_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtId.Text)) { await new MessageDialog("Id is required").ShowAsync(); txtId.Focus(FocusState.Keyboard); return; } else if (string.IsNullOrEmpty(txtFName.Text)) { await new MessageDialog("Full name is required").ShowAsync(); txtFName.Focus(FocusState.Keyboard); return; } else if (string.IsNullOrEmpty(txtUName.Text)) { await new MessageDialog("User name is required").ShowAsync(); txtUName.Focus(FocusState.Keyboard); return; } else if (string.IsNullOrEmpty(txtPass.Text)) { await new MessageDialog("Passcode is required").ShowAsync(); txtPass.Focus(FocusState.Keyboard); return; } else if (string.IsNullOrEmpty(txtAddress.Text)) { await new MessageDialog("Address is required").ShowAsync(); txtAddress.Focus(FocusState.Keyboard); return; } else if (string.IsNullOrEmpty(txtEmail.Text)) { await new MessageDialog("Email is required").ShowAsync(); txtEmail.Focus(FocusState.Keyboard); return; } { string passEncrypted = CryptographyLibrary.Encrypt(txtPass.Text); Employee emp = new Employee { EmployeeId = txtId.Text, FullName = txtFName.Text, UserName = txtUName.Text, Passcode = passEncrypted, Address = txtAddress.Text, Email = txtEmail.Text, IsAdmin = (bool)cbIsAdmin.IsChecked }; EmployeeContext.eList.Add(emp); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { var employee = Models.EmployeeContext.eList.SingleOrDefault(u => u.UserName.Equals(txtName.Text) && CryptographyLibrary.Decrypt(u.Passcode).Equals(txtPass.Password)); //string passDecryption = CryptographyLibrary.Decrypt(employee.Passcode); //if (passDecryption == "123") //{ // new MessageDialog("Equal").ShowAsync(); //} //else //{ // new MessageDialog("Not Equal").ShowAsync(); //} if (employee == null) { txtMessage.Text = "Employee not found!"; } else { if (employee.IsAdmin == true) { Frame.Navigate(typeof(ManageEmployee), employee); } else { Frame.Navigate(typeof(ViewDetails), employee); } } }
public UserSharedService() { _cryptographyLibrary = new CryptographyLibrary(); }