Пример #1
0
        protected override IEnumerable <OrganizationPriceFloat> SearchData()
        {
            var oids   = VMGlobal.ChildOrganizations.Select(o => o.ID);
            var opfs   = LinqOP.Search <OrganizationPriceFloat>(o => oids.Contains(o.OrganizationID));
            var byqs   = LinqOP.GetDataContext <ProBYQ>();
            var result = from opf in opfs
                         from byq in byqs
                         where opf.BYQID == byq.ID
                         select new OrganizationPriceFloatBO
            {
                BrandID        = byq.BrandID,
                Year           = byq.Year,
                Quarter        = byq.Quarter,
                BYQID          = byq.ID,
                ID             = opf.ID,
                CreateTime     = opf.CreateTime,
                CreatorID      = opf.CreatorID,
                FloatRate      = opf.FloatRate,
                LastNumber     = opf.LastNumber,
                OrganizationID = opf.OrganizationID
            };
            var filteredData = (IQueryable <OrganizationPriceFloatBO>)result.Where(FilterDescriptors);

            TotalCount = filteredData.Count();
            return(filteredData.OrderBy(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize).ToList());
        }
Пример #2
0
        protected override IEnumerable <RetailTactic> SearchData()
        {
            var tactics = LinqOP.GetDataContext <RetailTactic>();
            //if (!FilterConditionHelper.IsConditionSetted(condition, "OrganizationID"))
            //{
            var ds    = VMGlobal.SysProcessQuery.DB.ExecuteDataSet("GetOrganizationHierarchy", VMGlobal.CurrentUser.OrganizationID);
            var table = ds.Tables[0];

            if (table.Rows.Count > 0)
            {
                IEnumerable <int> os = table.ToList <OrganizationHierarchy>().Select(o => o.OrganizationID);
                tactics = tactics.Where(o => os.Contains(o.OrganizationID));
            }
            //}
            //if (!FilterConditionHelper.IsConditionSetted(condition, "BrandID"))
            //{
            IEnumerable <int> bs = VMGlobal.PoweredBrands.Select(o => o.ID);

            tactics = tactics.Where(o => bs.Contains(o.BrandID));
            //}
            var filteredData = (IQueryable <RetailTactic>)tactics.Where(FilterDescriptors);

            TotalCount = filteredData.Count();
            return(filteredData.OrderByDescending(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize).Select(o => new RetailTacticBO(o)).ToList());
        }
Пример #3
0
        protected override IEnumerable <TEntity> SearchData()
        {
            var all          = LinqOP.GetDataContext <TEntity>();
            var filteredData = (IQueryable <TEntity>)all.Where(FilterDescriptors);

            TotalCount = filteredData.Count();
            return(filteredData.OrderBy(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize).ToList());
        }
Пример #4
0
        protected override IEnumerable <ProStyle> SearchData()
        {
            var styles   = LinqOP.GetDataContext <ProStyle>();
            var brandIDs = VMGlobal.PoweredBrands.Select(o => o.ID);
            var byqs     = LinqOP.GetDataContext <ProBYQ>();
            var data     = from style in styles
                           from byq in byqs
                           where style.BYQID == byq.ID && brandIDs.Contains(byq.BrandID)
                           select new ProStyleBO
            {
                BoduanID   = style.BoduanID,
                BrandID    = byq.BrandID,
                BYQID      = style.BYQID,
                Code       = style.Code,
                CreateTime = style.CreateTime,
                CreatorID  = style.CreatorID,
                Flag       = style.Flag,
                ID         = style.ID,
                NameID     = style.NameID,
                //PictureUrl = style.PictureUrl,
                Price     = style.Price,
                CostPrice = style.CostPrice,
                Quarter   = byq.Quarter,
                UnitID    = style.UnitID,
                Year      = byq.Year
            };
            var temp = (IQueryable <ProStyleBO>)data.Where(FilterDescriptors);

            TotalCount = temp.Count();
            var result = temp.OrderBy(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize).ToList();

            foreach (var r in result)
            {
                //r.BoduanName = VMGlobal.Boduans.Find(o => o.ID == r.BoduanID).Name;
                //r.Name = VMGlobal.ProNames.Find(o => o.ID == r.NameID).Name;
                //r.UnitName = VMGlobal.Units.Find(o => o.ID == r.UnitID).Name;
                if (VMGlobal.CurrentUser.OrganizationID != 1)
                {
                    r.CostPrice = _fpHelper.GetFloatPrice(OrganizationListVM.CurrentOrganization.ParentID, r.BYQID, r.Price);
                    r.Price     = _fpHelper.GetFloatPrice(VMGlobal.CurrentUser.OrganizationID, r.BYQID, r.Price);
                }
            }
            return(result);
        }
Пример #5
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);
        }
Пример #6
0
        protected override IEnumerable <OrganizationContractDiscount> SearchData()
        {
            var opfs = LinqOP.GetDataContext <OrganizationContractDiscount>();
            var byqs = VMGlobal.DistributionQuery.QueryProvider.GetTable <ProBYQ>("SysProcess.dbo.ProBYQ");
            var childOrganizationIDs = VMGlobal.ChildOrganizations.Select(o => o.ID);
            var data = from opf in opfs
                       from byq in byqs
                       where opf.BYQID == byq.ID && childOrganizationIDs.Contains(opf.OrganizationID)
                       select new OrganizationContractDiscountBO
            {
                BrandID        = byq.BrandID,
                Year           = byq.Year,
                Quarter        = byq.Quarter,
                BYQID          = byq.ID,
                ID             = opf.ID,
                CreateTime     = opf.CreateTime,
                CreatorID      = opf.CreatorID,
                Discount       = opf.Discount,
                OrganizationID = opf.OrganizationID
            };
            var filteredData = (IQueryable <OrganizationContractDiscountBO>)data.Where(FilterDescriptors);

            TotalCount = filteredData.Count();
            var result = filteredData.OrderBy(o => o.ID).Skip(PageIndex * PageSize).Take(PageSize).ToList();

            //result.ForEach(o =>
            //{
            //    var co = VMGlobal.ChildOrganizations.Find(c => c.ID == o.OrganizationID);
            //    if (co != null)
            //    {
            //        o.OrganizationCode = co.Code;
            //        o.OrganizationName = co.Name;
            //    }
            //});
            return(result);
        }
Пример #7
0
        protected override IEnumerable <SysUser> SearchData()
        {
            var users     = LinqOP.GetDataContext <SysUser>();
            var userroles = LinqOP.GetDataContext <SysUserRole>();
            var ouIDs     = users.Where(u => u.OrganizationID == VMGlobal.CurrentUser.OrganizationID).Select(o => o.ID);

            //返回的用户集合必须是本机构用户或本机构用户所创建的用户
            users = from u in users where ouIDs.Contains(u.ID) || ouIDs.Contains(u.CreatorID) select u;
            var data = from u in users
                       join ur in userroles on u.ID equals ur.UserId into urs
                       from v in urs.DefaultIfEmpty()
                       select new SysUserBO
            {
                ID         = u.ID,
                RoleID     = v.RoleId,
                CreateTime = u.CreateTime.Date,
                Code       = u.Code,
                Name       = u.Name,
                Flag       = u.Flag
            };
            var uids = ((IQueryable <SysUserBO>)data.Where(FilterDescriptors)).Select(o => o.ID).ToArray();

            return(users.Where(o => uids.Contains(o.ID)).Select(o => new SysUserBO(o)).ToList());
        }