Пример #1
0
        public CombinationDianpuData SearchDianpusByMengzhu (BangpaiType[] bangpaiTypes, DateTime startTime, DateTime endTime,  bool isTimeRangeRequired,  long lastId)
        {
            var rv = new CombinationDianpuData();
            using (var db = DbContextFactory.CreateDbContext())
            {
                 
                //JianghuType[] jianghuTypes = model.JianghuTypes.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                //    .Select(a => (JianghuType)Enum.Parse(typeof(JianghuType), a)).ToArray();
                IQueryable<Dianpu> dianpus = db.Dianpus.Include(a => a.Zhanggui).OrderByDescending(a => a.Id);
                if (lastId != 0)
                {
                    dianpus = dianpus.Where(a => a.Id < lastId);
                }

                dianpus = dianpus.Where(a => bangpaiTypes.Contains(a.Bangpai ));
                if (isTimeRangeRequired)
                {

                    dianpus = dianpus.Where(a => a.CreateTime >= startTime && a.CreateTime <= endTime);

                }
                if (lastId == 0)
                {
                    rv.TotalCount = dianpus.Count();
                }

                dianpus = dianpus.Take(DomainDefinition.PAGE_SIZE);
                foreach (Dianpu dp in dianpus)
                {
                    var x = new  DianpuData()
                    {
                        ID = dp.Id,
                        Name = dp.Name,
                        CreateTime = dp.CreateTime,
                        BangpaiType = dp.Bangpai,
                        Url = dp.Url,
                        XiakeId = dp.Zhanggui.Id,
                        XiakeName = dp.Zhanggui.XiakeName

                    };
                    rv.Items .Add(x);
                }
                if (rv.Items .Count < DomainDefinition.PAGE_SIZE)
                {
                    rv.IsLoadedAllData = true;
                }


            }
            return rv;
        }
Пример #2
0
        public CombinationBiaoshiData SearchBiaoshiByMengzhu(BangpaiType[] bangpaiTypes, DateTime startTime, DateTime endTime, string siteUserName, bool isTimeRangeRequired, long lastId)
        {

            var result =new  CombinationBiaoshiData();
            using (var db = DbContextFactory.CreateDbContext())
            {
                 
                IQueryable<Biaoshi> biaoshis = db.Biaoshis.Include(a => a.Biaoju).OrderByDescending(a => a.Id);

                if (!string.IsNullOrEmpty(siteUserName))
                {
                    biaoshis = biaoshis.Where(a => a.Title.Equals(siteUserName));
                }
                else
                {
                    if (lastId != 0)
                    {
                        biaoshis = biaoshis.Where(a => a.Id < lastId);
                    }

                    biaoshis = biaoshis.Where(a => bangpaiTypes.Contains(a.Bangpai));
                    if ( isTimeRangeRequired)
                    {

                        biaoshis = biaoshis.Where(a => a.CreateTime >=startTime && a.CreateTime <=endTime);

                    }

                }
                if ( lastId == 0)
                {
                    result.TotalCount = biaoshis.Count();
                }

                biaoshis = biaoshis.Take(DomainDefinition.PAGE_SIZE);
                foreach (var dp in biaoshis)
                {
                    var x = new  BiaoshiData()
                    {
                        ID = dp.Id,

                        CreateTime = dp.CreateTime,
                        BangpaiType = dp.Bangpai,
                        SiteUserName = dp.Title,
                        XiakeId = dp.Biaoju.Id,
                        XiakeName = dp.Biaoju.XiakeName,
                        RegisterTime = dp.RegisterTime
                    };
                    result.Items .Add(x);
                }
                if (result.Items .Count < DomainDefinition.PAGE_SIZE)
                {
                    result.IsLoadedAllData = true;
                }

            }
            return result;
        }
