예제 #1
0
        public UnBlockedCUListPagedModel GetUnBlockedCompanyUser(int pageNo, int pageSize, string sort, string sortDir,
                                                                 string TMName = "", string UserName = "")
        {
            try
            {
                if (pageNo < 0)
                {
                    pageNo = 1;
                }
                IQueryable <WebUser> data = db.WebUsers.Include("TeamMember").Where(w => w.Status == 3);
                if (!string.IsNullOrEmpty(TMName) || !string.IsNullOrEmpty(UserName))
                {
                    data = data.Where(b => (b.TeamMember.TMFirstName.Contains(TMName) ||
                                            b.TeamMember.TMLastName.Contains(TMName) ||
                                            b.CRPUserName.Contains(UserName)));
                }
                switch (sort)
                {
                case "crpusername":
                    data = sortDir == "asc" ? data.OrderBy(d => d.CRPUserName) : data.OrderByDescending(d => d.CRPUserName);
                    break;

                default:
                    data = sortDir == "asc" ? data.OrderBy(d => d.WebUserRowID) : data.OrderByDescending(d => d.WebUserRowID);
                    break;
                }

                UnBlockedCUListPagedModel model = new UnBlockedCUListPagedModel();
                model.PageSize        = pageSize;
                model.TotalRecords    = data.Count();
                model.UnBlockedCUsers = data.Skip((pageNo - 1) * pageSize).Take(pageSize).Select(item => new UnBlockedCompanyUserModel
                {
                    WebUserRowID    = item.WebUserRowID,
                    CRPUserName     = item.CRPUserName,
                    TeamMemberRoWID = item.TeamMemberRoWID,
                    TeamMemberName  = item.TeamMember.TMFirstName + " " + item.TeamMember.TMLastName,
                    BlockedDate     = item.BlockedDate,
                    EmailID         = item.TeamMember.EmailID,
                    Status          = item.Status
                }).ToList();
                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
        public ActionResult UnBlockedUserCompany(int page = 1, string sort = "CRPUserName", string sortDir = "asc",
                                                 string TeamMemberName = "", string UserName = "")
        {
            UnBlockedCUListPagedModel model = new UnBlockedCUListPagedModel();

            try
            {
                int pageSize = clsGlobalCommon.PageSize;
                model = repoWebUser.GetUnBlockedCompanyUser(page, pageSize, sort.ToLower(), sortDir.ToLower(), TeamMemberName, UserName);
                if (model == null)
                {
                    ViewBag.ErrorMsg = "No item found!";
                }
            }
            catch (Exception Ex)
            {
                ViewBag.ErrorMsg = Ex.Message;
            }

            return(View(model));
        }