Esempio n. 1
0
        private void DoLog(enumLogType logType, object data)
        {
            switch (logType)
            {
            case enumLogType.Info:
                if (data == null)
                {
                    return;
                }
                txtLog.AppendText(string.Format(cstInfoString, GetCurrentTime(), data.ToString()));
                txtLog.AppendText("\n");
                Application.DoEvents();
                break;

            case enumLogType.Result:
                if (data == null)
                {
                    return;
                }
                txtLog.AppendText(string.Format(cstResultString, GetCurrentTime(), data.ToString()));
                txtLog.AppendText("\n");
                Application.DoEvents();
                break;

            case enumLogType.Waring:
                if (data == null)
                {
                    return;
                }
                txtLog.AppendText(string.Format(cstWarningString, GetCurrentTime(), data.ToString()));
                txtLog.AppendText("\n");
                Application.DoEvents();
                break;

            case enumLogType.Error:
                if (data == null)
                {
                    return;
                }
                txtLog.AppendText(string.Format(cstErrorString, GetCurrentTime(), data.ToString()));
                txtLog.AppendText("\n");
                Application.DoEvents();
                break;

            case enumLogType.Exception:
                if (data == null)
                {
                    return;
                }
                txtLog.AppendText(string.Format(cstExceptionString, GetCurrentTime(), (data as Exception).Message));
                txtLog.AppendText("\n");
                txtLog.SelectionStart = txtLog.Text.Length;
                Application.DoEvents();
                break;
            }
        }
Esempio n. 2
0
 public static bool API_Log_Insert(enumAction ActionType, enumLogType LogType, enumLogType InnerLogType,
                                   string MSG, string MSG2, string ERROR, bool Critical,
                                   string refferer, string ip, string ua,
                                   ref DateTime CreateDate,
                                   ref DateTime CreateDateISR, ref Guid APITransaction, bool useq, string identifier, enumProject Project
                                   )
 {
     try
     {
         using (DogAndCatDBDataContext db = new DogAndCatDBDataContext(Connection())
         {
             CommandTimeout = 120
         })
         {
             db.API_Log_Insert((int)ActionType, (int)LogType, (int)InnerLogType, MSG, MSG2, ERROR, Critical,
                               refferer, ip, ua,
                               CreateDate, CreateDateISR, APITransaction, "", identifier, (int)Project);
         }
         return(true);
     }
     catch (Exception ex1)
     {
         try
         {
             using (DogAndCatDBDataContext db = new DogAndCatDBDataContext(Connection())
             {
                 CommandTimeout = 120
             })
             {
                 db.API_Log_Insert((int)ActionType, (int)LogType, (int)InnerLogType, MSG, MSG2, ERROR, Critical,
                                   refferer, ip, ua,
                                   CreateDate, CreateDateISR, APITransaction, "", identifier, (int)Project);
             }
             return(true);
         }
         catch (Exception ex2)
         {
         }
     }
     return(false);
 }
Esempio n. 3
0
        public bool Log(enumLogType eltLogType, string smodname, string action, string comment)
        {
            if (m_datatable == null)
            {
                m_adp = new SqlDataAdapter("SELECT * FROM sys_user_log WHERE (id = (SELECT Max(id) FROM sys_user_log))", MainForm.conn);
                m_adp.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                DataSet ds = new DataSet();
                m_adp.Fill(ds);
                m_datatable = ds.Tables[0];
            }
            else
            {
                m_adp.Fill(m_datatable);
            }
            string   shostname = Helper.GetHostName();
            DateTime dtStart, dtEnd;

            if (eltLogType == enumLogType.ltstart)
            {
                dtStart = DateTime.Now;
                dtEnd   = DateTime.MinValue;
            }
            else
            {
                dtStart = DateTime.MinValue;
                dtEnd   = DateTime.Now;
            }
            if (m_findkey == null)
            {
                NewRow(Helper.GetIPAddress(), shostname, shostname, dtStart, dtEnd, smodname, action, comment);
            }
            else
            {
                EditRow(Helper.GetIPAddress(), shostname, shostname, dtStart, dtEnd, smodname, action, comment);
            }
            return(true);
        }
Esempio n. 4
0
 public bool Log(enumLogType eltLogType, string smodname, string action, string comment)
 {
     if (m_datatable == null)
     {
         m_adp = new SqlDataAdapter("SELECT * FROM sys_user_log WHERE (id = (SELECT Max(id) FROM sys_user_log))", MainForm.conn);
         m_adp.MissingSchemaAction = MissingSchemaAction.AddWithKey;
         DataSet ds = new DataSet();
         m_adp.Fill(ds);
         m_datatable = ds.Tables[0];
     }
     else
     {
         m_adp.Fill(m_datatable);
     }
     string shostname = Helper.GetHostName();
     DateTime dtStart, dtEnd;
     if (eltLogType == enumLogType.ltstart)
     {
         dtStart = DateTime.Now;
         dtEnd = DateTime.MinValue;
     }
     else
     {
         dtStart = DateTime.MinValue;
         dtEnd = DateTime.Now;
     }
     if (m_findkey == null)
     {
         NewRow(Helper.GetIPAddress(), shostname, shostname, dtStart, dtEnd, smodname, action, comment);
     }
     else
     {
         EditRow(Helper.GetIPAddress(), shostname, shostname, dtStart, dtEnd, smodname, action, comment);
     }
     return true;
 }
Esempio n. 5
0
 public void AppendMessage(enumLogType logType, string strMsg)
 {
     Utility.Log.AppendMessage(logType, strMsg);
 }
Esempio n. 6
0
 public void Append(enumLogType logType, string strContents)
 {
     Utility.Log.Append(logType, strContents);
 }
Esempio n. 7
0
 public void AppendMessage(enumLogType logType, string strMsg)
 {
     Utility.Log.AppendMessage(logType, strMsg);
 }
Esempio n. 8
0
 public void Append(enumLogType logType, string strContents)
 {
     Utility.Log.Append(logType, strContents);
 }