Esempio n. 1
0
        public static ContactDto ToDto(Contact contact)
        {
            var dto = new ContactDto
            {
                ID = contact.ID,
                FirstName = contact.FirstName,
                LastName = contact.LastName,
                Address = new AddressDto
                {
                    Street1 = contact.Address.Street1,
                    Street2 = contact.Address.Street2,
                    City = contact.Address.City,
                    State = contact.Address.State,
                    Zip = contact.Address.Zip
                },
                Numbers = new ObservableCollection<PhoneNumberDto>()
            };

            foreach(var number in contact.Numbers)
            {
                dto.Numbers.Add(new PhoneNumberDto
                {
                    Number = number.Number,
                    Type = number.Type
                });
            }

            return dto;
        }
Esempio n. 2
0
 public static List<TestContact> BuildContactsFromDataBaseData(string idPerson)
 {
     List<TestContact> contacts = new List<TestContact>();
     using (SqlConnection connection = Global.GetSqlConnection())
     {
         string findPatient = "SELECT * FROM Contact WHERE IdPerson = '" + idPerson + "'";
         SqlCommand person = new SqlCommand(findPatient, connection);
         using (SqlDataReader contactReader = person.ExecuteReader())
         {
             while (contactReader.Read())
             {
                 ContactDto cont = new ContactDto();
                 if (contactReader["IdContactType"].ToString() != "")
                     cont.IdContactType = Convert.ToByte(contactReader["IdContactType"]);
                 if (contactReader["ContactValue"].ToString() != "")
                     cont.ContactValue = Convert.ToString(contactReader["ContactValue"]);
                 TestContact contact = new TestContact(cont);
                 contacts.Add(contact);
             }
         }
     }
     if (contacts.Count != 0)
         return contacts;
     else
         return null;
 }
Esempio n. 3
0
        public static Contact ToContact(ContactDto dto)
        {
            var contact = new Contact
            {
                ID = dto.ID,
                FirstName = dto.FirstName,
                LastName = dto.LastName,
            };

            contact.Address.Street1 = dto.Address.Street1;
            contact.Address.Street2 = dto.Address.Street2;
            contact.Address.City = dto.Address.City;
            contact.Address.State = dto.Address.State;
            contact.Address.Zip = dto.Address.Zip;

            foreach(var number in dto.Numbers)
            {
                contact.AddPhoneNumber(new PhoneNumber
                {
                    Number = number.Number,
                    Type = number.Type
                });
            }

            return contact;
        }
        public void UpdateContact(ContactDto contact)
        {
            var found = (from existing in _contacts
                         where contact.ID == existing.ID
                         select existing).FirstOrDefault();

            if(found != null)
                _contacts.Remove(found);

            _contacts.Add(contact);
        }
Esempio n. 5
0
        private void AssertGetDataIsSameAsPostData(ContactDto getData, ContactDto postData)
        {
            Assert.That(getData.Id, Is.EqualTo(postData.Id), "Incorrect Id");
            Assert.That(getData.Name, Is.EqualTo(postData.Name), "Incorrect Name");

            Assert.That(
                getData.Communications.Select(x => x.Address).ToArray(),
                Is.EqualTo(postData.Communications.Select(x => x.Address).ToArray()),
                "Incorrect Communications.Addresses");

            Assert.That(
                getData.Communications.Select(x => x.Method).ToArray(),
                Is.EqualTo(postData.Communications.Select(x => x.Method).ToArray()),
                "Incorrect Communications.Methods");
        }
Esempio n. 6
0
        public async Task <ActionResult> Edit([FromBody] ContactModel contactModel)
        {
            var contactDto = new ContactDto
            {
                Id          = contactModel.Id,
                Name        = contactModel.Name,
                IsDeleted   = contactModel.IsDeleted,
                PhoneNumber = contactModel.PhoneNumber,
                Email       = contactModel.Email
            };

            await _contactService.EditContact(contactDto, GetUserId());

            return(Ok());
        }
Esempio n. 7
0
        public static ContactDto AssembleDto(this Contact data)
        {
            var dto = new ContactDto
            {
                Surname       = data.Surname,
                Forename      = data.Forename,
                DisplayName   = data.DisplayName(),
                Telephone     = data.Telephone,
                ID            = data.ID,
                EmailAddress  = data.EmailAddress,
                ContactTypeID = data.ContactTypeID
            };

            return(dto);
        }
        public async Task UpdateNonExistingContact()
        {
            var databaseSizeBeforeUpdate = await _contactRepository.CountAsync();

            // If the entity doesn't have an ID, it will throw BadRequestAlertException
            ContactDto _contactDto = _mapper.Map <ContactDto>(_contact);
            var        response    = await _client.PutAsync("/api/contacts", TestUtil.ToJsonContent(_contactDto));

            response.StatusCode.Should().Be(HttpStatusCode.BadRequest);

            // Validate the Contact in the database
            var contactList = await _contactRepository.GetAllAsync();

            contactList.Count().Should().Be(databaseSizeBeforeUpdate);
        }
Esempio n. 9
0
        public void Execute(ContactDto request)
        {
            _validator.ValidateAndThrow(request);

            var contact = new Contact
            {
                Address = request.Address,
                Phone   = request.Phone,
                Fax     = request.Fax,
                Email   = request.Email
            };

            _context.Contact.Add(contact);
            _context.SaveChanges();
        }
Esempio n. 10
0
        public ActionResult <ContactDto> Update([FromBody] ContactDto dto)
        {
            // update record
            var obj = _mapper.Map <Contact>(dto);

            obj = _repository.Update(obj);
            if (obj == null)
            {
                return(new StatusCodeResult(StatusCodes.Status410Gone));
            }

            // map and return updated recrod
            dto = _mapper.Map <ContactDto>(obj);
            return(Ok(dto));
        }
Esempio n. 11
0
        public async Task EditContact(ContactDto contactDto, string userId)
        {
            var contact = await _contactRepository.Get(userId, contactDto.Id);

            if (contact == null)
            {
                throw new ArgumentNullException(nameof(contact));
            }

            contact.Name        = contactDto.Name;
            contact.PhoneNumber = contact.PhoneNumber;
            contact.Email       = contact.Email;

            await _contactRepository.EditContact(contact);
        }
Esempio n. 12
0
        public ContactDto Create(string value)
        {
            ContactDto dto = new ContactDto {
                Value = value
            };

            bool success = _dbManager.CreateHomeContact(dto);

            if (!success)
            {
                throw new Exception("Unable to create DTO");
            }

            return(dto);
        }
        public async Task <IHttpActionResult> UpdateAsync(int id, ContactDto contact)
        {
            var contactInDb = await _contactRepository.GetAsync(id);

            if (contactInDb == null)
            {
                return(NotFound());
            }

            _contactRepository.Add(contact.Map <Contact>());

            await UnitOfWork.CompleteAsync();

            return(Ok());
        }
Esempio n. 14
0
        /// <summary>
        /// Contact Upd
        /// </summary>
        public async Task <ContactDto> ContactUpd(ContactDto dtoItem, string userGuid, string serviceGroupGuid)
        {
            var item = new ContactEntity
            {
                contact_guid      = dtoItem.contact_guid,
                contact_type_guid = dtoItem.contact_type_guid,
                contact_info      = JsonDataExtensions.EntityToJsonData(dtoItem)
            };

            var contact = await ContactInfo.ContactUpd(item, userGuid, serviceGroupGuid);

            var result = JsonDataExtensions.JsonToEntityData <ContactDto>(contact.contact_info);

            return(result);
        }
        public ContactDto GetContact2()
        {
            ContactDto dto = new ContactDto();

            dto.Salutation           = Salutation.Mrs;
            dto.GivenName            = "Mary";
            dto.FamilyName           = "Smith";
            dto.OrganisationName     = "Mr. & Mrs. Smith";
            dto.OrganisationPosition = "Director";
            dto.Email       = "*****@*****.**";
            dto.MainPhone   = "02 4444 4444";
            dto.MobilePhone = "0444 444 444";

            return(dto);
        }
        public void UpdateWithDefaultPurchaseDiscount()
        {
            CrudProxy  proxy   = new ContactProxy();
            ContactDto contact = GetContact1();

            contact.DefaultPurchaseDiscount = 15.75M;
            proxy.Insert(contact);

            contact.DefaultPurchaseDiscount = 14.75M;
            proxy.Update(contact);

            ContactDto fromDb = (ContactDto)proxy.GetByUid(contact.Uid);

            AssertEqual(contact, fromDb);
        }
Esempio n. 17
0
        public async Task <IHttpActionResult> GetContact(int id)
        {
            Contact contact = await _contactService.GetByIdAsync(id);

            if (contact == null)
            {
                return(NotFound());
            }

            ContactDto contactDto = new ContactDto();

            Mapper.Map(contact, contactDto);

            return(Ok(contactDto));
        }
        public void InsertWithCustomField()
        {
            CrudProxy  proxy = new ContactProxy();
            ContactDto dto1  = this.GetContact1();

            dto1.CustomField1 = "This is custom field 1";
            dto1.CustomField2 = "This is custom field 2";
            proxy.Insert(dto1);

            Assert.IsTrue(dto1.Uid > 0, "Uid must be > 0 after insert.");

            dto1 = (ContactDto)proxy.GetByUid(dto1.Uid);
            Assert.AreEqual("This is custom field 1", dto1.CustomField1, "Incorrect custom field 1");
            Assert.AreEqual("This is custom field 2", dto1.CustomField2, "Incorrect custom field 2");
        }
Esempio n. 19
0
        public async Task <Contact> Update(ContactDto contactDto)
        {
            var contact = await _db.Contacts.SingleOrDefaultAsync(t => t.Id == contactDto.Id);

            if (contact == null)
            {
                throw new InvalidDataException($"Unable to find Todo with ID: {contactDto.Id}");
            }

            contact = _autoMapper.Map(contactDto, contact);
            _db.Contacts.Update(contact);
            await _db.SaveChangesAsync(CancellationToken.None);

            return(contact);
        }
Esempio n. 20
0
        /// <summary>
        /// Update With Attach the ContactEntiy.
        /// </summary>
        /// <param name="Entiy">The Entiy.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</return
        public bool UpdateWithAttachEntiy(ContactDto t)
        {
            var dbentity = typeAdapter.ConvertDtoToEntities(t);

            if (StateHelpers.GetEquivalentEntityState(dbentity.State) == StateHelpers.GetEquivalentEntityState(State.Detached))
            {
                entiesrepository.Attach(dbentity);
            }

            dbentity.State = State.Modified;
            context.ChangeObjectState <Contact>(dbentity, StateHelpers.GetEquivalentEntityState(dbentity.State));

            uow.Save();
            return(true);
        }
Esempio n. 21
0
        public async Task <Response> CreateResponseAsync()
        {
            try
            {
                ContactDto resultContact = await contactsService.CreateOrEditContactAsync(
                    ContactConverter.GetContactDto(request.Contact, clientConnection.UserId.GetValueOrDefault())).ConfigureAwait(false);

                return(new ContactsResponse(request.RequestId, ContactConverter.GetContactVm(resultContact)));
            }
            catch (ObjectDoesNotExistsException ex)
            {
                Logger.WriteLog(ex);
                return(new ResultResponse(request.RequestId, "User not found.", ObjectsLibrary.Enums.ErrorCode.ObjectDoesNotExists));
            }
        }
        //Add new Contact
        public bool AddContact(ContactDto contactDetail)
        {
            var contactDataService = _iocContext.Resolve <IContactDataService>();
            var contact            = _iocContext.Resolve <IContact>();

            contact.FirstName   = contactDetail.FirstName;
            contact.LastName    = contactDetail.LastName;
            contact.PhoneNumber = contactDetail.PhoneNumber;
            contact.Address     = contactDetail.Address;
            contact.DirectoryId = contactDetail.DirectoryId;
            //ContactDataService.AddContact(contact);
            var ContactExistInDirectory = contactDataService.AddContact(contact);

            return(ContactExistInDirectory);
        }
Esempio n. 23
0
        public IHttpActionResult CreateContact(ContactDto contactDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var contact = Mapper.Map <ContactDto, Contact>(contactDto);

            _context.Contacts.Add(contact);
            _context.SaveChanges();
            contactDto.Id = contact.Id;

            return(Created(new Uri(Request.RequestUri + "/" + contact.Id), contactDto));
        }
Esempio n. 24
0
        public bool EditContactById(int contactId, ContactDto contact)
        {
            try
            {
                this.addressRepository = new AddressRepository(_dbContext);
                var contactTmp = _dbContext.Contact.FirstOrDefault(x => x.Contact1 == contactId);
                if (contactTmp != null)
                {
                    if (contact.Address != null)
                    {
                        DC.AddressRepository.AddressDto addresss = null;
                        addresss          = addressRepository.CreateAddress(contact.Address);
                        contact.AddressId = addresss.AddressId;
                    }

                    contactTmp.FirsttName   = contact.FirsttName;
                    contactTmp.LastName     = contact.LastName;
                    contactTmp.ModifiedDate = DateTime.Now;
                    contactTmp.AddressId    = contact.AddressId;
                    //delete all phones and emails
                    _dbContext.RemoveRange(_dbContext.Phone.Where(x => x.ContactId == contactTmp.Contact1));
                    _dbContext.RemoveRange(_dbContext.Email.Where(x => x.ContactId == contactTmp.Contact1));
                    //create new phones and emails
                    foreach (var emailDto in contact.Emails)
                    {
                        _dbContext.Add(new Email()
                        {
                            ContactId = contactTmp.Contact1, EmailAddress = emailDto.EmailAddress
                        });
                    }
                    foreach (var phoneDto in contact.Phones)
                    {
                        _dbContext.Add(new Phone()
                        {
                            ContactId = contactTmp.Contact1, PhoneNumber = phoneDto.PhoneNumber
                        });
                    }
                    _dbContext.SaveChanges();
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                //log ex
                throw new Exception(ex.Message);
            }
        }
        public IHttpActionResult CreateContact(ContactDto contactDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid data."));
            }

            var contact = Mapper.Map <Contact>(contactDto);

            _unitOfWork.Contacts.AddContact(contact);
            _unitOfWork.Complete();

            contactDto.Id = contact.Id;

            return(Created(new Uri(Request.RequestUri + "/" + contact.Id), contactDto));
        }
Esempio n. 26
0
        public async Task UpdateContact()
        {
            var updated = new ContactDto()
            {
                Id         = DestinatairePredefinedIds.ContactIds.ToBeUpdated,
                Email      = Guid.NewGuid().ToString(),
                Name       = Guid.NewGuid().ToString(),
                FamilyName = Guid.NewGuid().ToString(),
            };
            var response = await Client.PutAsync($"/Contacts/{DestinatairePredefinedIds.ContactIds.ToBeUpdated}",
                                                 new StringContent(JsonConvert.SerializeObject(updated), Encoding.UTF8, "application/json"));

            response.EnsureSuccessStatusCode();

            Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
        }
Esempio n. 27
0
        public async Task <int> SaveContact(ContactDto contact, CancellationToken cancellationToken = default)
        {
            var contactDomain = new Contact
            {
                Id      = contact.Id,
                Name    = contact.Name,
                Email   = contact.Email,
                Subject = contact.Subject,
                Message = contact.Message
            };
            await _context.Contacts.AddAsync(contactDomain, cancellationToken);

            await _context.SaveChangesAsync(cancellationToken);

            return(contactDomain.Id);
        }
