예제 #1
0
        public List<BAgentRoute> FindTaocans(int agencyId, string sp, string province, BitScope scope, bool? enable = null)
        {
            if (agencyId <= 0)
            {
                if (CurrentLoginUser != null)
                {
                    agencyId = CurrentLoginUser.User.Id;
                }
            }
            AgentAdminMenagement agentAdminMgt = new AgentAdminMenagement(this.CurrentLoginUser);

            int total = 0;
            List<BAgentRoute> routes = agentAdminMgt.FindRoutes(0, agencyId, 0, 0, out total, enable);
            //根据资源对号码归属省的限制
            routes = (from r in routes where r.Taocan.NumberProvince == null || (r.Taocan.NumberProvince.Name.Contains(province)) select r).ToList<BAgentRoute>();

            List<BAgentRoute> globalRoutes = (from r in routes where r.Taocan.SP == null select r).ToList<BAgentRoute>();
            List<BAgentRoute> spRoutes = new List<BAgentRoute>();
            List<BAgentRoute> returnRoutes = new List<BAgentRoute>();
            if (!string.IsNullOrEmpty(sp))
            {
                spRoutes = (from r in routes where r.Taocan.SP != null && r.Taocan.SP.Name == sp select r).ToList<BAgentRoute>();
            }
            globalRoutes = globalRoutes.Concat<BAgentRoute>(spRoutes).ToList<BAgentRoute>();
            returnRoutes = globalRoutes;
            if (scope == BitScope.Local)
            {
                //本地流量
                returnRoutes = (from r in globalRoutes
                                where
                                 (
                                 r.Taocan.Province != null && r.Taocan.Province.Name.Contains(province))
                                 //||
                                 //(r.Taocan.NumberProvince != null && r.Taocan.NumberProvince.Name.Contains(province)))
                                select r).ToList<BAgentRoute>();
            }
            else if (scope == BitScope.Global)
            {
                returnRoutes = (from r in globalRoutes
                                where
                                 (r.Taocan.Province == null)
                                select r).ToList<BAgentRoute>();
            }

            return returnRoutes;
        }
예제 #2
0
 public List<BAgentRoute> FindTaocans(int routeId,bool? enable=null)
 {
     List<BAgentRoute> taocans = new List<BAgentRoute>();
     AgentAdminMenagement agentAdminMgt = new AgentAdminMenagement(this.CurrentLoginUser);
     int total = 0;
     taocans = agentAdminMgt.FindRoutes(routeId, CurrentLoginUser.User.Id, 0, 0, out total, enable);
     return taocans;
 }