Exemplo n.º 1
0
        private UserOrgModel GetUserInfoList(int OrgId = -1)
        {
            int          UserId       = SurveyHelper.GetDecryptUserId(Session["UserId"].ToString());
            UserOrgModel UserOrgModel = new UserOrgModel();

            try
            {
                OrganizationRequest Request = new OrganizationRequest();
                Request.UserId   = UserId;
                Request.UserRole = Convert.ToInt16(Session["UserHighestRole"].ToString());
                OrganizationResponse     Organizations = _isurveyFacade.GetAdminOrganizations(Request);
                List <OrganizationModel> OrgListModel  = Mapper.ToOrganizationModelList(Organizations.OrganizationList);
                UserOrgModel.OrgList = OrgListModel;
                if (OrgId != -1)
                {
                    Request.Organization.OrganizationId = OrgId;
                    ViewBag.SelectedOrg = OrgId;
                }
                else
                {
                    Request.Organization.OrganizationId = Organizations.OrganizationList[0].OrganizationId;
                    ViewBag.SelectedOrg = Organizations.OrganizationList[0].OrganizationId;
                }
                OrganizationResponse OrganizationUsers = _isurveyFacade.GetOrganizationUsers(Request);
                List <UserModel>     UserModel         = Mapper.ToUserModelList(OrganizationUsers.OrganizationUsersList);

                UserOrgModel.UserList = UserModel;
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return(UserOrgModel);
        }