Beispiel #1
0
    //registering a new user

    public string Insert(OrgMemRegAddRequest model)
    {
        string GUID = "";

        UserSaltPasswordHash saltHashObject = new UserSaltPasswordHash();

        saltHashObject     = _userService.CreateSaltandHash(model.TemporaryPassword);
        model.Salt         = saltHashObject.salt;
        model.PasswordHash = saltHashObject.passwordHash;
        DataProvider.ExecuteNonQuery("dbo.OrganizationRegisterMember",
                                     inputParamMapper: (SqlParameterCollection inputs) =>
        {
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@Email", model.Email, SqlDbType.NVarChar, 128));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@Salt", model.Salt, SqlDbType.NVarChar, 128));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@PasswordHash", model.PasswordHash, SqlDbType.NVarChar, 128));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@FirstName", model.FirstName, SqlDbType.NVarChar, 50));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@MiddleName", model.MiddleName, SqlDbType.NVarChar, 50));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@LastName", model.LastName, SqlDbType.NVarChar, 50));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@Gender", model.Gender, SqlDbType.NVarChar, 20));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@PhoneNumber", model.PhoneNumber, SqlDbType.NVarChar, 20));
            inputs.Add(SqlDbParameter.Instance.BuildParameter("@LoggedInUserBaseId", model.UserBaseId, SqlDbType.Int));

            SqlParameter guidOut = new SqlParameter("@GUID", SqlDbType.NVarChar, 128);

            guidOut.Direction = ParameterDirection.Output;
            inputs.Add(guidOut);
        },
                                     returnParameters: (SqlParameterCollection inputs) =>
        {
            GUID = inputs["@GUID"].Value.ToString();
        });

        return(GUID);
    }
Beispiel #2
0
        public void UpdatePassword(ForgotPasswordUserBaseUpdateRequest model)
        {
            UserSaltPasswordHash salthash = _userservice.CreateSaltandHash(model.Password);

            DataProvider.ExecuteNonQuery("dbo.UserBase_UpdateByAppTokenUserBaseId",
                                         inputParamMapper: (SqlParameterCollection inputs) =>
            {
                inputs.AddWithValue("@GUID", model.GUID);
                inputs.AddWithValue("@PasswordHash", salthash.passwordHash);
                inputs.AddWithValue("@Salt", salthash.salt);
            });
        }