Ejemplo n.º 1
0
        private static void bwAsync_Worker(object sender, DoWorkEventArgs e)
        {
            while (true)
            {
                System.Threading.Thread.Sleep(300);

                try
                {
                    if (QueueLogRecord.Count > 0)
                    {
                        SanitaDataLogModel result = QueueLogRecord.Dequeue();

                        StringBuilder sql = new StringBuilder();
                        sql.Append(" INSERT INTO tblLogData (");
                        sql.Append("            LogApp,");
                        sql.Append("            LogUser,");
                        sql.Append("            SoftVersion,");
                        sql.Append("            LogTime,");
                        sql.Append("            IPAddress,");
                        sql.Append("            ComputerName,");
                        sql.Append("            LogValue) ");
                        sql.Append("  VALUES( " + DatabaseUtility.Escape(result.App) + ", ");
                        sql.Append("          " + DatabaseUtility.Escape(result.User) + ", ");
                        sql.Append("          " + DatabaseUtility.Escape(result.SoftVersion) + ", ");
                        sql.Append("          " + DatabaseUtility.Escape(result.LogTime) + ", ");
                        sql.Append("          " + DatabaseUtility.Escape(result.IPAddress) + ", ");
                        sql.Append("          " + DatabaseUtility.Escape(result.ComputerName) + ", ");
                        sql.Append("          " + DatabaseUtility.Escape(result.LogValue) + ") ");

                        // Assign new customer Id back to business object
                        baseDAO.DoInsert(sql.ToString());
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }