Ejemplo n.º 1
0
 private void WriteLog(WriteInDiskLogfile writeLog, string message, int lineNum, Type errorType, string controlName)
 {
     try
     {
         Loginfo info = new Loginfo();
         info.ControlName   = controlName;
         info.ErrorLineNum  = lineNum;
         info.EventName     = message;
         info.MainName      = "GenericConnectionCore";
         info.ExceptionName = errorType.ToString();
         writeLog.Log(info);
     }
     catch (Exception ex)
     {
         writeLog.Log(string.Format("Error while attempting write in logfile.<-- {0} -->", ex.Message));
     }
 }
Ejemplo n.º 2
0
        public ICollection <T> Data <T>(IDbCommand command, IEntitySetting entity)
        {
            WriteInDiskLogfile writeLog = new WriteInDiskLogfile();

            try
            {
                IDataReader reader = processData.ExecuteCommand(command);
                writeLog.Log("Successful data list return");
                return(new List <T>(processData.ReadData <T>(reader, entity)));
            }
            catch (Exception ex)
            {
                WriteLog(writeLog, "Error while attempting to extract data list", 73, ex.GetType(), "Method <Data>");
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public virtual DataTable GetTable(string sql, IDbConnection connection)
        {
            WriteInDiskLogfile writeLog = new WriteInDiskLogfile();

            try
            {
                IDataReader reader = processData.ExecuteCommand(sql, connection);
                writeLog.Log("Successful data table return");
                return(processData.ReadData(reader));
            }
            catch (Exception ex)
            {
                WriteLog(writeLog, "Error while attempting to extract data table", 53, ex.GetType(), "Method <GetTable>");
                throw new Exception(ex.Message);
            }
            finally
            {
                connection.Close();
                connection.Dispose();
            }
        }
Ejemplo n.º 4
0
        public virtual ICollection <T> Data <T>(string sql, IEntitySetting entity, IDbConnection connection)
        {
            WriteInDiskLogfile writeLog = new WriteInDiskLogfile();

            try
            {
                IDataReader reader = processData.ExecuteCommand(sql, connection);
                writeLog.Log("Successful data extraction process");
                return(new List <T>(processData.ReadData <T>(reader, entity)));
            }
            catch (Exception ex)
            {
                WriteLog(writeLog, "Error in data extraction event", 12, ex.GetType(), "Method <Data>");
                throw new Exception(ex.Message);
            }
            finally
            {
                connection.Close();
                connection.Dispose();
            }
        }
Ejemplo n.º 5
0
        public virtual List <Dictionary <string, object> > GetDictionary(string sql, IDbConnection connection)
        {
            WriteInDiskLogfile writeLog = new WriteInDiskLogfile();

            try
            {
                IDataReader reader = processData.ExecuteCommand(sql, connection);
                writeLog.Log("Successful data extraction process");
                return(processData.ReadDataHowDictionary(reader));
            }
            catch (Exception ex)
            {
                WriteLog(writeLog, "Error in data extraction event", 12, ex.GetType(), "Method <Data>");
                throw new Exception(ex.Message);
            }
            finally
            {
                connection.Close();
                connection.Dispose();
            }
        }