Пример #3
0
        public CombinationRenwuData2 SearchRenwusByMgmt(JubenType[] jubenTypes, BangpaiType[] bangpaiTypes
            , DateTime startTime, DateTime endTime, bool isTimeRangeRequired, long lastId)
        {
            var result = new CombinationRenwuData2();
            using (var db = DbContextFactory.CreateDbContext())
            {
                var xiake = db.Xiakes.Include(a => a.Credits).FirstOrDefault(a => a.XiakeName == Thread.CurrentPrincipal.Identity.Name);
                if (xiake.UserType != XiakeType.Xiaoer && xiake.UserType != XiakeType.Tangzhu && xiake.UserType != XiakeType.Mengzhu)
                    throw new FaultException("非管理账号不可调用");

                IQueryable<Renwu> renws = db.Renwus.OrderByDescending(a => a.Id);

                if (lastId != 0)
                {
                    renws = renws.Where(a => a.Id < lastId);
                }

                renws = renws.Where(a => jubenTypes.Contains(a.NextStep.Value ));
                renws = renws.Where(a => bangpaiTypes.Contains(a.Bangpai));

                if (isTimeRangeRequired)
                {

                    renws = renws.Where(a => a.RunTime >= startTime && a.RunTime <= endTime);

                }
                if (lastId == 0)
                {
                    result.TotalCount = renws.Count();
                }
                renws = renws.Include(a => a.Biao).Include(a => a.Biaoshi).Include(a=>a.Biaoju).Include(a=>a.Biao.Dianpu).Include(a=>a.Biao.Zhanggui);
                renws = renws.Take(DomainDefinition.PAGE_SIZE);
                
                foreach (var dp in renws)
                {
                    var x = new RenwuData2()
                    {
                        ID = dp.Id, 
                        BiaoshiName = dp.Biaoshi.Title,
                        BangpaiType = dp.Bangpai,
                        Price = dp.Biao.Price,
                        RunningTime = dp.RunTime,
                        SearchWord = dp.Biao.SearchWord,
                        NextStep = dp.NextStep.Value ,
                        Steps = dp.Steps,
                        Salary = dp.Biao.Salary,
                        Biaoju = dp.Biaoju.XiakeName, 
                        BiaojuId = dp.Biaoju.Id,
                        ZhangguiId = dp.Biao.Zhanggui.Id,
                        ZhangguiName = dp.Biao.Zhanggui.XiakeName,
                        ZhangguiQQ = dp.Biao.Zhanggui.QQ,
                        Dianpu  = dp.Biao.Dianpu.Name,
                        BiaojuQQ = dp.Biaoju.QQ ,
                        IsDisabled = dp.IsDisabled
                    };
                    result.Items.Add(x);
                }
                if (result.Items.Count < DomainDefinition.PAGE_SIZE)
                {
                    result.IsLoadedAllData = true;
                }


            }
            return result;
        }
Пример #4
0
        public CombinationBiaoData SearchBiaosByMengzhu(BangpaiType[] bangpaiTypes, DateTime startTime, DateTime endTime, string xiakeName, bool isTimeRangeRequired, bool isFinished, long lastId)
        {
            var result = new CombinationBiaoData();
            using (var db = DbContextFactory.CreateDbContext())
            {
                IQueryable<Biao > biaos = db.Biaos.Include(a=>a.Dianpu).OrderByDescending(a => a.Id);
                if (!string.IsNullOrEmpty(xiakeName))
                {
                    biaos  = biaos.Where(a => a.Zhanggui.XiakeName.Equals(xiakeName));
                }
                else
                {
                    if (lastId != 0)
                    {
                        biaos  = biaos .Where(a => a.Id < lastId);
                    }
                    biaos = biaos.Where(a => bangpaiTypes.Contains(a.Bangpai));
                    if (isTimeRangeRequired)
                    {
                        biaos = biaos.Where(a => a.CreateTime >= startTime && a.CreateTime <= endTime);
                    }
                }
                if(isFinished == true)
                {
                    biaos = biaos.Where(a => a.Finished >= a.PlanCount);
                }
                if (lastId == 0)
                {
                    result.TotalCount = biaos.Count();
                }

                biaos = biaos.Take(DomainDefinition.PAGE_SIZE);
                foreach (var item in biaos)
                {
                    var x = new BiaoData()
                    {
                        ID = item.Id,
                        Details = item.Details,
                        GoodsId = item.GoodsId,
                        IsSaleOver = item.IsSaleOver,
                        CreateTime = item.CreateTime,
                        PlanCount = item.PlanCount,
                        Price = item.Price,
                        DianpuName = item.Dianpu.Name,
                        BangpaiType = item.Bangpai,
                        RealCount = item.RealCount,
                        IsEnable = item.IsEnable,
                        Sku = item.Sku,
                        SearchWord = item.SearchWord,
                        Salary = item.Salary,
                        YqBindPhone = item.YqBindPhone,
                        YqBindSfz = item.YqBindSfz,
                        YqManualCheck = item.YqManualCheck,
                        YqMonthCount = item.YqMonthCount,
                        YqRegisterDate = item.YqRegisterDate,
                        YqCheckRegDate = item.YqCheckRegDate,
                        YqUserLevel = item.YqUserLevel,
                        YqWeekCount = item.YqWeekCount,
                        Steps = item.Steps,
                        Running = item.Running,
                        Finished = item.Finished,
                        AllowXiakeType = item.AllowXiakeType,
                        MaxFinishDaysForOldCustomer = item.MaxFinishDaysForOldCustomer,
                        RejectOneBiaoju = item.RejectOneBiaoju
                    };
                    result.Items.Add(x);
                }
                if (result.Items.Count < DomainDefinition.PAGE_SIZE)
                {
                    result.IsLoadedAllData = true;
                }

            }
            return result;
        }