public bool ContactConfigurationExistsForContact(ContactConfiguration contactConfiguration, int contactId)
        {
            Contact contact = _context.Contacts.FirstOrDefault(c => c.Id == contactId);

            return(contact?.ContactConfigurations.FirstOrDefault(cc =>
                                                                 cc.FacilityId == contactConfiguration.FacilityId &&
                                                                 cc.ContactTypeId == contactConfiguration.ContactTypeId) != null);
        }
        /// <summary>构造函数</summary>
        public ContactProvider()
        {
            this.configuration = ContactConfigurationView.Instance.Configuration;

            this.ibatisMapping = this.configuration.Keys["IBatisMapping"].Value;

            this.ibatisMapper = ISqlMapHelper.CreateSqlMapper(this.ibatisMapping, true);
        }
        public void AddContactConfigurationForContact(ContactConfiguration contactConfiguration, int contactId)
        {
            Contact contact = _context.Contacts.SingleOrDefault(c => c.Id == contactId);

            if (contact == null)
            {
                throw new InvalidOperationException("Contact not found.");
            }

            contact.ContactConfigurations.Add(contactConfiguration);
        }
        /// <summary>构造函数</summary>
        public ContactService()
        {
            this.configuration = ContactConfigurationView.Instance.Configuration;

            // 创建对象构建器(Spring.NET)
            string springObjectFile = this.configuration.Keys["SpringObjectFile"].Value;

            SpringObjectBuilder objectBuilder = SpringObjectBuilder.Create(ContactConfiguration.ApplicationName, springObjectFile);

            // 创建数据提供器
            this.provider = objectBuilder.GetObject <IContactProvider>(typeof(IContactProvider));
        }
Beispiel #5
0
 public static ContactConfigurationRM GetContactConfigurationRM(ContactConfiguration contactConfiguration)
 {
     return(new ContactConfigurationRM
     {
         Id = contactConfiguration.Id,
         ContactId = contactConfiguration.ContactId,
         ContactTypeId = contactConfiguration.ContactTypeId,
         EndDate = contactConfiguration.EndDate,
         Priority = contactConfiguration.Priority,
         StartDate = contactConfiguration.StartDate,
         StatusCodeId = contactConfiguration.StatusCodeId
     });
 }
        private ContactConfigurationRM CreateContactConfigurationForContact(Commands.V1.Contact.ContactConfiguration.CreateForContact cmd)
        {
            ContactConfiguration contactConfiguration = ContactConfiguration.Create(_contactConfigurations++, cmd.StartDate,
                                                                                    cmd.StatusCodeId, cmd.EndDate, cmd.ContactId, cmd.FacilityId, cmd.ContactTypeId, cmd.Priority);

            if (_repository.ContactConfigurationExistsForContact(contactConfiguration, cmd.ContactId))
            {
                throw new InvalidOperationException($"ContactConfiguration with ContactId {cmd.ContactId} already exists");
            }

            _repository.AddContactConfigurationForContact(contactConfiguration, cmd.ContactId);

            return(Conversions.GetContactConfigurationRM(contactConfiguration));
        }
Beispiel #7
0
        public Task <ContactConfigurationRM> GetContactConfigurationForContact(int associateId, int contactId,
                                                                               int contactConfigurationId)
        {
            ValidateAssociateExists(associateId);
            Contact contact = ValidateContactExists(contactId);

            ContactConfiguration contactConfiguration =
                contact.ContactConfigurations.SingleOrDefault(cc => cc.Id == contactConfigurationId);

            if (contactConfiguration == null)
            {
                throw new InvalidOperationException("ContactConfiguration not found.");
            }

            return(GetContactConfiguration(contactConfigurationId));
        }
        /// <summary>重新加载</summary>
        private void Reload()
        {
            if (this.restartCount > 0)
            {
                // 重新加载配置信息
                ContactConfigurationView.Instance.Reload();
            }

            this.configuration = ContactConfigurationView.Instance.Configuration;

            // 创建对象构建器(Spring.NET)
            string springObjectFile = this.configuration.Keys["SpringObjectFile"].Value;

            SpringObjectBuilder objectBuilder = SpringObjectBuilder.Create(ContactConfiguration.ApplicationName, springObjectFile);

            // 创建数据服务对象
            this.m_ContactService = objectBuilder.GetObject <IContactService>(typeof(IContactService));
        }
Beispiel #9
0
 protected override void OnModelCreating(ModelBuilder builder)
 {
     // define Contact
     ContactConfiguration.Configure(builder);
 }
 public void AddContactConfigurationForContact(int contactId, ContactConfiguration contactConfiguration)
 {
     throw new NotImplementedException();
 }
 public bool ContactConfigurationExistsForContact(ContactConfiguration contactConfiguration, int contactId)
 {
     throw new NotImplementedException();
 }