public string AddFirewall(Cog.MLIAD.BusinessLogic.Associate.FirewallRequest firewall) { try { MLIADService.SetNoCache(); return(repository.AddFirewall(firewall)); } catch (Exception ex) { throw ex; } }
public string EditFirewall(Cog.MLIAD.BusinessLogic.Associate.FirewallRequest firewall) { try { MLIADService.SetNoCache(); string retval = "failure"; if (firewall.oper == "edit") { retval = repository.EditFirewall(firewall); } else if (firewall.oper == "delete") { retval = repository.DeleteFirewall(firewall.id); } return(retval); } catch (Exception ex) { throw ex; } }
public List<Cog.MLIAD.BusinessLogic.Associate.FirewallRequest> SearchFirewall(Associate.FirewallRequest firewall, int pageIndex, int pageSize, ref int? count) { using (AssociateConnDataContext asscon = new AssociateConnDataContext()) { try { Cog.MLIAD.BusinessLogic.Associate.FirewallRequest retval = new Cog.MLIAD.BusinessLogic.Associate.FirewallRequest(); var firewalls = (from f in asscon.SearchFirewall(firewall.Destination, firewall.ProjectID) select new Cog.MLIAD.BusinessLogic.Associate.FirewallRequest() { FirewallRequestID = f.FirewallRequestID, FirewallRequestDesc = f.FirewallRequestDesc, Destination = f.Destination, Source = f.Source, Port = f.Port, ProjectName = f.ProjectName } ).ToList<Cog.MLIAD.BusinessLogic.Associate.FirewallRequest>(); pageSize = (pageSize < 1 ? 10 : pageSize); pageIndex = (pageIndex < 0 ? 0 : pageIndex); count = firewalls.Count; if (count < pageSize) { pageIndex = 0; return firewalls; } else if (firewalls.Count < pageSize * pageIndex) { pageIndex = 0; return new List<BusinessLogic.Associate.FirewallRequest>(firewalls.Take(pageSize)); } else { int a = Convert.ToInt32(((count - pageSize * pageIndex) >= pageSize) ? pageSize : (count - pageSize * pageIndex)); return new List<BusinessLogic.Associate.FirewallRequest>(firewalls.Skip(pageSize * pageIndex).Take(a)); } } catch (Exception ex) { throw ex; } } }
public Pager <Cog.MLIAD.BusinessLogic.Associate.FirewallRequest> SearchFirewall(Cog.MLIAD.BusinessLogic.Associate.FirewallRequest firewall, string page, string row, string totalcount) { try { int?count = 0; int pageIndex = Convert.ToInt32(page); int pageSize = Convert.ToInt32(row); Pager <Cog.MLIAD.BusinessLogic.Associate.FirewallRequest> pager = new Pager <Cog.MLIAD.BusinessLogic.Associate.FirewallRequest>(); MLIADService.SetNoCache(); List <Cog.MLIAD.BusinessLogic.Associate.FirewallRequest> firewalls = repository.SearchFirewall(firewall, (pageIndex - 1), pageSize, ref count); pager.Items = firewalls; pager.Page = pageIndex; pager.ItemCount = (count == null) ? 0 : Convert.ToInt32(count); pager.PageTotal = ((pager.ItemCount + pageSize - 1) / pageSize); pager.PageSize = pageSize; return(pager); } catch (Exception ex) { throw ex; } }