Пример #1
0
        private bool IsUsernamePresent(AuthTable authUser, string connString)
        {
            SqlParameter pUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50);
            SqlParameter pResult = new SqlParameter("@Result", SqlDbType.Bit);

            pResult.Direction = ParameterDirection.Output;
            pUsername.Value = authUser.Username;

            SqlCommand cmdSQL = new SqlCommand();
            cmdSQL.CommandType = CommandType.StoredProcedure;
            cmdSQL.CommandText = "usp_IsUsernamePresent";

            cmdSQL.Parameters.Add(pUsername);
            cmdSQL.Parameters.Add(pResult);

            DataLayer dataLayerObj = new DataLayer();
            cmdSQL = dataLayerObj.Select(cmdSQL, connString);

            bool numUser = bool.Parse(pResult.Value.ToString());
            return numUser;
        }
Пример #2
0
        public bool IsRegisteredUser(AuthTable user, string connString)
        {
            SqlParameter pUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50);
            SqlParameter pPassword = new SqlParameter("@Password", SqlDbType.NVarChar, 50);
            SqlParameter pResult = new SqlParameter("@Result", SqlDbType.Bit);

            pUsername.Value = user.Username;
            pPassword.Value = user.Password;
            pResult.Direction = ParameterDirection.Output;

            SqlCommand cmdSQL = new SqlCommand();
            cmdSQL.CommandType = CommandType.StoredProcedure;
            cmdSQL.CommandText = "usp_ValidateUserPassword";
            cmdSQL.Parameters.Add(pUsername);
            cmdSQL.Parameters.Add(pPassword);
            cmdSQL.Parameters.Add(pResult);

            DataLayer dataLayerObj = new DataLayer();
            cmdSQL = dataLayerObj.Select(cmdSQL, connString);
            return bool.Parse(pResult.Value.ToString());
        }