Exemplo n.º 1
0
        public static CustomCollection <Boss> SelectAllEmployeeBosses()
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();

            DatabaseUtility.SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_CUSTOM_EMPLOYEES_GETALLEMPLOYEEBOSSES);
            GenerateCollectionFromReader test          = new GenerateCollectionFromReader(GenerateBossCollectionFromReader);
            CustomCollection <Boss>      objCollection = ((CustomCollection <Boss>)DatabaseUtility.ExecuteReaderCmd(sqlCmd, test));

            return(objCollection);
        }
Exemplo n.º 2
0
        public static Boss GetEmployeeBossByEmployeeId(int employeeId)
        {
            if (employeeId < GetIdMinValue)
            {
                throw (new ArgumentOutOfRangeException("employeeId"));
            }

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();

            DatabaseUtility.AddParameterToSqlCmd(sqlCmd, "@employeeId", SqlDbType.Int, 0, ParameterDirection.Input, employeeId);
            DatabaseUtility.SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_CUSTOM_EMPLOYEES_GETEMPLOYEEBOSSBYEMPLOYEEID);
            GenerateCollectionFromReader test          = new GenerateCollectionFromReader(GenerateBossCollectionFromReader);
            CustomCollection <Boss>      objCollection = ((CustomCollection <Boss>)DatabaseUtility.ExecuteReaderCmd(sqlCmd, test));

            if (objCollection.Count > 0)
            {
                return(objCollection[0]);
            }
            else
            {
                return(null);
            }
        }