示例#1
0
        public void DeleteAddress(string organizationId, string addressId)
        {
            var organization = _organizationDomainService.GetOrganizationEntityById(organizationId);

            if (organization == null)
            {
                return;
            }

            var address = GetOrganizationAddress(organization.OrganizationEntity, new Guid(addressId));

            address?.Address?.Delete();
        }
        public OrganizationModel GetCurrentUserOrganization()
        {
            var currentOrganization = _organizationDomainService.GetCurrentUserOrganizationEntity();

            if (currentOrganization == null)
            {
                return(null);
            }

            if (currentOrganization.ParentOrganizationId == Guid.Empty)
            {
                return(new OrganizationModel(currentOrganization));
            }

            var parentOrganization =
                _organizationDomainService.GetOrganizationEntityById(currentOrganization.ParentOrganizationId.ToString());

            return(new OrganizationModel(currentOrganization)
            {
                ParentOrganization = new OrganizationModel(parentOrganization)
            });
        }
示例#3
0
        public List <ContactViewModel> GetContactsByOrganizationId(string organizationId)
        {
            var currentOrganization = _organizationDomainService.GetOrganizationEntityById(organizationId);

            if (currentOrganization == null)
            {
                return(new List <ContactViewModel>());
            }

            var organizationUsers = _customerDomainService.GetContactsForOrganization(currentOrganization.OrganizationEntity);

            if (currentOrganization.SubOrganizations.Count > 0)
            {
                foreach (var subOrg in currentOrganization.SubOrganizations)
                {
                    var contacts = _customerDomainService.GetContactsForOrganization(subOrg.OrganizationEntity);
                    organizationUsers.AddRange(contacts);
                }
            }

            return(organizationUsers.Select(user => new ContactViewModel(user)).ToList());
        }