protected override IEnumerable <VIPCard> SearchData()
        {
            var lp   = VMGlobal.DistributionQuery.LinqOP;
            var data = lp.Search <VIPCard>(o => o.OrganizationID == VMGlobal.CurrentUser.OrganizationID).Select(o => new VIPCardBO(o)
            {
                BirthdayMD = new DateTime(DateTime.Now.Year, o.Birthday.Month, o.Birthday.Day)//该语法可行,看来条件貌似一定要显式赋值,在属性get块内写这段逻辑就会报错
            });
            var filtedData = (IQueryable <VIPCardBO>)data.Where(FilterDescriptors);
            var result     = filtedData.ToList();

            VIPCardVM.ApplyVIPKind(result);
            return(result);
        }
Exemple #2
0
        protected override IEnumerable <VIPCard> SearchData()
        {
            List <VIPCardBO> vips = null;

            if (!FilterConditionHelper.IsConditionSetted(FilterDescriptors, "KindID"))
            {
                vips = base.SearchData().Select(o => new VIPCardBO(o)).ToList();
            }
            else
            {
                var cards = LinqOP.GetDataContext <VIPCard>();
                var maps  = LinqOP.GetDataContext <VIPCardKindMapping>();
                var data  = from card in cards
                            from map in maps
                            where card.ID == map.CardID
                            select new VIPCardEntityForSearch
                {
                    Birthday     = card.Birthday,
                    Code         = card.Code,
                    CustomerName = card.CustomerName,
                    KindID       = map.KindID,
                    Sex          = card.Sex,
                    MobilePhone  = card.MobilePhone,
                    ID           = card.ID
                };
                var filteredData = (IQueryable <VIPCardEntityForSearch>)data.Where(FilterDescriptors);
                var vids         = filteredData.Select(o => o.ID).Distinct().ToArray();
                var result       = cards.Where(o => vids.Contains(o.ID));
                TotalCount = result.Count();
                vips       = result.OrderBy(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize).Select(o => new VIPCardBO(o)).ToList();
            }
            VIPCardVM.ApplyVIPKind(vips);
            vips.ForEach(o =>
            {
                if (!DownHierarchyOrganizationIDArray.Contains(o.OrganizationID))
                {
                    o.MobilePhone = "不可见";
                }
            });
            return(vips);
        }