Ejemplo n.º 1
0
 public static List <BanIpHistory> Get(string zoneId, string ip = null)
 {
     try
     {
         return(BanIpHistoryAccess.Get(zoneId, ip));
     }
     catch (Exception ex)
     {
         var zoneTableId = ZoneAccess.GetZoneByZoneId(zoneId).TableID;
         AuditLogBusiness.Add(new AuditLogEntity(zoneTableId, LogLevel.Error,
                                                 $"Get ban ip histories failure, the reason is:[{ex.Message}].<br />stack trace:{ex.StackTrace}."));
         return(new List <BanIpHistory>());
     }
 }
Ejemplo n.º 2
0
 public static bool Delete(string zoneId, int id)
 {
     try
     {
         return(BanIpHistoryAccess.Delete(id));
     }
     catch (Exception ex)
     {
         var zoneTableId = ZoneAccess.GetZoneByZoneId(zoneId).TableID;
         AuditLogBusiness.Add(new AuditLogEntity(zoneTableId, LogLevel.Error,
                                                 $"delete ban ip histories failure, the reason is:[{ex.Message}].<br />stack trace:{ex.StackTrace}."));
         return(false);
     }
 }
Ejemplo n.º 3
0
 public static bool Add(BanIpHistory banIpHistory)
 {
     try
     {
         var banIpHistories = BanIpHistoryAccess.Get(banIpHistory.ZoneId, banIpHistory.IP);
         if (null != banIpHistories && banIpHistories.Count > 0)
         {
             return(BanIpHistoryAccess.Update(banIpHistory));
         }
         else
         {
             return(BanIpHistoryAccess.Add(banIpHistory));
         }
     }
     catch (Exception ex)
     {
         var zoneTableId = ZoneAccess.GetZoneByZoneId(banIpHistory.ZoneId).TableID;
         AuditLogBusiness.Add(new AuditLogEntity(zoneTableId, LogLevel.Error,
                                                 $"Add ban ip histories failure, the reason is:[{ex.Message}].<br />stack trace:{ex.StackTrace}."));
         return(false);
     }
 }
Ejemplo n.º 4
0
 public static void AddList(List <BanIpHistory> banIpHistory)
 {
     BanIpHistoryAccess.Add(banIpHistory);
 }