public ActionResult CampaignEvents(int?planetID,
                                           int?journalID,
                                           int campaignID,
                                           string filter,
                                           int pageSize = 0,
                                           int page     = 0,
                                           bool partial = false)
        {
            int accountID = Global.AccountID;
            var db        = new ZkDataContext();

            if (Request.IsAjaxRequest())
            {
                partial = true;
            }
            if (pageSize == 0)
            {
                if (!partial)
                {
                    pageSize = 40;
                }
                else
                {
                    pageSize = 10;
                }
            }
            IQueryable <CampaignEvent> res = db.CampaignEvents.Where(x => x.AccountID == accountID && x.CampaignID == campaignID).AsQueryable();

            if (planetID.HasValue)
            {
                res = res.Where(x => x.PlanetID == planetID);
            }
            if (!string.IsNullOrEmpty(filter))
            {
                res = res.Where(x => x.Text.Contains(filter));
            }
            res = res.OrderByDescending(x => x.EventID);

            var ret = new CampaignEventsResult
            {
                PageCount = (res.Count() / pageSize) + 1,
                Page      = page,
                Events    = res.Skip(page * pageSize).Take(pageSize),
                PlanetID  = planetID,
                Filter    = filter,
                Partial   = partial,
                PageSize  = pageSize
            };

            return(View(ret));
        }
        public ActionResult CampaignEvents(int? planetID,
                                   int? journalID,
                                   int campaignID,
                                   string filter,
                                   int pageSize = 0,
                                   int page = 0,
                                   bool partial = false) {

            int accountID = Global.AccountID;
            var db = new ZkDataContext();
            if (Request.IsAjaxRequest()) partial = true;
            if (pageSize == 0)
            {
                if (!partial) pageSize = 40;
                else pageSize = 10;
            }
            IQueryable<CampaignEvent> res = db.CampaignEvents.Where(x => x.AccountID == accountID && x.CampaignID == campaignID).AsQueryable();
            if (planetID.HasValue) res = res.Where(x => x.PlanetID == planetID);
            if (!string.IsNullOrEmpty(filter)) res = res.Where(x => x.Text.Contains(filter));
            res = res.OrderByDescending(x => x.EventID);

            var ret = new CampaignEventsResult
            {
                PageCount = (res.Count() / pageSize) + 1,
                Page = page,
                Events = res.Skip(page * pageSize).Take(pageSize),
                PlanetID = planetID,
                Filter = filter,
                Partial = partial,
                PageSize = pageSize
            };

            return View(ret);
        }