示例#1
0
        public static dynamic GetPermissoes()
        {
            try
            {
                if (VisualWebPart1._editMode)
                {
                    return(new List <Permissao>());
                }

                Connection connection = Connection.Instance;
                connection.ConnectionString = VisualWebPart1._connectionString;
                connection.User             = VisualWebPart1._username;
                connection.Password         = VisualWebPart1._password;

                IApplicationFacade application = new ApplicationFacade();
                var list = new List <Permissao>();

                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    list = application.GetPermissoes(connection);
                });

                return(JsonConvert.SerializeObject(
                           list, new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }