예제 #1
0
    /// <summary>
    /// Create an SQL string of the number of people within a certain age bracket.
    /// </summary>
    /// <param name="startage"></param>
    /// <param name="endage"></param>
    /// <returns></returns>
    private static string getCountOfAge(string startage, string endage)
    {
        string sqlString = @"Select count(*) from UserAccount
WHERE Datediff(YEAR,CONVERT(DATETIME,CONVERT(VARCHAR(64), DECRYPTBYPASSPHRASE('P@SSW04D', UserAccount.DOB)),111),GETDATE()) >=" + startage + " AND  Datediff(YEAR,CONVERT(DATETIME,CONVERT(VARCHAR(64), DECRYPTBYPASSPHRASE('P@SSW04D', UserAccount.DOB)),111),GETDATE()) <" + endage;

        return(SQLAdapter.getCount(sqlString));
    }
예제 #2
0
    /// <summary>
    /// Gets the amount of employees which fall within a specific salary range
    /// </summary>
    /// <param name="startSalary">Starting salary range</param>
    /// <param name="endSalary">Ending salary range</param>
    /// <returns></returns>
    private static string getCountOfSalary(string startSalary, string endSalary)
    {
        string SQLString = @"SELECT COUNT(*) FROM UserAccount WHERE CAST(CONVERT(VARCHAR(50), DECRYPTBYPASSPHRASE('P@SSW04D', Salary))AS INT) >=" + startSalary + " AND CAST(CONVERT(VARCHAR(50), DECRYPTBYPASSPHRASE('P@SSW04D', Salary))AS INT) <" + endSalary;

        return(SQLAdapter.getCount(SQLString));
    }