public Task <ClaimList> GetClaims(Credentials credentials, CancellationToken cancellationToken)
        {
            if (credentials == null)
            {
                return(Task.FromResult <ClaimList>(null));
            }
            if (_claims != null)
            {
                _claims.Clear();
                _claims = null;
            }

            var data = DataProxy.Instance.MembershipRepository;
            var user = data.FindUser(credentials.Username, credentials.Password);

            if (user != null)
            {
                var items = DataProxy.Instance.
                            MembershipRepository.GetPermissionsByRoleId(user.Role.RoleId);

                var permissions = new List <Common.Models.Permission>();
                permissions.AddRange(items.Select(Mapper.Map <Common.Models.Permission>));
                Permissions = permissions;
                User        = Mapper.Map <UserRead>(user);

                _claims = new ClaimList();
                _claims.AddRange(Permissions.Select(CreateClaim));

                return(Task.FromResult(_claims));
            }
            return(Task.FromResult <ClaimList>(null));
        }
Esempio n. 2
0
        public AddClaimDocumentation()
        {
            InitializeComponent();
            this.ClaimList.ItemsSource          = s1.ClaimsList;
            this.AvailableDocuments.ItemsSource = s1.ClaimDocTypes;
            AvailableDocuments.IsEnabled        = false;
            BitmapSource bitmap = (BitmapSource) new ImageSourceConverter().ConvertFromString("C:\\Users\\Snotacus\\Dropbox\\MRNUIElements\\MRNUIElements\\ResourceFiles\\RoofInspectionWizardBkgnd.png");

            SubmitBtn.IsEnabled = false;
            if (!ClaimList.IsFocused)
            {
                ClaimList.Focus();
            }
            image.Source           = imgsrc;
            image.Stretch          = Stretch.Uniform;
            image.StretchDirection = StretchDirection.DownOnly;
            //ShowImage();
        }