Exemplo n.º 1
0
        internal List<CommunityUsersByRole> GetCommunityUsersByRole(CommunityUsersByRole communityUsersByRole)
        {
            AddParameter("@communityid", communityUsersByRole.CommunityID);
            Dt_CommunityUsersByRole = this.GetDataTable("[usp_GetCommunityUsersByRole]");

            if (Dt_CommunityUsersByRole.Rows.Count > 0)
            {
                communityUsersByRoleList = new List<CommunityUsersByRole>();
                foreach (DataRow dr in Dt_CommunityUsersByRole.Rows)
                {
                    communityUsersByRole = new CommunityUsersByRole();
                    communityUsersByRole.RoleID = Convert.ToByte(dr["RoleID"].ToString());
                    communityUsersByRole.UsersCount = Convert.ToInt64(dr["UsersCount"].ToString());
                    communityUsersByRoleList.Add(communityUsersByRole);
                }
            }
            return communityUsersByRoleList;
        }
        public ActionResult Users()
        {
            community = new CommunitiesModel();
            community.CommunityID = myCommunityID;

            communityUsersByRole = new CommunityUsersByRole();
            communityUsersByRole.CommunityID = myCommunityID;
            communityUsersByRoleList = new List<CommunityUsersByRole>();
            communityUsersByRoleList = accountDAL.GetCommunityUsersByRole(communityUsersByRole);
            if (communityUsersByRoleList != null)
            {
                foreach (CommunityUsersByRole cubr in communityUsersByRoleList)
                {
                    switch (cubr.RoleID)
                    {
                        case 2: ViewBag.AdministratorsCount = cubr.UsersCount;
                            break;
                        case 3: ViewBag.SecurityManagersCount = cubr.UsersCount;
                            break;
                        case 4: ViewBag.SercurityPersonsCount = cubr.UsersCount;
                            break;
                        case 5: ViewBag.HomeOwnersCount = cubr.UsersCount;
                            break;
                        case 6: ViewBag.ServiceProvidersCount = cubr.UsersCount;
                            break;
                    }
                }
            }
            return View("Users");
        }
        public ActionResult RolesList(String communityid)
        {
            if (CommunityIDSanctityCheck(communityid))
            {
                community = new CommunitiesModel();
                community.CommunityID = outCommunityID;;

                communityUsersByRole = new CommunityUsersByRole();
                communityUsersByRole.CommunityID = outCommunityID;;
                communityUsersByRoleList = new List<CommunityUsersByRole>();
                communityUsersByRoleList = accountDAL.GetCommunityUsersByRole(communityUsersByRole);
                if (communityUsersByRoleList != null)
                {
                    foreach (CommunityUsersByRole cubr in communityUsersByRoleList)
                    {
                        switch (cubr.RoleID)
                        {
                            case 2: ViewBag.AdministratorsCount = cubr.UsersCount;
                                break;
                            case 3: ViewBag.SecurityManagersCount = cubr.UsersCount;
                                break;
                            case 4: ViewBag.SercurityPersonsCount = cubr.UsersCount;
                                break;
                            case 5: ViewBag.HomeOwnersCount = cubr.UsersCount;
                                break;
                            case 6: ViewBag.ServiceProvidersCount = cubr.UsersCount;
                                break;
                        }
                    }
                }
                return PartialView("Partials/Users/RolesList");
            }
            return Json("Community");
        }