public static OrganizationProxy GetOrganization()
    {
        Organization      organization = Organizations.GetOrganization(UserSession.LoginUser, UserSession.LoginUser.OrganizationID);
        OrganizationProxy result       = organization.GetProxy();

        return(result);
    }
Ejemplo n.º 2
0
        private void InitializeOrganizationInfo()
        {
            OrganizationRequest  whoAmIRequest  = new OrganizationRequest("WhoAmI");
            OrganizationResponse whoAmIResponse = OrganizationProxy.Execute(whoAmIRequest);
            Guid organizationId = (Guid)whoAmIResponse.Results["OrganizationId"];

            Entity organizationRow = OrganizationProxy.Retrieve("organization", organizationId, new ColumnSet("languagecode", "localeid"));

            _organizationLanguage = organizationRow.GetAttributeValue <int>("languagecode");
            Language = _organizationLanguage;
            LocaleId = organizationRow.GetAttributeValue <int>("localeid");
        }
Ejemplo n.º 3
0
        public ActionResult UserAccount(UserOverviewModel model, int?start)
        {
            if (model == null)
            {
                model = new UserOverviewModel();
            }
            int  total;
            User userInfo = @Utilities.GetCurrentUserInfo();


            using (var proxy = new UserProxy())
            {
                foreach (UserRole UserRole in userInfo.UserRoles)
                {
                    if (UserRole.RoleType == (int)RoleType.UserAdmin)
                    {
                        using (var Organizationproxy = new OrganizationProxy())
                        {
                            model.SearchResult = proxy.GetUserListByUserAdmin(start,
                                                                              Constants.PageSize,
                                                                              out total,
                                                                              Convert.ToString(model.UserId),
                                                                              (userInfo.Organisation_GUID),
                                                                              Constants.WindowsAuthentication).ToList();
                            model.Pagers = new Pager((start.HasValue ? start.Value : 0), total, Constants.PageSize);
                        }
                    }

                    else if (UserRole.RoleType == (int)RoleType.SystemAdmin)
                    {
                        model.SearchResult = proxy.GetUserList(start,
                                                               Constants.PageSize,
                                                               out total,
                                                               Convert.ToString(model.UserId),
                                                               Convert.ToString(model.UserName),
                                                               Constants.WindowsAuthentication).ToList();
                        model.Pagers = new Pager((start.HasValue ? start.Value : 0), total, Constants.PageSize);
                    }
                    else if (UserRole.RoleType == (int)RoleType.NormalUser)
                    {
                        model.SearchResult = proxy.GetUserList(start,
                                                               Constants.PageSize,
                                                               out total,
                                                               Convert.ToString(model.UserId),
                                                               Convert.ToString(userInfo.UserName),
                                                               Constants.WindowsAuthentication).ToList();
                        model.Pagers = new Pager((start.HasValue ? start.Value : 0), total, Constants.PageSize);
                    }
                    else if (UserRole.RoleType == (int)RoleType.RigUser)
                    {
                        model.SearchResult = proxy.GetUserList(start,
                                                               Constants.PageSize,
                                                               out total,
                                                               Convert.ToString(model.UserId),
                                                               Convert.ToString(userInfo.UserName),
                                                               Constants.WindowsAuthentication).ToList();
                        model.Pagers = new Pager((start.HasValue ? start.Value : 0), total, Constants.PageSize);
                    }
                }
            }
            return(View(model));
        }