Exemplo n.º 1
0
 /// <summary>
 /// Registers the required domain objects.
 /// </summary>
 protected override void RegisterRequiredDomainObjects()
 {
     ContactProviderFactory.CreateAddressProvider().RegisterRequiredObjects();
     ContactProviderFactory.CreateCountryProvider().RegisterRequiredObjects();
     ContactProviderFactory.CreateDocumentProvider().RegisterRequiredObjects();
     ContactProviderFactory.CreateRelationProvider().RegisterRequiredObjects();
 }
Exemplo n.º 2
0
        public void TryDeleteDocumentItem()
        {
            var id = "13F0CBA5-C2E7-4251-86BE-59CC01AD49FD";
            var identificationNumber = "4DDE638F-7632-4A77-8FE8-7B62C06AE154"; // "8dfdd485-68f2-48cd-883b-cc0f43e94fd2";
            var typeId = "A07C5CE3-659C-4FCC-A60B-5CCB6E26B8A4";               // "1b453a59-b318-4e14-8684-83f0b78fa8a1";

            Debug.WriteLine(identificationNumber);
            IContactProvider p = ContactProviderFactory.CreateProvider();
            var savedDocument  = p.SaveDocumentItem(new DocumentItem {
                Id = id, IdentificationNumber = identificationNumber, TypeId = typeId, IssueDate = DateTime.Now
            });

            Debug.WriteLine(savedDocument.ToString());


            using (TransactionScope scope = new TransactionScope())
            {
                p.DeleteDocumentItem(id);
            }
            var result1 = p.GetDocumentItem(id);

            Assert.IsNotNull(result1);


            using (TransactionScope scope = new TransactionScope())
            {
                var result2 = p.DeleteDocumentItem(id);
                scope.Complete();
            }
            var result3 = p.GetDocumentItem(id);

            Assert.IsNull(result3);
        }
Exemplo n.º 3
0
        public void TryGenerateDefaultData()
        {
            Debug.WriteLine("TryGenerateDefaultData started on " + DateTime.Now);
            _logger.Info("TryGenerateDefaultData started on " + DateTime.Now);
            IContactProvider p      = ContactProviderFactory.CreateProvider();
            Result           result = p.GenerateDefaultData();

            if (result.HasErrors)
            {
                Debug.WriteLine(string.Format("Contact.GenerateDefaultData() reported {0} errors", result.ErrorCount));
                _logger.ErrorFormat("GenerateDefaultData reported {0} errors", result.ErrorCount);
            }
            Assert.IsFalse(result.HasErrors, "GenerateDefaultData() generated errors");
            Debug.WriteLine("TryGenerateDefaultData finished on " + DateTime.Now);
        }
Exemplo n.º 4
0
        public void TryGenerate()
        {
            IContactProvider p = ContactProviderFactory.CreateProvider();

            p.GenerateDefaultData();
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the address items.
 /// </summary>
 /// <returns>AddressItem[][].</returns>
 public Address[] GetAddressItems()
 {
     return(ContactProviderFactory
            .CreateAddressProvider()
            .GetAddressItems());
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets the address item for relation.
 /// </summary>
 /// <param name="relationId">The relation identifier.</param>
 /// <param name="addressId">The address identifier.</param>
 /// <returns>AddressItem.</returns>
 public Address GetAddressItemForRelation(string relationId, string addressId)
 {
     return(ContactProviderFactory
            .CreateAddressProvider()
            .GetAddressItemForRelation(relationId, addressId));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Gets the address item.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns>AddressItem.</returns>
 public Address GetAddressItem(string id)
 {
     return(ContactProviderFactory
            .CreateAddressProvider()
            .GetAddressItem(id));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Deletes the address item.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>AddressItem.</returns>
 public Address DeleteAddressItem(Address item)
 {
     return(ContactProviderFactory
            .CreateAddressProvider()
            .DeleteAddressItem(item));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Saves the address item.
 /// </summary>
 /// <param name="addressItem">The address item.</param>
 /// <returns>AddressItem.</returns>
 public Address SaveAddressItem(Address addressItem)
 {
     return(ContactProviderFactory
            .CreateAddressProvider()
            .SaveAddressItem(addressItem));
 }