Пример #1
0
        /// <summary>
        /// 仓库列表
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Store(int p = 1)
        {
            IEnumerable <Store> query = DB.Stores.Where(x => !x.Delete);

            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }
Пример #2
0
        /// <summary>
        /// 农机服务信息列表
        /// </summary>
        /// <param name="CatalogID"></param>
        /// <param name="Begin"></param>
        /// <param name="End"></param>
        /// <param name="Type"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Index(int?CatalogID, DateTime?Begin, DateTime?End, InformationType?Type, bool?Verify, int p = 0)
        {
            ViewBag.Level1 = (from c in DB.Catalogs
                              where c.Level == 0 &&
                              !c.Delete &&
                              c.Type == CatalogType.农机服务分类
                              select c).ToList();
            ViewBag.Level2 = (from c in DB.Catalogs
                              where c.Level == 1 &&
                              !c.Delete &&
                              c.Type == CatalogType.农机服务分类
                              select c).ToList();
            ViewBag.Level3 = (from c in DB.Catalogs
                              where c.Level == 2 &&
                              !c.Delete &&
                              c.Type == CatalogType.农机服务分类
                              select c).ToList();
            ViewBag.Level4 = (from c in DB.Catalogs
                              where c.Level == 3 &&
                              !c.Delete &&
                              c.Type == CatalogType.农机服务分类
                              select c).ToList();
            IEnumerable <Information> query = DB.Informations.Where(x => x.Type != InformationType.本地通信息 && x.Type != InformationType.农业信息).ToList();

            if (CatalogID.HasValue)
            {
                query = query.Where(x => x.CatalogID == CatalogID.Value).ToList();
            }
            if (Begin.HasValue)
            {
                query = query.Where(x => x.Time >= Begin.Value).ToList();
            }
            if (End.HasValue)
            {
                query = query.Where(x => x.Time <= End.Value).ToList();
            }
            if (Type.HasValue)
            {
                query = query.Where(x => x.Type == Type.Value).ToList();
            }
            if (Verify.HasValue)
            {
                query = query.Where(x => x.Verify == Verify.Value).ToList();
            }
            query            = query.OrderByDescending(x => x.Top).ThenByDescending(x => x.Time).ToList();
            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }
Пример #3
0
        /// <summary>
        /// 用户列表
        /// </summary>
        /// <param name="Username"></param>
        /// <param name="Role"></param>
        /// <param name="Name"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Index(string Username, UserRole?Role, string Name, int p = 0)
        {
            IEnumerable <User> query = DB.Users.Where(x => !x.Delete).ToList();

            if (!string.IsNullOrEmpty(Username))
            {
                query = query.Where(x => x.Username == Username).ToList();
            }
            if (!string.IsNullOrEmpty(Name))
            {
                query = query.Where(x => x.Name != null && x.Name.Contains(Name)).ToList();
            }
            if (Role.HasValue)
            {
                query = query.Where(x => x.Role == Role.Value).ToList();
            }
            if (CurrentUser.Role == UserRole.大区经理)
            {
                query = query.Where(x => x.ManagerID == CurrentUser.ID).ToList();
            }
            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }
Пример #4
0
        /// <summary>
        /// 供应商列表
        /// </summary>
        /// <param name="Title"></param>
        /// <param name="Phone"></param>
        /// <param name="Name"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Provider(string Title, string Phone, string Name, ProviderStatus?Status, int p = 1)
        {
            IEnumerable <Provider> query = DB.Providers.Where(x => !x.Delete).ToList();

            if (Status.HasValue)
            {
                query = query.Where(x => x.Status == Status.Value).ToList();
            }
            if (!string.IsNullOrEmpty(Title))
            {
                query = query.Where(x => x.Title.Contains(Title) || Title.Contains(x.Title)).ToList();
            }
            if (!string.IsNullOrEmpty(Phone))
            {
                query = query.Where(x => x.Phone == Phone).ToList();
            }
            if (!string.IsNullOrEmpty(Name))
            {
                query = query.Where(x => x.Name == Name).ToList();
            }
            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }
