Example #1
0
 public static void AddException(tb_logs tb_log)
 {
     try
     {
         using (var context = new JobAppDBEntities())
         {
             if (tb_log.log_id == 0)
             {
                 context.tb_logs.Add(tb_log);
             }
             else
             {
                 var log = context.tb_logs.Find(tb_log.log_id);
                 if (log != null)
                 {
                     log.function_name     = tb_log.function_name;
                     log.stack_trace       = tb_log.stack_trace;
                     log.trace_data        = string.IsNullOrEmpty(tb_log.trace_data) ? (tb_log.description ?? "") : tb_log.trace_data;
                     log.error_code        = tb_log.error_code;
                     log.error_description = tb_log.error_description;
                     log.created_on        = DateTime.UtcNow;
                     log.status            = "F";
                 }
             }
             context.SaveChanges();
         }
     }
     catch (Exception)
     {
     }
 }
Example #2
0
 public static long AddLog(tb_logs log)
 {
     try
     {
         using (var context = new JobAppDBEntities())
         {
             log.transaction_ref_id = log.transaction_ref_id ?? DateTime.UtcNow.Ticks.ToString();
             log.created_on         = DateTime.UtcNow;
             log.status             = "S";
             var header = context.tb_logs.Add(log);
             context.SaveChanges();
             return(header.log_id);
         }
     }
     catch (Exception)
     {
         return(-1);
     }
 }