Пример #1
0
        public ActionResult Index(DealSearchViewModel search, GridSortOptions sort, int? page)
        {
            search.ControllerName = "ChannelDirector";
            search.ActionName = "Index";
            ViewBag.SearchModel = search;
            ViewBag.Sort = sort;

            IQueryable<Deal> deals = DealMgr.GetChannelDirectorDeals().Search(search);
            return View(SortAndPagingDeal(deals, sort, page));
        }
        public ActionResult DealSearch()
        {
            var model = new DealSearchViewModel();
            var from  = Request["PriceFrom"];

            if (from != null)
            {
                model.PriceFrom = Int32.Parse(from);
            }
            return(PartialView("~/Views/Shared/Widgets/Search/_DealSearch.cshtml", model));
        }
Пример #3
0
        public async Task OnGetAsync(string pageNo, string status)
        {
            SearchInput = new DealSearchViewModel
            {
                PageNo = pageNo.FixPageNumber(),
            };

            Status = !string.IsNullOrEmpty(status)
                ? status
                : null;
            List = await _dealService.ListAsync(SearchInput);
        }
Пример #4
0
        //
        // GET: /Contract/
        public ViewResult Index(DealSearchViewModel search, GridSortOptions sort, int? page)
        {
            search.ControllerName = "Contract";
            search.ActionName = "Index";
            ViewBag.SearchModel = search;

            ViewBag.Sort = sort;
            COATMemebershipUser user = GetCurrentMemberShipUser();
            IQueryable<Deal> deals =
                Db.Deals.Where(a => a.ApproverId == user.Id || user.SystemRole.Id == SystemRoleIds.Admin).Search(search);
            ViewBag.SummaryDeals = deals;

            return View(SortAndPagingDeal(deals, sort, page));
        }
Пример #5
0
        //
        // GET: /Admin/
        public ActionResult Index(DealSearchViewModel search, GridSortOptions sort, int? page)
        {
            search.ControllerName = "Admin";
            search.ActionName = "Index";
            search.IsHideStatus = true;
            ViewBag.SearchModel = search;

            ViewBag.Sort = sort;
            var deals = DealMgr.GetEndDeals()
                 .Where(a => a.Status.ActionName != "")
                 .Where(a => a.CreateDate <= DateTime.Today)
                 .Search(search);
            ViewBag.SummaryDeals = deals;
            return View(SortAndPagingDeal(deals, sort, page));
        }
Пример #6
0
        public ActionResult Index(DealSearchViewModel search, GridSortOptions sort, int? page)
        {
            search.ControllerName = "SalesAssigner";
            search.ActionName = "Index";
            ViewBag.SearchModel = search;

            ViewBag.AssignToList = AssignToList;
            ViewBag.Sort = sort;

            IQueryable<Deal> deals = DealMgr.GetSalesAssignerDeals().Search(search);
            return View(SortAndPagingDeal(deals, sort, page));
        }
Пример #7
0
        public ViewResult Index(DealSearchViewModel search, GridSortOptions sort, int? page)
        {
            search.ControllerName = "Deals";
            search.ActionName = "Index";
            ViewBag.SearchModel = search;

            ViewBag.Sort = sort;
            IQueryable<Deal> deals = DealMgr.GetDealsByUser(GetCurrentMemberShipUser().Id)
                .Where(a => a.Status.ActionName != "")
                .Where(a => a.CreateDate <= DateTime.Today)
                .Search(search);

            ViewBag.SummaryDeals = deals;
            return View(SortAndPagingDeal(deals, sort, page));
        }
Пример #8
0
 public ActionResult Export(DealSearchViewModel search)
 {
     IQueryable<Deal> deals = Db.Deals.Where(a => a.Status.ActionName != "").Search(search);
     ExportObject[] objs = new ExportGenerator(deals).Generate();
     return new ExcelResult<ExportObject>(objs.ToList());
 }
Пример #9
0
        public ActionResult Index(DealSearchViewModel search, GridSortOptions sort, int? page)
        {
            search.ControllerName = "ChannelApprover";
            search.ActionName = "Index";
            ViewBag.SearchModel = search;
            ViewBag.Sort = sort;

            COATMemebershipUser user = GetCurrentMemberShipUser();
            IQueryable<Deal> deals = DealMgr.GetChannelApproverDeals(user.Id).Search(search);
            return View(SortAndPagingDeal(deals, sort, page));
        }
Пример #10
0
        public ActionResult Index(DealSearchViewModel model, string order, int page = 1)
        {
            var now    = DateTime.Now;
            var dealsQ = from d in db.Deals.Include("Listing").Include("Listing.images").Include("Listing.Owner").Include("Listing.Category")
                         where d.Starts <now && d.Ends> now
                         select d;

            if (ModelState.IsValid)
            {
                if (model.PriceFrom > 0)
                {
                    dealsQ = dealsQ.Where(d => d.Listing.Price >= model.PriceFrom);
                }
                if (model.PriceTo > 0)
                {
                    dealsQ = dealsQ.Where(d => d.Listing.Price <= model.PriceTo);
                }
                if (!String.IsNullOrEmpty(model.Location))
                {
                    dealsQ = dealsQ.Where(d => d.Listing.Town.ToLower().Contains(model.Location.ToLower()));
                }
                if (model.MinScore > 0)
                {
                    dealsQ = dealsQ.Where(d => d.TotalScore <= model.MinScore);
                }
                if (model.Category > 0)
                {
                    var catHelper = new CategoryHelper();
                    var cats      = catHelper.allSubCategoryIds(model.Category);
                    dealsQ = dealsQ.Where(d => cats.Contains(d.Listing.CategoryId));
                }
            }
            //ordering
            string priceOrder    = "price";
            string dateOrder     = "date";
            string categoryOrder = "category";
            string pointsOrder   = "points";

            switch (order)
            {
            case "price":
                dealsQ     = dealsQ.OrderBy(c => c.Listing.Price);
                priceOrder = "price_desc";
                break;

            case "price_desc":
                priceOrder = "price";
                dealsQ     = dealsQ.OrderByDescending(c => c.Listing.Price);
                break;

            case "date":
                dateOrder = "date_desc";
                dealsQ    = dealsQ.OrderBy(c => c.Starts);
                break;

            case "date_desc":
                dateOrder = "date";
                dealsQ    = dealsQ.OrderByDescending(c => c.Starts);
                break;

            case "category":
                categoryOrder = "category_desc";
                dealsQ        = dealsQ.OrderBy(c => c.Listing.CategoryId);
                break;

            case "category_desc":
                categoryOrder = "category";
                dealsQ        = dealsQ.OrderByDescending(c => c.Listing.CategoryId);
                break;

            case "points":
                pointsOrder = "points_desc";
                dealsQ      = dealsQ.OrderBy(c => c.TotalScore);
                break;

            case "points_desc":
                pointsOrder = "points";
                dealsQ      = dealsQ.OrderByDescending(c => c.TotalScore);
                break;

            default:
                dealsQ = dealsQ.OrderByDescending(c => c.Starts);
                break;
            }
            var deals = dealsQ.ToPagedList(page, pageSize);

            ViewBag.dealSearchModel = model;
            ViewBag.priceOrder      = priceOrder;
            ViewBag.dateOrder       = dateOrder;
            ViewBag.categoryOrder   = categoryOrder;
            ViewBag.pointsOrder     = pointsOrder;
            return(View(deals));
        }