Esempio n. 28
0
        /// <summary>
        /// I used simple mappers to map the registers here
        /// </summary>
        /// <param name="contactDto"></param>
        /// <returns></returns>
        public void AddContact(ContactDto contactDto) //divide Dtos
        {
            Contact contact;

            if (contactDto.IsCustomer)
            {
                contact = contactDto.ToCustomerEntity();
            }
            else
            {
                contact = contactDto.ToSupplierEntity();
            }

            //_customerRepository.InsertContact(customer);
            _contactRepository.InsertContact(contact);
        }
        public static EditContactViewModel ConvertToViewModel(this ContactDto contact)
        {
            var returnVM = new EditContactViewModel
            {
                EMail                 = contact.EMail ?? "N/A",
                FirstName             = contact.FirstName ?? "N/A",
                LastName              = contact.LastName ?? "N/A",
                TelephoneNumber_Entry = contact.TelephoneNumber_Entry ?? "N/A",
                Created               = contact.CreatedUtc.LocalDateTime,
                CreatedBy             = contact.CreatedBy ?? "N/A",
                Modified              = contact.ModifiedUtc?.LocalDateTime,
                ModifiedBy            = contact.ModifiedBy ?? "N/A"
            };

            return(returnVM);
        }
Esempio n. 30
0
        public IActionResult UpdateContact([FromBody] ContactDto contact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Mapper.Map <Entities.Contact>(contact);

            if (!_contactListRepository.Save())
            {
                return(StatusCode(500, "A problem happened while handling your request."));
            }

            return(NoContent());
        }
Esempio n. 31
0
        public void DaysBetween_InputBillAndPaul_ReturnDaysBetween()
        {
            var contact1 = new ContactDto()
            {
                Name = "John Snow", Gender = Gender.Male, BirthDate = DateTime.Parse("16/03/77")
            };
            var contact2 = new ContactDto()
            {
                Name = "Jimmy Neutron", Gender = Gender.Male, BirthDate = DateTime.Parse("15/01/85")
            };
            var expected = 2862;

            var actual = _addressBookService.GetDaysBetweenTwoPersons(contact1, contact2);

            Assert.Equal(expected, actual);
        }
        public async Task <IHttpActionResult> AddContact([FromBody] ContactDto contact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                return(Ok(await _contactService.AddContact(contact)));
            }
            catch (ArgumentException)
            {
                return(BadRequest());
            }
        }
Esempio n. 33
0
        public bool EditContact(long id, ContactDto contact)
        {
            if (contact == null)
            {
                return(false);
            }

            var contactToEdit = this._contacts.FirstOrDefault(c => c.Id == id);

            contactToEdit.FirstName   = contact.FirstName;
            contactToEdit.LastName    = contact.LastName;
            contactToEdit.PhoneNumber = contact.PhoneNumber;
            contactToEdit.Status      = contact.Status;
            contactToEdit.Email       = contact.Email;
            return(true);
        }
Esempio n. 34
0
        public JsonResult EditorForm(ContactDto model)
        {
            HttpPostedFileBase avatar = HttpContext.Request.Files["AvatarFile"];

            byte[] avatarBytes = null;
            if (avatar != null && avatar.ContentLength > 0)
            {
                MemoryStream target = new MemoryStream();
                avatar.InputStream.CopyTo(target);
                avatarBytes = target.ToArray();
            }

            var result = Task.Run(() => _xconnectService.UpdateContactInformation(model.ContactId, model.PersonalInformation.FirstName, model.PersonalInformation.MiddleName, model.PersonalInformation.LastName, model.PersonalInformation.Title, model.PersonalInformation.JobTitle, model.Phone, model.Email, model.PersonalInformation.Gender, avatarBytes)).Result;

            return(Json(result));
        }
Esempio n. 35
0
 public static List<TestContact> BuildContactsFromDataBaseData(string idPerson)
 {
     List<TestContact> contacts = new List<TestContact>();
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string findPatient = "SELECT * FROM public.Contact WHERE id_person = '" + idPerson + "'";
         NpgsqlCommand person = new NpgsqlCommand(findPatient, connection);
         using (NpgsqlDataReader contactReader = person.ExecuteReader())
         {
             while (contactReader.Read())
             {
                 ContactDto cont = new ContactDto();
                 if (contactReader["contact_value"] != DBNull.Value)
                     cont.ContactValue = Convert.ToString(contactReader["contact_value"]);
                 TestContact contact = new TestContact(cont);
                 if (contactReader["id_contact_type"] != DBNull.Value)
                     contact.contactType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(contactReader["id_contact_type"]));
                 contacts.Add(contact);
             }
         }
     }
     return (contacts.Count != 0) ? contacts : null;
 }
        private static void CreateDummyData()
        {
            var rob = new ContactDto
            {
                ID = Guid.NewGuid(),
                FirstName = "Rob",
                LastName = "Eisenberg",
                Address = new AddressDto
                {
                    Street1 = "1234 Main Street",
                    City = "Some City",
                    State = "A State",
                    Zip = "12345"
                },
                Numbers = new List<PhoneNumberDto>
                {
                    new PhoneNumberDto {Number = "(123) 456-7890", Type = PhoneNumberType.Cell},
                    new PhoneNumberDto {Number = "(980) 765-4321", Type = PhoneNumberType.Work}
                }
            };

            _contacts.Add(rob);
        }
Esempio n. 37
0
 public void AddPatientWithContacts()
 {
     TestPixServiceClient client = new TestPixServiceClient();
     PatientDto patient = new PatientDto();
     patient.FamilyName = "Жукин";
     patient.GivenName = "Дмитрий";
     patient.BirthDate = new DateTime(1983, 01, 07);
     patient.Sex = 1;
     patient.IdPatientMIS = "123456789010";
     ContactDto contact = new ContactDto();
     contact.IdContactType = 1;
     contact.ContactValue = "89626959434";
     ContactDto contact2 = new ContactDto();
     contact2.IdContactType = 1;
     contact2.ContactValue = "89525959544";
     patient.Contacts = new ContactDto[] { contact, contact2 };
     client.AddPatient(Global.GUID, "1.2.643.5.1.13.3.25.78.118", patient);
     if (Global.errors == "")
         Assert.Pass();
     else
         Assert.Fail(Global.errors);
 }
Esempio n. 38
0
 public TestContact(ContactDto c)
 {
     contact = c;
     if (contact.ContactType != null)
         contactType = new TestCoding(contact.ContactType);
 }
Esempio n. 39
0
 public TestContact(ContactDto c)
 {
     contact = c;
     contactType = new TestCoding(contact.ContactType);
 }
Esempio n. 40
0
 public void AddFullPatient()
 {
     TestPixServiceClient client = new TestPixServiceClient();
     PatientDto patient = new PatientDto();
     patient.BirthDate = new DateTime(1983, 01, 07);
     patient.DeathTime = new DateTime(2020, 02, 15);
     patient.FamilyName = "Жукин";
     patient.GivenName = "Дмитрий";
     patient.IdBloodType = 1;
     patient.IdLivingAreaType = 1;
     patient.IdPatientMIS = "123456789010";
     patient.MiddleName = "Артемович";
     patient.Sex = 1;
     patient.SocialGroup = 2;
     patient.SocialStatus = "2.11";
     PixServise.DocumentDto document = new PixServise.DocumentDto();
     document.IdDocumentType = 14;
     document.DocS = "1311";
     document.DocN = "113131";
     document.ExpiredDate = new DateTime(1999, 11, 12);
     document.IssuedDate = new DateTime(2012, 11, 12);
     document.ProviderName = "УФМС";
     document.RegionCode = "1221";
     patient.Documents = new PixServise.DocumentDto[] { document };
     PixServise.AddressDto address = new PixServise.AddressDto();
     address.IdAddressType = 1;
     address.StringAddress = "Улица Ленина 47";
     address.Street = "01000001000000100";
     address.Building = "1";
     address.City = "0100000000000";
     address.Appartment = "1";
     address.PostalCode = 1;
     address.GeoData = "1";
     PixServise.AddressDto address2 = new PixServise.AddressDto();
     address2.IdAddressType = 2;
     address2.StringAddress = "Улица Партизанская 47";
     address2.Street = "01000001000000100";
     address2.Building = "1";
     address2.City = "0100000000000";
     address2.Appartment = "1";
     address2.PostalCode = 1;
     address2.GeoData = "1";
     patient.Addresses = new PixServise.AddressDto[] { address, address2 };
     BirthPlaceDto birthplace = new BirthPlaceDto();
     birthplace.City = "Тутинск";
     birthplace.Country = "маленькая";
     birthplace.Region = "БОЛЬШОЙ";
     patient.BirthPlace = birthplace;
     ContactDto contact = new ContactDto();
     contact.IdContactType = 1;
     contact.ContactValue = "89626959434";
     ContactDto contact2 = new ContactDto();
     contact2.IdContactType = 1;
     contact2.ContactValue = "89525959544";
     patient.Contacts = new ContactDto[] { contact, contact2 };
     PixServise.JobDto job = new PixServise.JobDto();
     job.OgrnCode = "0100000000000"; // некорректный код
     job.CompanyName = "OOO 'МИГ'";
     job.Sphere = "Я";
     job.Position = "Я";
     job.DateStart = new DateTime(2003, 1, 1);
     job.DateEnd = new DateTime(2004, 1, 1);
     patient.Job = job;
     PrivilegeDto privilege = new PrivilegeDto();
     privilege.DateStart = new DateTime(1993, 01, 02);
     privilege.DateEnd = new DateTime(2020, 01, 02);
     privilege.IdPrivilegeType = 10;
     patient.Privilege = privilege;
     client.AddPatient(Global.GUID, "1.2.643.5.1.13.3.25.78.118", patient);
     if (Global.errors == "")
         Assert.Pass();
     else
         Assert.Fail(Global.errors);
 }