Пример #5
0
        // GET: Shop

        /// <summary>
        /// 商品列表
        /// </summary>
        /// <param name="Title"></param>
        /// <param name="ProductCode"></param>
        /// <param name="Provider"></param>
        /// <param name="Store"></param>
        /// <param name="StoreGte"></param>
        /// <param name="StoreLte"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Index(string Title, string ProductCode, string Provider, int?Store, int?StoreGte, int?StoreLte, int p = 0)
        {
            ViewBag.Stores = DB.Stores.ToList();
            IEnumerable <Product> query = DB.Products.Where(x => !x.Delete).ToList();

            if (!string.IsNullOrEmpty(Title))
            {
                query = query.Where(x => x.Title.Contains(Title) || Title.Contains(x.Title)).ToList();
            }
            if (!string.IsNullOrEmpty(ProductCode))
            {
                query = query.Where(x => x.ProductCode == ProductCode).ToList();
            }
            if (!string.IsNullOrEmpty(Provider))
            {
                query = query.Where(x => x.Provider.Title.Contains(Provider) || Provider.Contains(x.Provider.Title)).ToList();
            }
            if (StoreGte.HasValue)
            {
                query = query.Where(x => x.StoreCount >= StoreGte.Value).ToList();
            }
            if (StoreLte.HasValue)
            {
                query = query.Where(x => x.StoreCount <= StoreLte.Value).ToList();
            }
            if (Store.HasValue)
            {
                query = query.Where(x => x.StoreID == Store.Value).ToList();
            }
            if (CurrentUser.Role == UserRole.库存管理员)
            {
                query = query.Where(x => x.Store.UserID != null && x.Store.UserID == CurrentUser.ID).ToList();
            }
            query            = query.OrderByDescending(x => x.Top).ToList();
            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }
Пример #6
0
        /// <summary>
        /// 评论管理
        /// </summary>
        /// <param name="Type"></param>
        /// <param name="Begin"></param>
        /// <param name="End"></param>
        /// <param name="Verify"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Comment(CommentType?Type, DateTime?Begin, DateTime?End, int?Verify, int p = 1)
        {
            IEnumerable <Comment> query = DB.Comments;

            if (Begin.HasValue)
            {
                query = query.Where(x => x.Time >= Begin.Value);
            }
            if (End.HasValue)
            {
                query = query.Where(x => x.Time <= End.Value);
            }
            if (Type.HasValue)
            {
                query = query.Where(x => x.Type == Type);
            }
            if (Verify.HasValue)
            {
                query = query.Where(x => x.Verify == (Verify.Value == 1 ? true : false));
            }
            query            = query.OrderByDescending(x => x.Time);
            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }
Пример #7
0
        /// <summary>
        /// 订单管理
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="Begin"></param>
        /// <param name="End"></param>
        /// <param name="Status"></param>
        /// <param name="Address"></param>
        /// <param name="Name"></param>
        /// <param name="Phone"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public ActionResult Order(Guid?ID, DateTime?Begin, DateTime?End, OrderStatus?Status, string Address, string Name, string Phone, int p = 0)
        {
            IEnumerable <Order> query = DB.Orders.ToList();

            if (ID.HasValue)
            {
                query = query.Where(x => x.ID == ID.Value).ToList();
            }
            if (Begin.HasValue)
            {
                query = query.Where(x => x.Time >= Begin.Value).ToList();
            }
            if (End.HasValue)
            {
                query = query.Where(x => x.Time <= End.Value).ToList();
            }
            if (Status.HasValue)
            {
                query = query.Where(x => x.Status == Status.Value).ToList();
            }
            if (!string.IsNullOrEmpty(Name))
            {
                query = query.Where(x => x.User.Name != null && (x.User.Name.Contains(Name) || Name.Contains(x.User.Name))).ToList();
            }
            if (!string.IsNullOrEmpty(Phone))
            {
                query = query.Where(x => x.User.Username == Phone).ToList();
            }
            if (!string.IsNullOrEmpty(Address))
            {
                query = query.Where(x => x.Address.Contains(Address) || Address.Contains(x.Address)).ToList();
            }
            query            = query.OrderByDescending(x => x.Time);
            ViewBag.PageInfo = PagerHelper.Do(ref query, 50, p);
            return(View(query));
        }