Example #1
0
        public void GetAllWithCount(ref PotentialUserParcel pup, int page, int pageSize, bool?signedUp)
        {
            try
            {
                var potentialUsers = (IQueryable <PotentialUser>)db.PotentialUsers;
                var count          = potentialUsers.Count();

                if (signedUp == null)
                {
                    potentialUsers = potentialUsers.OrderBy(p => p.Name).Skip((page - 1) * pageSize).Take(pageSize);
                }
                else
                {
                    potentialUsers = potentialUsers.Where(p => p.SignedUp == signedUp).OrderBy(p => p.Name).Skip((page - 1) * pageSize).Take(pageSize);
                }

                pup.Count          = count;
                pup.PotentialUsers = potentialUsers;
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                throw ex;
            }
        }
Example #2
0
 public void GetAllPotentialUsersWithCount(ref PotentialUserParcel pup, int page, int pageSize, bool?signedUp)
 {
     try
     {
         _pur.GetAllWithCount(ref pup, page, pageSize, signedUp);
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message, ex);
         throw ex;
     }
 }
Example #3
0
        public ActionResult PotentialUsers(int page = 1, string type = "NotSignedUp")
        {
            try
            {
                bool?signedUp = null;
                if (type == "SignedUp")
                {
                    signedUp = true;
                }
                else if (type == "NotSignedUp")
                {
                    signedUp = false;
                }

                var pup = new PotentialUserParcel();
                _trs.GetAllPotentialUsersWithCount(ref pup, page, PotentialUserPageCount, signedUp);

                if (pup.Count == null)
                {
                    pup.Count = 0;
                }

                ViewBag.Pagination = new Pagination()
                {
                    CurrentPage     = page,
                    PageSize        = PotentialUserPageCount,
                    TotalPostsCount = (int)pup.Count,
                    Action          = "PotentialUsers",
                    Controller      = "Account",
                    Type            = type
                };

                return(View(pup.PotentialUsers));
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                return(HttpNotFound());
            }
        }