Esempio n. 1
0
 public void Post(ErrorLog log)
 {
     if (ModelState.IsValid)
     {
         LogDA.Insert(log);
     }
 }
Esempio n. 2
0
        private void LogError(string exMsg)
        {
            try
            {
                #region *** Get Class Name & Method Name ***
                System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
                string methodName = "", className = "";

                int indxStack = 1;

                while (methodName == "" || methodName == "SetError")
                {
                    methodName = st.GetFrame(indxStack).GetMethod().Name;
                    className  = st.GetFrame(indxStack).GetMethod().DeclaringType.FullName;
                    indxStack++;
                }
                exMsg += "\r\n\r\n Class : " + className +
                         "\r\n\r\n Method : " + methodName;

                #endregion

                Log   log = new Log();
                LogDA logDA = new LogDA();
                log.ExceptionMessage = exMsg;
                logDA.Insert(log);
            }
            catch (System.Exception exc)
            {
                AddFileException(exc);
            }
        }