Exemplo n.º 1
0
        /// <summary>
        /// Connect to database and change user password.
        /// </summary>
        /// <param name="user">Object of UserInfo class.</param>
        /// <returns>True for change password sucessfully.</returns>
        public static bool ChangePassword(UserInfo obj)
        {
            string             sp      = "[dbo].[usp_sf_ResetPassword]";
            SageFrameSQLHelper sagesql = new SageFrameSQLHelper();

            try
            {
                List <KeyValuePair <string, object> > ParamCollInput = new List <KeyValuePair <string, object> >();
                ParamCollInput.Add(new KeyValuePair <string, object>("@UserID", obj.UserID));
                ParamCollInput.Add(new KeyValuePair <string, object>("@NewPassword", obj.Password));
                ParamCollInput.Add(new KeyValuePair <string, object>("@PasswordSalt", obj.PasswordSalt));
                ParamCollInput.Add(new KeyValuePair <string, object>("@PasswordFormat", obj.PasswordFormat));

                sagesql.ExecuteNonQuery(sp, ParamCollInput);
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Connect to database and change user in role.
        /// </summary>
        /// <param name="ApplicationName">Application name.</param>
        /// <param name="UserID">UserID</param>
        /// <param name="RoleNamesUnselected">Unselected role name.</param>
        /// <param name="RoleNamesSelected">Selected role name.</param>
        /// <param name="PortalID">PortalID</param>
        /// <returns>True for change user role successfully.</returns>
        public static bool ChangeUserInRoles(string ApplicationName, Guid UserID, string RoleNamesUnselected, string RoleNamesSelected, int PortalID)
        {
            string             sp      = "[dbo].[usp_ChangeUserInRoles]";
            SageFrameSQLHelper sagesql = new SageFrameSQLHelper();

            try
            {
                List <KeyValuePair <string, object> > ParamCollInput = new List <KeyValuePair <string, object> >();
                ParamCollInput.Add(new KeyValuePair <string, object>("@ApplicationName", ApplicationName));
                ParamCollInput.Add(new KeyValuePair <string, object>("@UserID", UserID));
                ParamCollInput.Add(new KeyValuePair <string, object>("@RoleNamesUnselected", RoleNamesUnselected));
                ParamCollInput.Add(new KeyValuePair <string, object>("@RoleNamesSelected", RoleNamesSelected));
                ParamCollInput.Add(new KeyValuePair <string, object>("@PortalID", PortalID));
                sagesql.ExecuteNonQuery(sp, ParamCollInput);

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Connect to database and add user in role.
        /// </summary>
        /// <param name="user">Object of UserInfo class.</param>
        /// <returns>True for add user in role successfully.</returns>
        public static bool AddUserInRoles(UserInfo obj)
        {
            string             sp      = "[dbo].[usp_sf_UserInRolesAdd]";
            SageFrameSQLHelper sagesql = new SageFrameSQLHelper();

            try
            {
                List <KeyValuePair <string, object> > ParamCollInput = new List <KeyValuePair <string, object> >();
                ParamCollInput.Add(new KeyValuePair <string, object>("@ApplicationName", obj.ApplicationName));
                ParamCollInput.Add(new KeyValuePair <string, object>("@UserID", obj.UserID));
                ParamCollInput.Add(new KeyValuePair <string, object>("@RoleNames", obj.RoleNames));
                ParamCollInput.Add(new KeyValuePair <string, object>("@PortalID", obj.PortalID));

                sagesql.ExecuteNonQuery(sp, ParamCollInput);


                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }