Exemplo n.º 1
0
        public static string TrySignIn(string username, string password)
        {
            string sp   = "sp_TrySignIn";
            string Role = "Invalid";

            if (!(string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)))
            {
                String EncryptedPassword = PortalEncryption.Encrypt(password);
                string connstring        = Connection.GetConnectionString();

                using (SqlConnection dbCon = new SqlConnection(connstring))
                {
                    dbCon.Open();

                    using (SqlCommand dbCom = new SqlCommand(sp, dbCon))
                    {
                        dbCom.CommandType = CommandType.StoredProcedure;
                        dbCom.Parameters.Add("@username", SqlDbType.VarChar).Value = username;
                        dbCom.Parameters.Add("@password", SqlDbType.VarChar).Value = EncryptedPassword;
                        using (SqlDataReader wizReader = dbCom.ExecuteReader())
                        {
                            while (wizReader.Read())
                            {
                                Role = (string)wizReader["Roles"];
                            }
                        }
                    }
                }
            }

            return(Role);
        }
Exemplo n.º 2
0
        public static bool ModifyPassword(string UserName, string OldPassword, string NewPassword)
        {
            string EncryptedNewPassword   = PortalEncryption.Encrypt(NewPassword);
            string EncryptedOldPassword   = PortalEncryption.Encrypt(OldPassword);
            List <SqlParameter> paramList = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@OldPassword",
                    Value         = EncryptedOldPassword
                },
                new SqlParameter()
                {
                    ParameterName = "@NewPassword",
                    Value         = EncryptedNewPassword
                },
                new SqlParameter()
                {
                    ParameterName = "@UserName",
                    Value         = UserName
                }
            };

            return(ExecuteSP(StoredProcedure.USP_MODIFYPASSWORD, paramList));
        }
Exemplo n.º 3
0
        public static Users CandidateSignUp(Users USROBJ)
        {
            Users  Usr = new Users();
            String EncryptedPassword = PortalEncryption.Encrypt(USROBJ.Password);
            String connstring        = Connection.GetConnectionString();

            using (SqlConnection dbCon = new SqlConnection(connstring))
            {
                dbCon.Open();

                using (SqlCommand dbCom = new SqlCommand(StoredProcedure.USP_SIGNUP, dbCon))
                {
                    dbCom.CommandType = CommandType.StoredProcedure;
                    dbCom.Parameters.AddWithValue(UserName, USROBJ.Username);
                    dbCom.Parameters.AddWithValue(UserMobile, USROBJ.Mobile);
                    dbCom.Parameters.AddWithValue(UserEmail, USROBJ.Email);
                    dbCom.Parameters.AddWithValue(UserPassword, EncryptedPassword);

                    using (SqlDataReader wizReader = dbCom.ExecuteReader())
                    {
                        while (wizReader.Read())
                        {
                            Usr.Success = Convert.ToInt32(wizReader["Success"]);
                            Usr.Message = Convert.ToString(wizReader["Message"]);
                        }
                    }
                }
                return(Usr);
            }
        }
Exemplo n.º 4
0
        public static bool ChangeUserPasswordViaReset(String GUID, String PasswordValue)
        {
            string EncryptedPassword      = PortalEncryption.Encrypt(PasswordValue);
            List <SqlParameter> paramList = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@GUID",
                    Value         = GUID
                },
                new SqlParameter()
                {
                    ParameterName = "@Password",
                    Value         = EncryptedPassword
                }
            };

            return(ExecuteSP(StoredProcedure.USP_CHANGEPASSWORDVIARESET, paramList));
        }