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;
         }
     }
 }