Esempio n. 41
0
 public void UpdatePatient()
 {
     TestPixServiceClient client = new TestPixServiceClient();
     PatientDto patient = new PatientDto();
     patient.FamilyName = "Жукин";
     patient.GivenName = "АЛЕКСЕЙ";
     patient.BirthDate = new DateTime(1983, 01, 07);
     patient.Sex = 1;
     patient.IdPatientMIS = "12345678900029";
     PixServise.DocumentDto document = new PixServise.DocumentDto();
     document.IdDocumentType = 14;
     document.DocS = "1311";
     document.DocN = "113131";
     document.ProviderName = "УФМС";
     patient.Documents = new PixServise.DocumentDto[] { document };
     PixServise.AddressDto address = new PixServise.AddressDto();
     address.IdAddressType = 1;
     address.StringAddress = "ТУТ";
     patient.Addresses = new PixServise.AddressDto[] { address };
     ContactDto cont = new ContactDto();
     cont.IdContactType = 1;
     cont.ContactValue = "89519435454";
     ContactDto cont2 = new ContactDto();
     cont2.IdContactType = 1;
     cont2.ContactValue = "89519435455";
     patient.Contacts = new ContactDto[] { cont, cont2 };
     client.AddPatient(Global.GUID, "1.2.643.5.1.13.3.25.78.118", patient);
     client.UpdatePatient(Global.GUID, "1.2.643.5.1.13.3.25.78.118", patient);
     PatientDto patient2 = new PatientDto();
     PixServise.DocumentDto document2 = new PixServise.DocumentDto();
     document2.IdDocumentType = 14;
     document2.DocS = "1311";
     document2.DocN = "113131";
     document2.ProviderName = "УФМС";
     patient2.Documents = new PixServise.DocumentDto[] { document2 };
     PixServise.AddressDto address2 = new PixServise.AddressDto();
     address2.IdAddressType = 1;
     address2.StringAddress = "ТУТ";
     patient2.FamilyName = "Сидоров";
     patient2.Addresses = new PixServise.AddressDto[] { address2 };
     ContactDto cont3 = new ContactDto();
     cont3.IdContactType = 1;
     cont3.ContactValue = "89519435456";
     patient2.Contacts = new ContactDto[] { cont3 };
     patient2.IdPatientMIS = patient.IdPatientMIS;
     client.UpdatePatient(Global.GUID, "1.2.643.5.1.13.3.25.78.118", patient2);
     if (Global.errors == "")
         Assert.Pass();
     else
         Assert.Fail(Global.errors);
 }
Esempio n. 42
0
 public TestContact(ContactDto c)
 {
     contact = c;
 }