public static IEnumerable <TEntity> QueryLastDate <TEntity>(this MongoDbRepositoryBase <TEntity, ObjectId> repository,
                                                                    string cellId, DateTime begin, DateTime end)
            where TEntity : class, IStatDateCell, IEntity <ObjectId>
        {
            var query =
                MongoDB.Driver.Builders.Query <TEntity> .Where(
                    e => e.CellId == cellId && e.StatDate >= begin && e.StatDate < end);

            return(repository.QueryCursor(query));
        }
        public static List <TEntity> QueryRecentList <TEntity>(this MongoDbRepositoryBase <TEntity, ObjectId> repository,
                                                               int eNodebId)
            where TEntity : class, IZteMongo, IEntity <ObjectId>
        {
            var query =
                MongoDB.Driver.Builders.Query <TEntity> .Where(e => e.eNodeB_Id == eNodebId);

            var list       = repository.QueryCursor(query);
            var recentDate = list.Max(x => x.iDate);

            return(list.Where(x => x.iDate == recentDate).ToList());
        }
        public static TEntity QueryZteRecent <TEntity>(this MongoDbRepositoryBase <TEntity, ObjectId> repository,
                                                       int eNodebId)
            where TEntity : class, IZteMongo, IEntity <ObjectId>
        {
            var query =
                MongoDB.Driver.Builders.Query <TEntity> .EQ(e => e.eNodeB_Id, eNodebId);

            var list       = repository.QueryCursor(query);
            var recentDate = list.Max(x => x.iDate);

            return(list.FirstOrDefault(x => x.iDate == recentDate));
        }
        public static TEntity QueryRecent <TEntity>(this MongoDbRepositoryBase <TEntity, ObjectId> repository,
                                                    int eNodebId, byte sectorId)
            where TEntity : class, IZteMongo, IEntity <ObjectId>
        {
            var query =
                MongoDB.Driver.Builders.Query <TEntity> .Where(
                    e => e.eNodeB_Id == eNodebId && e.description == "cellLocalId=" + sectorId);

            var list       = repository.QueryCursor(query);
            var recentDate = list.Max(x => x.iDate);

            return(list.FirstOrDefault(x => x.iDate == recentDate));
        }
        public static List <TEntity> QueryReverseList <TEntity>(this MongoDbRepositoryBase <TEntity, ObjectId> repository,
                                                                int destENodebId, byte destSectorId)
            where TEntity : class, IHuaweiNeighborMongo, IEntity <ObjectId>
        {
            var query =
                MongoDB.Driver.Builders.Query <TEntity> .Where(
                    e => e.eNodeBId == destENodebId && e.CellId == destSectorId);

            var list       = repository.QueryCursor(query);
            var recentDate = list.Max(x => x.iDate);

            return(list.Where(x => x.iDate == recentDate).ToList());
        }