public LinkItemCollection FilterB2BNavigationForCurrentUser(LinkItemCollection b2bLinks)
        {
            var filteredLinks  = new LinkItemCollection();
            var currentContact = _customerDomainService.GetCurrentContact();

            foreach (var link in b2bLinks)
            {
                switch (currentContact.B2BUserRole)
                {
                case B2BUserRoles.Admin:
                    if (Constants.B2BNavigationRoles.Admin.Contains(link.Text))
                    {
                        filteredLinks.Add(link);
                    }
                    break;

                case B2BUserRoles.Approver:
                    if (Constants.B2BNavigationRoles.Approver.Contains(link.Text))
                    {
                        filteredLinks.Add(link);
                    }
                    break;
                }
            }
            return(filteredLinks);
        }
        public void CreateOrganization(OrganizationModel organizationInfo)
        {
            var organization = _organizationDomainService.GetNewOrganization();

            organization.Name = organizationInfo.Name;
            organization.SaveChanges();

            _customerDomainService.AddContactToOrganization(organization, _customerDomainService.GetCurrentContact(),
                                                            B2BUserRoles.Admin);
            _addressService.UpdateOrganizationAddress(organization, organizationInfo.Address);
        }
Ejemplo n.º 3
0
        public ContactViewModel GetCurrentContact()
        {
            var currentContact = _customerDomainService.GetCurrentContact();

            return(currentContact?.Contact != null ? new ContactViewModel(currentContact) : new ContactViewModel());
        }