/// <summary> /// Convert a user to user impl /// </summary> /// <param name="user"></param> /// <returns></returns> public static UserImpl ToUserImpl(this User user) { var userImpl = new UserImpl() { UserName = user.UserName.Trim(), FullName = user.FullName.Trim(), EmailAddress = user.EmailAddress.Trim(), Status = user.Status }; return(userImpl); }
/// <summary> /// Create a Usaer from a UserImpl /// </summary> /// <param name="userImpl"></param> /// <returns></returns> public static User ToUser(this UserImpl userImpl) { var user = new User() { UserName = userImpl.UserName.TrimEnd(), FullName = userImpl.FullName.TrimEnd(), EmailAddress = userImpl.EmailAddress.TrimEnd(), Status = userImpl.Status }; return(user); }
/// <summary> /// Create an empty UserImpl /// </summary> /// <param name="userImpl"></param> /// <returns></returns> public static User Empty(this UserImpl userImpl) { var emptyUserImpl = new User() { UserName = string.Empty, FullName = string.Empty, EmailAddress = string.Empty, Status = NULL_ID }; return(emptyUserImpl); }
private void Button_Click_1(object sender, RoutedEventArgs e) { try { if (txtcode.Text == random) { if (txtpass.Password.Length >= 5) { if (txtpass.Password == txtconfirm.Password) { us = new User(txtpass.Password, id); ui = new UserImpl(); int res = ui.Updatepass(us); if (res > 0) { System.Diagnostics.Debug.WriteLine(string.Format("{0} | Change Password: ({1}).", DateTime.Now, userito.Email)); MessageBox.Show("Password Modifed successfully!!!"); Educa.MainWindow log = new MainWindow(); log.Show(); this.Close(); } else { MessageBox.Show("Something happened \nCommunicate with the Suport department \[email protected]"); } } else { MessageBox.Show("Passwords do not match"); } } else { MessageBox.Show("The password cannot be less than 5 characters"); } } else { MessageBox.Show("Code incorrect"); } } catch (Exception ex) { MessageBox.Show("Something happened \nCommunicate with the Suport department \[email protected]"); } }
/// <summary> /// Adds the user to the collection of users maintained by the user manager. /// Publishes details of this user to all listeners. /// </summary> /// <param name="userId"> the userId of the user that will be added.</param> /// <param name="firstName"> the first name of the user that will be added.</param> /// <param name="lastName"> the last name of the user that will be added.</param> /// <param name="emailAddress"> the email address of the user that will be added.</param> /// <param name="locationName"> the location of the user that will be added.</param> /// <param name="groupId"> the group of the user that will be added.</param> /// <param name="isValid"> the validity of the user that will be added.</param> /// <exception cref="ArgumentException"> thrown if any of the string parameters are null or empty.</exception> public void AddUser(string userId, string firstName, string lastName, string emailAddress, string locationName, int groupId, bool isValid) { if (String.IsNullOrEmpty(userId)) { throw new ArgumentException("userId"); } if (String.IsNullOrEmpty(firstName)) { throw new ArgumentException("firstName"); } if (String.IsNullOrEmpty(lastName)) { throw new ArgumentException("lastName"); } if (String.IsNullOrEmpty(emailAddress)) { throw new ArgumentException("emailAddress"); } LocationEnum parsedLocation = LocationEnum.HONG_KONG; if (String.IsNullOrEmpty(locationName) || !Enum.TryParse(locationName, true, out parsedLocation)) { throw new ArgumentException("locationName"); } var newUser = new UserImpl() { UserId = userId, FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, LocationName = parsedLocation, GroupId = groupId, IsValid = isValid }; Users.Add(newUser); eventAggregator.GetEvent <NewUserEvent>().Publish(new NewUserEventPayload() { NewUser = newUser }); }
public XboxLiveUser(Windows.System.User systemUser) { var user = new UserImpl(systemUser); // The UserImpl monitors the underlying system for sign out events // and notifies us that a user has been signed out. We can then // pass that event on the application with a concrete reference. user.SignInCompleted += (sender, args) => { OnSignInCompleted(this); }; user.SignOutCompleted += (sender, args) => { OnSignOutCompleted(this); }; this.userImpl = user; }
internal XboxLiveUser(global::System.IntPtr xboxLiveUserPtr) { var user = new UserImpl(xboxLiveUserPtr); // The UserImpl monitors the underlying system for sign out events // and notifies us that a user has been signed out. We can then // pass that event on the application with a concrete reference. user.SignInCompleted += (sender, args) => { OnSignInCompleted(this); }; user.SignOutCompleted += (sender, args) => { OnSignOutCompleted(this); }; this.userImpl = user; user.UpdatePropertiesFromXboxLiveUserPtr(); }
protected void BTNsubmit_Click(object sender, EventArgs e) { if (isValidData()) { User usr = new User(); usr.UserId = (PanelAdd.Visible ? TXTuserId.Text : LBLuserId.Text); usr.FName = TXTfName.Text; usr.LName = TXTlName.Text; usr.Phone = (TXTphone.Text.Equals("(___) ___-____") ? "" : TXTphone.Text); usr.Email = TXTemail.Text; usr.Active = ddlActive.SelectedValue; CheckBoxList ctrl = CBLroles; foreach (ListItem item in ctrl.Items) { if (item.Selected) { usr.Roles.Add(item.Value.ToString()); } } UserService usrSrv = new UserImpl(); if (PanelAdd.Visible) { usrSrv.insertUser(usr); } else { usrSrv.updateUser(usr); } mpeUser.Hide(); clearControls(); GridView1.DataBind(); } else { LBLerror.Visible = true; mpeUser.Show(); } }
public IUser CreateUser(ISchema schema, string login, string name, string email) { Assert.NullArgument(schema, "schema"); Assert.EmptyString(login, "login"); Assert.EmptyString(name, "name"); Assert.EmptyString(email, "email"); IUser user = null; Sync(() => { user = GetUserInternal(login, false); if (user == null) { var model = new UserModel() { Login = login, Name = name, Email = email, SchemaId = schema.Id }; if (_store.Save(model)) { user = new UserImpl(schema, model); _users[login.ToLower()] = user; } else { throw new Exception("Não foi possivel criar o esquema de usuários - erro ao persistir as informações"); } } else { throw new Exception("Já existe um usuário com o login " + login); } }); return(user); }
public void LoginTest() { var implement = new UserImpl(userRepoMoq.Object); var fakeServerCallContext = TestServerCallContext.Create( "fooMethod", null, DateTime.UtcNow.AddHours(1), new Metadata(), CancellationToken.None, "127.0.0.1", null, null, (metadata) => TaskUtils.CompletedTask, () => new WriteOptions(), (writeOptions) => { } ); var result = implement.Login(new LoginRequest(), fakeServerCallContext); //Assert.IsType<LoginResponse>(result); Assert.Equal(result.Result.CityName, actualCityName); }
private IUser GetUserInternal(String login, bool throwIfNotExists) { Assert.EmptyString(login, "login"); IUser result = null; login = login.ToLower(); if (!_users.TryGetValue(login, out result)) { var qry = _store.CreateQuery <UserModel>(); qry.AddFilterEqual("Login", login); var model = qry.FindFirst(); if (model != null) { result = new UserImpl(GetSchemaInternal(model.SchemaId, true), model); _users[login] = result; } } if (result == null && throwIfNotExists) { throw new InvalidOperationException("Não existe um usuário com o login " + throwIfNotExists); } return(result); }
public void Dispose() { _userImpl = null; }
public static void SetPassword(IDCUser user, String password) { user.StoredPassword = UserImpl.GeneratePassword(password); }
/// <summary> /// Create the given user /// </summary> /// <param name="user"></param> public void CreateUser(UserImpl user) { }
/// <summary> /// Determine if the given UserImpl is empty /// </summary> /// <param name="userImpl"></param> /// <returns></returns> public static bool IsEmpty(this UserImpl userImpl) { return(userImpl.Status == STATUS_ID); }
private void Button_Click_2(object sender, RoutedEventArgs e) { try { if (txtuser.Text != "" || txtpass.Password != "") { implUser = new UserImpl(); DataTable dt = implUser.Login(txtuser.Text.ToLower(), txtpass.Password); if (dt.Rows.Count > 0) { //Existe el usuario //Los variables de sesión Session.SessionID = int.Parse(dt.Rows[0][0].ToString()); Session.SessionUser = dt.Rows[0][1].ToString(); Session.SessionRole = dt.Rows[0][3].ToString(); Session.SessionCurrent = dt.Rows[0][4].ToString(); Session.SessionEmail = dt.Rows[0][6].ToString(); Session.Sessionphoto = dt.Rows[0][7].ToString(); Session.Sessionstat = dt.Rows[0][8].ToString(); txtmensaje.Text = "Welcome " + dt.Rows[0][4].ToString(); accept = true; if (int.Parse(dt.Rows[0][5].ToString()) > 0) { revisara = true; if (int.Parse(Session.Sessionstat.ToString()) == 0) { MessageBox.Show("Your account is disable \n Please communicate with administration"); } else { hecho.IsOpen = true; } } else { revisara = false; } if (int.Parse(Session.Sessionstat.ToString()) == 0) { MessageBox.Show("Your account is disable \n Please communicate with administration"); } else { hecho.IsOpen = true; } } else { txtmensaje.Text = "User name or password is incorrect"; accept = false; } } else { txtmensaje.Text = "Don't leave any blank space"; accept = false; } } catch (Exception ex) { MessageBox.Show("User name or password is incorrect"); } }
/// <summary> /// Create a new user /// </summary> /// <param name="user"></param> public void CreateUser(UserImpl user) { db.UserImpls.Add(user); db.SaveChanges(); }
public virtual void CreateUser(UserImpl user) { throw new NotImplementedException(); }
public static Boolean ComparePassword(IDCUser user, String password) { return(UserImpl.ComparePassword(user.StoredPassword, password)); }