Beispiel #1
0
        public static SecurityLevel GetSecurityLevelBySecurityLevelId(int securityLevelId)
        {
            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetSecurityLevelBySecurityLevelId";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "@SecurityLevelId", DbType.Int32, securityLevelId);
            db.AddOutParameter(dbCommand, "@Description", DbType.String, 50);
            db.ExecuteNonQuery(dbCommand);
            SecurityLevel securityLevel = new SecurityLevel();

            securityLevel.SecurityLevelId = securityLevelId;
            securityLevel.Description     = db.GetParameterValue(dbCommand, "Description").ToString();
            return(securityLevel);
        }
Beispiel #2
0
        public static List <SecurityLevel> GetSecurityLevelList()
        {
            List <SecurityLevel> list = new List <SecurityLevel>();

            Database  db         = DatabaseFactory.CreateDatabase("SPARInsightManagement");
            string    sqlCommand = "GetSecurityLevelList";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    SecurityLevel securityLevel = new SecurityLevel();
                    securityLevel.SecurityLevelId = Convert.ToInt32(dataReader["SecurityLevelId"]);
                    securityLevel.Description     = dataReader["Description"].ToString();
                    list.Add(securityLevel);
                }
            }
            return(list);
        }