Esempio n. 1
0
        public G_User Login(string email, string passwd)
        {
            Commands cmd = new Commands("TSP_AuthUser", true);

            cmd.AddParameter("@Email", email);
            cmd.AddParameter("@Passwd", passwd);

            return(_connexion.ExecuteReader(cmd, dr => dr.ToUtilisateur()).SingleOrDefault());
        }
        public bool AddUserToRole(int UserId, int RoleId)
        {
            Commands command = new Commands("identity_AddUserToRole", true);

            command.AddParameter("@UserId", UserId);
            command.AddParameter("@RoleId", RoleId);

            return(_connection.ExecuteNonQuery(command) == 1);
        }
Esempio n. 3
0
        public IdentityResult Create(Roles role)
        {
            Commands command = new Commands("identity_InsertRole", true);

            command.AddParameter("@Name ", role.Name);
            command.AddParameter("@Description ", role.Description);
            command.AddParameter("@Created", role.Created);

            _connection.ExecuteNonQuery(command);

            return(IdentityResult.Success);
        }
Esempio n. 4
0
        public IdentityResult CreateUser(Utilisateurs user)
        {
            Commands command = new Commands("Identity_InsertUser", true);

            command.AddParameter("@Lastname", user.LastName);
            command.AddParameter("@FirstName", user.FirstName);
            command.AddParameter("@Email", user.Email);
            command.AddParameter("@Passwd", user.Passwd);
            command.AddParameter("@Genre", user.Genre);

            _connection.ExecuteNonQuery(command);

            return(IdentityResult.Success);
        }
Esempio n. 5
0
        public bool Register(G_User user)
        {
            Commands cmd = new Commands("TSP_register", true);

            cmd.AddParameter("@LastName", user.LastName);
            cmd.AddParameter("@FirstName", user.FirstName);
            cmd.AddParameter("@Email", user.Email);
            cmd.AddParameter("@Passwd", user.Passwd);
            cmd.AddParameter("@Genre", user.Genre);

            int rows = _connexion.ExecuteNonQuery(cmd);

            user.Passwd = null;
            return(rows == 1);
        }
Esempio n. 6
0
        public Utilisateurs FindById(string userId)
        {
            Commands command = new Commands("identity_FindById", true);

            command.AddParameter("@Id", Convert.ToInt32(userId));
            return(_connection.ExecuteReader(command, sp => sp.ToUtilisateur()).SingleOrDefault());
        }
Esempio n. 7
0
        public Utilisateurs FindByEmail(string normalizedEmail)
        {
            Commands command = new Commands("identity_FindByEmail", true);

            command.AddParameter("@Email", normalizedEmail);
            return(_connection.ExecuteReader(command, sp => sp.ToUtilisateur()).SingleOrDefault());
        }
Esempio n. 8
0
        public Roles FindByName(string normalizedRoleName)
        {
            Commands command = new Commands("identity_FindRoleByName", true);

            command.AddParameter("@NormalizedRoleName", normalizedRoleName);

            return(_connection.ExecuteReader(command, sp => sp.ToRole()).SingleOrDefault());
        }