Example #1
0
        public ActionResult Index(string sortOrder, string active, string currentSearch = null)
        {

            ViewBag.Requests = sortOrder == "requests_desc" ? "requests_asc" : "requests_desc";
            ViewBag.ReviewsNeeded = sortOrder == "revs_needed" ? "revs_needed_desc" : "revs_needed";
            ViewBag.Vendor = sortOrder == "Vendor" ? "vendor_desc" : "Vendor";
            ViewBag.Codes = sortOrder == "codes" ? "codes_desc" : "codes";
            ViewBag.SearchBox = currentSearch;

            if (String.IsNullOrEmpty(sortOrder)) { sortOrder = "requests_desc"; }
            if (String.IsNullOrEmpty(active)) { active = "all"; }

            CampaignIndexViewModel IndexView = new CampaignIndexViewModel(sortOrder, currentSearch, active);

            var reviewsCheckedTime = (from t in db.TaskLog
                                      where t.TaskDescription.Equals("DailyLimitsReset")
                                      orderby t.SuccessDatestamp descending
                                      select t.SuccessDatestamp).First();

            ViewBag.DateStamp = reviewsCheckedTime;



            return View(IndexView);
        }
Example #2
0
        public AdminDashboardViewModel()
        {
            OpenCampaigns = (from a in db.Campaigns
                             where a.OpenCampaign.Equals(true)
                             select a).Count();

            ClosedCampaigns = (from b in db.Campaigns
                               where b.OpenCampaign.Equals(false)
                               select b).Count();

            Customers = (from c in db.Customers
                         select c).Count();

            UnqualifiedCustomers = (from d in db.Customers
                                    where d.Qualified.Equals(false)
                                    select d).Count();

            Vendors = (from e in db.Vendors
                       select e).Count();

            var _cust = (from f in db.Customers
                            where f.Qualified.Equals(true)
                            orderby f.Reviews.Count() descending
                            select f).Take(5).ToList();
            TopReviewers = new CustomerIndexViewModel(_cust);

            var _topvendors = (from g in db.Campaigns
                              orderby g.Reviews.Count() descending
                              select g.Vendor).Take(5).ToList();
            TopVendors = new VendorIndexViewModel(_topvendors);

            var _topcamps = (from h in db.Campaigns
                                  where h.OpenCampaign.Equals(true)
                                  orderby h.Reviews.Count() descending
                                  select h).Take(5).ToList();

            TopActiveCampaigns = new CampaignIndexViewModel(_topcamps);

            ActiveRequests = (from i in db.ItemRequests
                              where i.ActiveRequest.Equals(true)
                              select i).Count();
            CodesNeeded = (from j in db.Reviews
                           where j.Reviewed.Equals(false)
                           where j.DiscountCode.Equals(null)
                           select j).Count();

            TotalReviewsDone = (from j in db.Reviews
                           where j.Reviewed.Equals(true)
                           select j).Count();

            //Notifications count for today
            DateTime today = DateTime.Now.Date;
            NotificationsToday = (from n in db.NotificationLog
                                  where n.LogTimestamp > today
                                  select n).Count();


        }
Example #3
0
        public SingleVendorViewModel(Vendor vendor)
        {
            Vendor = vendor;
            vendorsummary = new List<VendorSummaryViewModel> { };
            vendorsummary.Add(new VendorSummaryViewModel(vendor));

            var _camps = (from c in db.Campaigns
                          where c.VendorID.Equals(vendor.VendorId)
                          select c).ToList();

            vendorcampaigns = new CampaignIndexViewModel(_camps);

        }