Esempio n. 1
0
        public static EApplication GetByName(EApplication _pdata, DBEngine DatabaseEngine)
        {
            SqlDataReader oReader = null;

            try
            {
                //Fill the request's parameters
                SqlParameter[] p_sqlParams = RegisterSqlParameter(_pdata);

                //Call the request
                oReader = DatabaseEngine.ExecuteReader(CommandType.StoredProcedure, CCstDatabase.SP_Application_GetByName, p_sqlParams);

                //If there is a result (not null)
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        //Read the data and convert the SqlDataReader in the waiting object
                        return(ReadData(oReader));
                    }
                }
                return(null);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (oReader != null && !oReader.IsClosed)
                {
                    oReader.Close();
                }
            }
        }
Esempio n. 2
0
        public static ECollectionLoggerType GetList()
        {
            SqlDataReader oReader = null;

            try
            {
                //Initialize the return object
                ECollectionLoggerType oCollData = new ECollectionLoggerType();

                //Call the request
                using (DBEngine DBInstance = CCstData.GetInstance("").DatabaseEngine)
                {
                    oReader = DBInstance.ExecuteReader(CommandType.StoredProcedure, CCstDatabase.SP_LoggerType_GetList);
                }



                //If there is a result (not null)
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        ELoggerType oData = new ELoggerType();
                        //Read the data and convert the SqlDataReader in the waiting object
                        oData = ReadData(oReader);
                        //Add the data to the return list
                        oCollData.Add(oData);
                    }
                }
                return(oCollData);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (oReader != null && !oReader.IsClosed)
                {
                    oReader.Close();
                }
            }
        }