Exemplo n.º 1
0
 public static void WriteGeneralException(string Controller, string Method, int Uid, String Values, string Type = "Exception")
 {
     try
     {
         var mth = new StackTrace().GetFrame(1).GetMethod();
         Controller = Controller + " / " + mth.ReflectedType.Name;
         Method     = Method + " / " + mth.Name;
         AngleDBDataContext context = new AngleDBDataContext();
         TblException       Ex      = new TblException
         {
             Controller = Controller,
             Method     = Method,
             DateTime   = CustDateTime.GetCurrentDateTime(),
             TypeName   = Type,
             Message    = "Custome Error Occur",
             C_Id       = Uid,
             StackTrace = Values,
             Website    = "Dx"
         };
         context.TblExceptions.InsertOnSubmit(Ex);
         context.SubmitChanges();
     }
     catch (Exception ex1)
     {
         WriteExceptionInFile(ex1, "UtilityClass", "WriteException");
     }
 }
Exemplo n.º 2
0
 public static void WriteException(Exception ex, string Controller, string Method, int Uid = 0, string ServerURl = "", string Ip = "", string UserIdentity = "", string Parameters = "")
 {
     try
     {
         var mth = new System.Diagnostics.StackTrace().GetFrame(1).GetMethod();
         Controller = Controller + " / " + mth.ReflectedType.Name;
         Method     = Method + " / " + mth.Name;
         AngleDBDataContext context = new AngleDBDataContext();
         //string na = this.GetType().Name;
         while (ex != null)
         {
             TblException Ex = new TblException
             {
                 Controller   = Controller,
                 Method       = Method,
                 DateTime     = CustDateTime.GetCurrentDateTime(),
                 TypeName     = ex.GetType().FullName,
                 Message      = ex.Message,
                 StackTrace   = Parameters == "" ? ex.StackTrace : Parameters,
                 C_Id         = Uid,
                 ServerUrl    = ServerURl,
                 Ip           = Ip,
                 userIdentity = UserIdentity,
                 Website      = "Dx"
             };
             ex = ex.InnerException;
             context.TblExceptions.InsertOnSubmit(Ex);
         }
         context.SubmitChanges();
     }
     catch (Exception ex1)
     {
         WriteExceptionInFile(ex, Controller, Method);
         WriteExceptionInFile(ex1, "UtilityClass", "WriteException");
     }
 }