public bool UpdateContactDetailForLandlord(string landlordReference, string contactDetailReference, ContactDetail contactDetail)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(contactDetailReference).IsNotNullOrEmpty();

            return _contactDetailRepository.UpdateContactDetailForLandlord(landlordReference, contactDetailReference, contactDetail);
        }
		public ContactDetail Put(ContactDetail request)
		{
			PersonRepository personRepository = GetPersonRepository();
			EntityRepository entityRepository = GetEntityRepository();


			PersonEntity personEntity = personRepository.Read(request.PersonId);
			EntityEntity entity = entityRepository.Read(request.EntityId);

			entity.Name = request.EntityName;
			entity.EntityTypeId = request.EntityTypeId;

			personEntity.OccupationNameId = request.OccupationNameId;
			personEntity.TitleId = request.TitleId;
			personEntity.GenderTypeId = request.GenderTypeId;
			personEntity.SurnamePrefix = request.SurnamePrefix;
			personEntity.Surname = request.Surname;
			personEntity.MaidenNamePrefix = request.MaidenNamePrefix;
			personEntity.Nationality = request.Nationality;
			personEntity.DateOfBirth = request.DateOfBirth;
			personEntity.PlaceOfBirth = request.PlaceOfBirth;

			personRepository.Update(personEntity);
			entityRepository.Update(entity);

			List<PersonEntity> personEntities = personRepository.Read();

			return CreateGetContactDetails(entity, personEntities);
		}
        public string CreateContactDetailsForLandlord(string landlordReference, ContactDetail contactDetail)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(contactDetail).IsNotNull();

            var result = _contactDetailRepository.CreatContactDetailForLandlord(landlordReference, contactDetail.CreateReference(_referenceGenerator));

            return result ? contactDetail.ContactDetailReference : null;
        }
		public ContactDetail Get(ContactDetail request)
		{
			PersonRepository personRepository = GetPersonRepository();
			EntityRepository entityRepository = GetEntityRepository();

			EntityEntity entityEntity = entityRepository.Read(request.EntityId);
		

			List<PersonEntity> personEntities = personRepository.Read();

			return CreateGetContactDetails(entityEntity, personEntities);
		}
        public bool CreatContactDetailForLandlord(string landlordReference, ContactDetail contactDetail)
        {
            var landlord =
                _propertiesContext.Landlords.Active()
                    .Include(x => x.AlternateContactDetails)
                    .FirstOrDefault(x => x.LandlordReference == landlordReference);

            if (landlord.IsNull())
                return false;

            landlord.AlternateContactDetails.Add(contactDetail);

            return _propertiesContext.SaveChanges() > 0;
        }
		public ContactDetail Post(ContactDetail request)
		{
			PersonRepository personRepository = GetPersonRepository();
			EntityRepository entityRepository = GetEntityRepository();

			PersonEntity personEntity = new PersonEntity();
			EntityEntity entity = new EntityEntity();

			//Create entity 
			entity.Name = request.EntityName;
			entity.EntityTypeId = request.EntityTypeId;
			entity.DeletedDate = DateTime.MinValue;

			entity = entityRepository.Create(entity);

			personEntity.EntityId = entity.Id;
			personEntity.OccupationNameId = request.OccupationNameId;
			personEntity.TitleId = request.TitleId;
			personEntity.GenderTypeId = request.GenderTypeId;
			personEntity.SurnamePrefix = request.SurnamePrefix;
			personEntity.Surname = request.Surname;
			personEntity.MaidenNamePrefix = request.MaidenNamePrefix;
			personEntity.Nationality = request.Nationality;
			personEntity.DateOfBirth = request.DateOfBirth;
			personEntity.PlaceOfBirth = request.PlaceOfBirth;
			personEntity.DeletedDate = DateTime.MinValue;

			try
			{
				personEntity = personRepository.Create(personEntity);
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex);
			}
			
			List<PersonEntity> personEntities = personRepository.Read();

			return CreateGetContactDetails(entity, personEntities);
		}
        public ActionResult Edit(Guid id)
        {
            ContactDetail contactDetail = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(new WebApiHelper().GetWebApiUri());
                //HTTP GET
                var responseTask = client.GetAsync("Contact?id=" + id.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ContactDetail>();
                    readTask.Wait();

                    contactDetail = readTask.Result;
                }
            }
            return(View(contactDetail));
        }
Пример #8
0
        private void updatePeerAsn(int asn)
        {
            string phone       = "9999999";
            string email       = $"noc{asn}@contoso.com";
            var    contactInfo = new ContactDetail(Role.Noc, email, phone);
            var    peerInfo    = new PeerAsn(peerAsnProperty: asn, peerContactDetail: new List <ContactDetail> {
                contactInfo
            }, peerName: $"Contoso{asn}", validationState: "Approved");

            try
            {
                var result  = this.Client.PeerAsns.CreateOrUpdate(peerInfo.PeerName, peerInfo);
                var peerAsn = this.Client.PeerAsns.Get(peerInfo.PeerName);
                Assert.NotNull(peerAsn);
            }
            catch (Exception exception)
            {
                var peerAsn = this.Client.PeerAsns.ListBySubscription();
                Assert.NotNull(peerAsn);
                Assert.NotNull(exception);
            }
        }
Пример #9
0
        private void btnRemoveStudentClientInfo_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Are You Sure?", "Remove Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

            if (res == DialogResult.Yes)
            {
                using (var Dbconnection = new MCDEntities())
                {
                    Employee      CurrentEmployeeObj = (Employee)employeeBindingSource.Current;
                    ContactDetail ContactDetailObj   = (ContactDetail)contactDetailsBindingSource.Current;

                    Dbconnection.Employees.Attach(CurrentEmployeeObj);

                    Dbconnection.ContactDetails.Attach(ContactDetailObj);

                    CurrentEmployeeObj.Individual.ContactDetails.Remove(ContactDetailObj);

                    Dbconnection.SaveChanges();
                };
                this.refreshEmployeeContactDetails();
            }
        }
Пример #10
0
        /// <summary>
        /// 注册移除现有联系人详细信息
        /// </summary>
        /// <param name="employee">要移除联系人详细信息的雇员</param>
        /// <param name="detail">要移除的联系人详细信息</param>
        /// <exception cref="InvalidOperationException">如果此 UnitOfWork 未跟踪雇员,则引发异常</exception>
        /// <exception cref="InvalidOperationException">如果此 UnitOfWork 未跟踪联系人详细信息,则引发异常</exception>
        public void RemoveContactDetail(Employee employee, ContactDetail detail)
        {
            if (employee == null)
            {
                throw new ArgumentNullException("employee");
            }

            if (detail == null)
            {
                throw new ArgumentNullException("detail");
            }

            this.CheckEntityBelongsToUnitOfWork(detail);
            this.CheckEntityBelongsToUnitOfWork(employee);
            if (!employee.ContactDetails.Contains(detail))
            {
                throw new InvalidOperationException("The supplied ContactDetail does not belong to the supplied Employee");
            }

            employee.ContactDetails.Remove(detail);
            this.underlyingContext.ContactDetails.DeleteObject(detail);
        }
Пример #11
0
        public HttpResponseMessage Create(HttpRequestMessage request, ContactDetailViewModel contactDetailVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    var newContactDetail = new ContactDetail();
                    newContactDetail.UpdateContactDetail(contactDetailVm);
                    _contactDetailService.Add(newContactDetail);
                    _contactDetailService.Save();

                    var responseData = Mapper.Map <ContactDetail, ContactDetailViewModel>(newContactDetail);
                    response = request.CreateResponse(HttpStatusCode.Created, responseData);
                }

                return response;
            }));
        }
Пример #12
0
        private void saveDriver()
        {
            using (InsuranceConnection context = new InsuranceConnection())
            {
                Driver driver = new Driver();
                driver.Title      = DriverTitle;
                driver.FirstName  = FirstName;
                driver.SecondName = SecondName;
                driver.SiteUserId = AppUserId;
                context.Drivers.Add(driver);

                ContactDetail contact = new ContactDetail();
                contact.AppUserID = AppUserId;
                contact.Phone     = Phone;
                contact.DOB       = DOB;
                contact.Email     = Email;
                contact.County    = County;
                contact.AddDriver = false;
                context.ContactDetails.Add(contact);
                context.SaveChanges();
                Session["DriverID"] = driver.Id;
            }
        }
Пример #13
0
        public bool UpdateContactDetail(string name, ContactDetail updatedDetails)
        {
            try
            {
                ContactsDAL contactDAl = new ContactsDAL();
                bool        updated    = contactDAl.UpdateContactDetail(name, updatedDetails);

                if (updated)
                {
                    _contactDetailsCache.RefreshKeyByChar(name[0]);
                    if (updatedDetails.Name[0] != name[0])
                    {
                        _contactDetailsCache.RefreshKeyByChar(updatedDetails.Name[0]);
                        _contactDetailsCache.RefreshContactCountByChar();
                    }
                }
                return(updated);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #14
0
        public void SaveContactDetail(ContactDetail contactDetail)
        {
            var existingContact = GetContactDetail(contactDetail.Id);

            if (existingContact != null)
            {
                existingContact.FirstName   = contactDetail.FirstName;
                existingContact.LastName    = contactDetail.LastName;
                existingContact.Email       = contactDetail.Email;
                existingContact.PhoneNumber = contactDetail.PhoneNumber;
                existingContact.Status      = contactDetail.Status;
            }
            else
            {
                if (contactDetail.Id == Guid.Empty)
                {
                    contactDetail.Id = Guid.NewGuid();
                }

                dbContext.ContactDetails.Add(contactDetail);
            }
            dbContext.SaveChanges();
        }
Пример #15
0
        /// <summary>
        /// Serialize a FHIR ContactDetail into JSON
        /// </summary>
        public static void SerializeJson(this ContactDetail current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Complex: ContactDetail, Export: ContactDetail, Base: Element (Element)
            ((Hl7.Fhir.Model.Element)current).SerializeJson(writer, options, false);

            if (current.NameElement != null)
            {
                if (!string.IsNullOrEmpty(current.NameElement.Value))
                {
                    writer.WriteString("name", current.NameElement.Value);
                }
                if (current.NameElement.HasExtensions() || (!string.IsNullOrEmpty(current.NameElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_name", false, current.NameElement.Extension, current.NameElement.ElementId);
                }
            }

            if ((current.Telecom != null) && (current.Telecom.Count != 0))
            {
                writer.WritePropertyName("telecom");
                writer.WriteStartArray();
                foreach (ContactPoint val in current.Telecom)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Пример #16
0
 public bool UpdateContactDetail(string name, ContactDetail updatedDetail)
 {
     try
     {
         var param = new DynamicParameters();
         param.Add("name", name);
         param.Add("updatedName", updatedDetail.Name);
         param.Add("updatedMobile", updatedDetail.Mobile);
         param.Add("updatedEmail", updatedDetail.Email);
         var query = @"Update ContactDetail 
                         set Mobile = @updatedMobile,
                         Name = @updatedName,
                         Email = @updatedEmail
                         where Name = @name;";
         using (IDbConnection conn = new MySqlConnection(_connString))
         {
             return(conn.Execute(query, param, commandType: CommandType.Text) > 0);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
        public SaveChangeEnum AddContact(ContactDetailDTO _ContactDetailDTO)
        {
            SaveChangeEnum retVal = SaveChangeEnum.No_Action;

            try
            {
                this.UnitOfWork.BeginTransaction();
                ContactDetail _ContactDetail = new ContactDetail();
                _ContactDetail.FirstName   = _ContactDetailDTO.FirstName;
                _ContactDetail.LastName    = _ContactDetailDTO.LastName;
                _ContactDetail.Email       = _ContactDetailDTO.Email;
                _ContactDetail.PhoneNumber = _ContactDetailDTO.PhoneNumber;
                _ContactDetail.Status      = _ContactDetailDTO.Status;
                this.Add <ContactDetail>(_ContactDetail);
                this._Context.SaveChanges();
                retVal = this.UnitOfWork.CommitTransaction();
            }
            catch (Exception)
            {
                //Log Errors
            }

            return(retVal);
        }
        public async Task <IActionResult> PostContactDetail([FromBody] ContactDetail contactDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (DuplicateValues(contactDetail))
            {
                return(BadRequest(contactDetail));
            }

            contactDetail.CreatedBy   = HttpContext.User.Identity.Name;
            contactDetail.DateCreated = DateTime.Now;

            _context.ContactDetails.Add(contactDetail);
            await _context.SaveChangesAsync();

            var contactType = _context.ContactTypes.Find(contactDetail.ContactTypeId);

            contactDetail.ContactType = contactType;

            return(CreatedAtAction("GetContactDetail", new { id = contactDetail.Id }, contactDetail));
        }
Пример #19
0
 public ActionResult Edit(ContactDetailViewModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var contact = new ContactDetail();
             contact.UpdateContactDetail(model);
             var result = new ContactDao().Update(contact);
             if (result)
             {
                 SetAlert("Cập nhật thành công", "success");
                 return(RedirectToAction("Index", "Contact"));
             }
             else
             {
                 ModelState.AddModelError("", "Cập nhật thất bại");
             }
         }
         return(View(model));
     }
     catch
     { return(View()); }
 }
Пример #20
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "extensional-case-2";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Extensional case #2";
            this.valueSet.Description  = new Markdown("an enumeration of codes defined by LOINC");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";
            this.valueSet.Copyright    = new Markdown("This content LOINC is copyright © 1995 Regenstrief Institute, Inc. and the LOINC Committee, and available at no cost under the license at http://loinc.org/terms-of-use");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ComposeComponent   comp = new ValueSet.ComposeComponent();
            ValueSet.ExpansionComponent es   = new ValueSet.ExpansionComponent();

            ValueSet.ConceptSetComponent csc = new ValueSet.ConceptSetComponent {
                System = FhirLoinc.URI, Version = FhirLoinc.CURRENT_VERSION
            };

            if (string.IsNullOrEmpty(version) || version == this.valueSet.Version)
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>
                {
                    { "11378-7", "Systolic blood pressure at First encounter" },
                    { "8493-9", "Systolic blood pressure 10 hour minimum" },
                    { "8494-7", "Systolic blood pressure 12 hour minimum" },
                    { "8495-4", "Systolic blood pressure 24 hour minimum" },
                    { "8450-9", "Systolic blood pressure--expiration" },
                    { "8451-7", "Systolic blood pressure--inspiration" },
                    { "8452-5", "Systolic blood pressure.inspiration - expiration" },
                    { "8459-0", "Systolic blood pressure--sitting" },
                    { "8460-8", "Systolic blood pressure--standing" },
                    { "8461-6", "Systolic blood pressure--supine" },
                    { "8479-8", "Systolic blood pressure by palpation" },
                    { "8480-6", "Systolic blood pressure" },
                    { "8481-4", "Systolic blood pressure 1 hour maximum" },
                    { "8482-2", "Systolic blood pressure 8 hour maximum" },
                    { "8483-0", "Systolic blood pressure 10 hour maximum" },
                    { "8484-8", "Systolic blood pressure 12 hour maximum" },
                    { "8485-5", "Systolic blood pressure 24 hour maximum" },
                    { "8486-3", "Systolic blood pressure 1 hour mean" },
                    { "8487-1", "Systolic blood pressure 8 hour mean" },
                    { "8488-9", "Systolic blood pressure 10 hour mean" },
                    { "8489-7", "Systolic blood pressure 12 hour mean" },
                    { "8490-5", "Systolic blood pressure 24 hour mean" },
                    { "8491-3", "Systolic blood pressure 1 hour minimum" },
                    { "8492-1", "Systolic blood pressure 8 hour minimum" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc.System
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    comp.Include.Add(csc);
                    this.valueSet.Compose = comp;
                }
            }
        }
Пример #21
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ContactDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToContactDetails(ContactDetail contactDetail)
 {
     base.AddObject("ContactDetails", contactDetail);
 }
Пример #22
0
        private Boolean validate(CartDetail cartDetails, ShippingDetail shippingDetails, ContactDetail contactDetails)
        {
            //validate request
            // carddetails Y, shippingDetails Y , contactDetails

            Boolean value = true;

            if (cartDetails == null)
            {
                value = false;
            }
            else
            {
                if (cartDetails.items == null)
                {
                    value = false;
                }
                else
                {
                    for (int ii = 0; ii < cartDetails.items.Count(); ii++)
                    {
                        if (cartDetails.items[ii] == null)
                        {
                            value = false;
                            break;
                        }
                        else
                        {
                            if (String.IsNullOrWhiteSpace(cartDetails.items[ii].itemId))
                            {
                                value = false;
                                break;
                            }

                            if (String.IsNullOrWhiteSpace(cartDetails.items[ii].qty))
                            {
                                value = false;
                                break;
                            }
                        }
                    }
                }
            }



            if (shippingDetails == null)
            {
                Console.WriteLine("Shipping details is null");
                value = false;
            }
            else
            {
                if (shippingDetails.homeAddress == null && shippingDetails.officeAddress == null)
                {
                    Console.WriteLine("all address is null");
                    value = false;
                }
                else
                {
                    Boolean homeAddress = false, officeAddress = false;

                    if (shippingDetails.homeAddress != null)
                    {
                        homeAddress = isAddressValid(shippingDetails.homeAddress);
                    }

                    if (shippingDetails.officeAddress != null)
                    {
                        officeAddress = isAddressValid(shippingDetails.officeAddress);
                    }

                    if (homeAddress == true || officeAddress == true)
                    {
                        //do nothing
                    }
                    else
                    {
                        value = false;
                    }
                }
            }


            if (contactDetails == null)
            {
                Console.WriteLine("contact details is null");
            }
            else
            {
                if (!String.IsNullOrWhiteSpace(contactDetails.email) ||
                    !String.IsNullOrWhiteSpace(contactDetails.handphone) ||
                    !String.IsNullOrWhiteSpace(contactDetails.landline))
                {
                    // do nothing
                }
                else
                {
                    value = false;
                }
            }



            return(value);
        }
Пример #23
0
 public ActionResult CreateCompany(CompanyViewModel vm)
 {
     if (!ModelState.IsValid)
     {
         return(View("CreateCompany", vm));
     }
     else
     {
         HorseplayContext db = new HorseplayContext();
         int tenantId        = (int)Session["TenantId"];
         int userId          = (int)Session["UserId"];
         vm.Company.TenantId  = tenantId;
         vm.Company.AddedBy   = userId;
         vm.Company.DateAdded = DateTime.Now;
         if (vm.Company.Address != null)
         {
             Address Address = new Address();
             Address.AddedBy    = userId;
             Address.TenantId   = tenantId;
             Address.DateAdded  = DateTime.Now;
             Address.Name       = vm.Company.Address.Name;
             Address.Street     = vm.Company.Address.Street;
             Address.ZipCode    = vm.Company.Address.ZipCode;
             Address.City       = vm.Company.Address.City;
             Address.Country    = vm.Company.Address.Country;
             vm.Company.Address = Address;
         }
         if (vm.Company.ContactDetail != null)
         {
             ContactDetail CD = new ContactDetail()
             {
                 AddedBy      = userId,
                 DateAdded    = DateTime.Now,
                 TenantId     = tenantId,
                 Phone        = vm.Company.ContactDetail.Phone,
                 Mobile       = vm.Company.ContactDetail.Mobile,
                 PrivatePhone = vm.Company.ContactDetail.PrivatePhone,
                 Fax          = vm.Company.ContactDetail.Fax,
                 Mail         = vm.Company.ContactDetail.Mail,
                 PrivateMail  = vm.Company.ContactDetail.PrivateMail
             };
             vm.Company.ContactDetail = CD;
         }
         Company Company = new Company()
         {
             AddedBy   = userId,
             DateAdded = DateTime.Now,
             TenantId  = tenantId,
             Type      = vm.Company.Type,
             BusinessRegisterNumber = vm.Company.BusinessRegisterNumber,
             CourtRegisterNumber    = vm.Company.CourtRegisterNumber,
             TaxRegisterNumber      = vm.Company.TaxRegisterNumber,
             PaymentTerm            = vm.Company.PaymentTerm,
             Address       = vm.Company.Address,
             ContactDetail = vm.Company.ContactDetail
         };
         db.Companies.Add(vm.Company);
         try
         {
             db.SaveChanges();
         }
         catch (DbEntityValidationException e)
         {
             foreach (var error in e.EntityValidationErrors)
             {
                 foreach (var propertyError in error.ValidationErrors)
                 {
                     Console.WriteLine($"{propertyError.PropertyName} had the following issue: {propertyError.ErrorMessage}");
                 }
             }
         }
         return(RedirectToAction("GetCompanies"));
     }
 }
Пример #24
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "extensional-case-4";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-4";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Extensional case #4";
            this.valueSet.Description  = new Markdown("A mixed enumeration of codes from FHIR, and from V2 administrative gender code");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ComposeComponent   comp = new ValueSet.ComposeComponent();
            ValueSet.ExpansionComponent es   = new ValueSet.ExpansionComponent();

            ValueSet.ConceptSetComponent csc = new ValueSet.ConceptSetComponent {
                System = "http://hl7.org/fhir/administrative-gender"
            };
            ValueSet.ConceptSetComponent csc2 = new ValueSet.ConceptSetComponent {
                System = "http://terminology.hl7.org/CodeSystem/v2-0001"
            };

            if (string.IsNullOrEmpty(version) || version == this.valueSet.Version)
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>
                {
                    { "male", "Male" },
                    { "female", "Female" },
                    { "other", "Other" },
                    { "unknown", "Unknown" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc.System
                        });
                    }
                }

                Dictionary <string, string> codeVals2 = new Dictionary <string, string>
                {
                    { "A", "Ambiguous" },
                    { "M", "Male" },
                    { "F", "Female" },
                    { "N", "Not applicable" },
                    { "O", "Other" },
                    { "U", "Unknown" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals2)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc2.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc2.System
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    comp.Include.Add(csc);
                    this.valueSet.Compose = comp;
                }
            }
        }
Пример #25
0
        public FileProcessing()
        {
            Receive <string>(async fileName =>
            {
                ContactSummary contactSummary = new ContactSummary();
                try
                {
                    string filePath     = fileName.Replace('%', '\\');
                    var reader          = ReadAsLines(filePath);
                    Stopwatch countdown = new Stopwatch();
                    countdown.Start();

                    //this assumes the first record is filled with the column names
                    List <string> headers = reader.First().Split(',').ToList();
                    int colPosition       = 0;

                    //Dynamically determine Column locations
                    foreach (string column in headers)
                    {
                        if (columns.ContainsKey(column))
                        {
                            columns[column] = colPosition;
                        }
                        colPosition++;
                    }

                    var records = reader.Skip(1);
                    List <ContactDetail> contactDetailList = new List <ContactDetail>();

                    foreach (var record in records)
                    {
                        List <string> rowData        = record.Split(',').ToList();
                        ContactDetail contactDetails = new ContactDetail();

                        contactDetails.Name    = columns["Name"] != -1 ? rowData.ElementAt(columns["Name"]) : "";
                        contactDetails.Company = columns["Company"] != -1 ? rowData.ElementAt(columns["Company"]) : "";
                        contactDetails.Email   = columns["Email"] != -1 ? rowData.ElementAt(columns["Email"]) : "";
                        contactDetails.Phone   = columns["Phone"] != -1 ? rowData.ElementAt(columns["Phone"]) : "";
                        contactDetailList.Add(contactDetails);

                        records = reader.Skip(1);
                    }

                    countdown.Stop();

                    contactSummary.ImportFileName    = filePath.Substring(filePath.LastIndexOf("\\") + 1, filePath.Length - (filePath.LastIndexOf("\\") + 1));
                    contactSummary.ImportDate        = DateTime.Now.ToString("dd/mm/yy").ToString();
                    contactSummary.ImportDuration    = countdown.Elapsed.Seconds.ToString() + " seconds";
                    contactSummary.ContactsImported  = contactDetailList.Where(x => !string.IsNullOrEmpty(x.Name)).Count();
                    contactSummary.CompaniesImported = contactDetailList.Where(x => !string.IsNullOrEmpty(x.Company)).Count();
                    contactSummary.LackedEmail       = contactDetailList.Where(x => string.IsNullOrEmpty(x.Email)).Count();
                    contactSummary.LackedPhone       = contactDetailList.Where(x => string.IsNullOrEmpty(x.Phone)).Count();

                    DataService ds       = new DataService();
                    int contactSummaryId = ds.SaveContactSummary(contactSummary);
                    ds.SaveContactDetail(contactDetailList, contactSummaryId);
                }
                catch (Exception ex)
                {
                    Sender.Tell(string.Format("Error occured: {0} ", ex.Message), Self);
                }
                Sender.Tell("Imported", Self);
            });
        }
        public async Task <IResult> UpdateAsync(ContactDetail contactDetail)
        {
            await _contactDetailRepository.UpdateAsync(contactDetail, contactDetail.Id);

            return(new SuccessResult(Messages.ContactDetailUpdated));
        }
Пример #27
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet   = new ValueSet();
            this.codeSystem = new CodeSystem();

            this.valueSet.Id   = "NzRegion";
            this.codeSystem.Id = "NzRegion";

            this.codeSystem.CaseSensitive = true;
            this.codeSystem.Content       = CodeSystem.CodeSystemContentMode.Complete;
            this.codeSystem.Experimental  = true;
            this.codeSystem.Compositional = false;
            this.codeSystem.VersionNeeded = false;

            this.valueSet.Url   = ServerCapability.HL7_FHIR_CANONICAL + "/ValueSet/NzRegion";
            this.codeSystem.Url = NzRegion.URI;

            this.codeSystem.ValueSet = this.valueSet.Url;

            this.valueSet.Title   = "NZ Region";
            this.codeSystem.Title = "NZ Region";

            this.valueSet.Name   = this.valueSet.Id;
            this.codeSystem.Name = this.codeSystem.Id;

            this.valueSet.Description   = new Markdown("Value Set of all NZ DHB Regional Codes");
            this.codeSystem.Description = new Markdown("NZ DHB Regional Codes");

            this.valueSet.Version   = "1.0.1";
            this.codeSystem.Version = "1.0.1";

            this.valueSet.Experimental = true;

            this.valueSet.Status   = PublicationStatus.Active;
            this.codeSystem.Status = PublicationStatus.Draft;

            this.valueSet.Date   = Hl7.Fhir.Model.Date.Today().Value;
            this.codeSystem.Date = Hl7.Fhir.Model.Date.Today().Value;

            this.valueSet.Publisher   = "Patients First Ltd";
            this.codeSystem.Publisher = "Patients First Ltd";

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);
            this.codeSystem.Contact.Add(cd);

            ValueSet.ConceptSetComponent cs = new ValueSet.ConceptSetComponent();
            ValueSet.ExpansionComponent  es = new ValueSet.ExpansionComponent();

            cs.System  = this.codeSystem.Url;
            cs.Version = this.codeSystem.Version;

            string codeCode       = string.Empty;
            string codeDisplay    = string.Empty;
            string codeDefinition = string.Empty;

            if ((string.IsNullOrEmpty(version) || version == cs.Version))
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>();

                codeVals.Add("NORTH", "Northern");
                codeVals.Add("MIDLAND", "Midland");
                codeVals.Add("CENTRAL", "Central");
                codeVals.Add("SOUTH", "Southern");

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        cs.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = cs.System
                        });
                        this.codeSystem.Concept.Add(new CodeSystem.ConceptDefinitionComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    this.valueSet.Compose = new ValueSet.ComposeComponent();
                    this.valueSet.Compose.Include.Add(cs);
                }
            }
        }
        public ContactListViewModel(IDialerService dialerService)
        {
            AddContact = new Command <string>(async(key) =>
            {
                var page = new ContactDetail();
                ((ContactDetailViewModel)page.BindingContext).Contact  = new Contact();
                ((ContactDetailViewModel)page.BindingContext).Contacts = Contacts;
                await Navigation.PushAsync(page);
            });

            EditContact = new Command <Contact>(async(c) =>
            {
                var page = new ContactDetail();
                ((ContactDetailViewModel)page.BindingContext).Contact  = c;
                ((ContactDetailViewModel)page.BindingContext).Contacts = Contacts;

                ((ContactDetailViewModel)page.BindingContext).FirstName     = c?.FirstName;
                ((ContactDetailViewModel)page.BindingContext).LastName      = c?.LastName;
                ((ContactDetailViewModel)page.BindingContext).ContactNumber = c?.ContactNumber;

                await Navigation.PushAsync(page);
            });

            DeleteContact = new Command <Contact>((c) =>
            {
                Contacts.Remove(c);
            });

            FavoriteContact = new Command <Contact>((c) =>
            {
                var favoriteCount = Contacts.Count(i => i.IsFavorite);

                if (favoriteCount < 10 || c.IsFavorite)
                {
                    c.IsFavorite = !c.IsFavorite;
                }
            });

            DialButtonPressed = new Command <string>((c) =>
            {
                if (string.IsNullOrWhiteSpace(c) && DialpadDisplay.Length > 0)
                {
                    DialpadDisplay = DialpadDisplay.Substring(0, (DialpadDisplay.Length - 1));
                    return;
                }

                DialpadDisplay += c;
            });

            DialContact = new Command <Contact>((c) =>
            {
                //DialpadDisplay = c.ContactNumber;
                //SwitchToDialPage();
                dialerService.DialPhoneNumber(c.ContactNumber);
                //Device.OpenUri(new Uri($"tel://{c.ContactNumber}"));
            });

            CallContact = new Command(() =>
            {
                dialerService.DialPhoneNumber(DialpadDisplay);
                //Device.OpenUri(new Uri($"tel://{DialpadDisplay}"));
            });

            DialpadDisplay              = "";
            SearchText                  = "";
            Contacts                    = new ObservableCollection <Contact>();
            Contacts.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(CollectionChangedMethod);
        }
 public static ContactDetail Map(ContactDetail entity, RegistrationViewModel viewModel)
 {
     return Mapper.Map(viewModel, entity);
 }
Пример #30
0
        public async Task Create(ContactDetail _contactDetail)
        {
            await _context.ContactDetails.AddAsync(_contactDetail);

            await _context.SaveChangesAsync();
        }
Пример #31
0
 // PUT: api/Contact/5
 public void Put(ContactDetail contactDetail)
 {
     new ContactDetailManager().SaveContactDetail(contactDetail);
 }
        public bool UpdateContactDetailForLandlord(string landlordReference, string contactDetailReference, ContactDetail contactDetail)
        {
            var landlord =
               _propertiesContext.Landlords.Active()
                   .Include(x => x.AlternateContactDetails)
                   .FirstOrDefault(x => x.LandlordReference == landlordReference);

            var currentContactDetail =
                landlord?.AlternateContactDetails.FirstOrDefault(x => x.ContactDetailReference == contactDetailReference);

            if (currentContactDetail.IsNull())
                return false;

            var isDirty = _contactDetailMapper.Map(contactDetail, currentContactDetail);

            return !isDirty || _propertiesContext.SaveChanges() > 0;
        }
		private static ContactDetail CreateGetContactDetails(EntityEntity entityEntity, 
			List<PersonEntity> personEntities)
		{
			ContactDetail contact = new ContactDetail
			{
				EntityId = entityEntity.Id
			};

			PersonEntity personEntity = null;
			if (entityEntity != null)
			{
				contact.EntityName = entityEntity.Name;
				contact.EntityTypeId = entityEntity.EntityTypeId;

				personEntity = personEntities.FirstOrDefault(x => x.EntityId == entityEntity.Id);
			}

			if (personEntity != null)
			{
				contact.PersonId = personEntity.Id;
				contact.OccupationNameId = personEntity.OccupationNameId;
				contact.TitleId = personEntity.TitleId;
				contact.GenderTypeId = personEntity.GenderTypeId;
				contact.SurnamePrefix = personEntity.SurnamePrefix;
				contact.Surname = personEntity.Surname;
				contact.MaidenNamePrefix = personEntity.MaidenNamePrefix;
				contact.Nationality = personEntity.Nationality;
				contact.DateOfBirth = personEntity.DateOfBirth;
				contact.PlaceOfBirth = personEntity.PlaceOfBirth;
			}
			return contact;
		}
Пример #34
0
        public void CoupleRegister(CoupleRegisterModel modelData, HttpPostedFileBase UploadLagna, HttpPostedFileBase UploadNawamsa)
        {
            // db.ClientDetails clientDetails = null;
            //ClientDetail entity = null;
            if (modelData.Id == 0)
            {
                var clientetail = new ClientDetail()
                {
                    NIC           = modelData.NIC,
                    FirstName     = modelData.FirstName,
                    LastName      = modelData.LastName,
                    Gender        = (int)modelData.GenderType,
                    Cast          = (int)modelData.CasteName,
                    Religion      = (int)modelData.Religion,
                    Job           = modelData.Job,
                    Height        = modelData.Height,
                    Qualification = (int)modelData.Qualification,
                    Expectation   = (int)modelData.Expectation
                };

                var jothidaDetail = new JothidaDetail()
                {
                    ClientId     = modelData.Id,
                    Lagna        = (int)modelData.Lagna,
                    StarId       = (int)modelData.StarName,
                    Paavam       = modelData.Paavam,
                    LagnaChart   = ConvertToBytes(UploadLagna),
                    NavamsaChart = ConvertToBytes(UploadNawamsa)
                };

                var birthDetail = new BirthDetail()
                {
                    ClientId     = modelData.Id,
                    DOB          = modelData.BirthOfDate,
                    BirthPlace   = modelData.BirthPlace,
                    BirthTime    = modelData.BirthTime,
                    FartherPlace = modelData.FartherPlace,
                    MotherPlace  = modelData.MotherPlace,
                };

                var contact = new ContactDetail()
                {
                    // NIC = modelData.NIC,
                    ClientId    = modelData.Id,
                    Address     = modelData.Address,
                    Residence   = modelData.Residence,
                    PhoneHome   = modelData.HomePhone,
                    PhoneMobile = modelData.MobileNo,
                    Email       = modelData.Email,
                    Country     = (int)modelData.Country
                };

                db.ClientDetails.Add(clientetail);
                db.JothidaDetails.Add(jothidaDetail);
                db.BirthDetails.Add(birthDetail);
                db.ContactDetails.Add(contact);
                //db.SaveChanges();
            }
            else
            {
                //entity = _db.Resources.Where(x => x.ResourceID == resourceDetails.ResourceID).FirstOrDefault();
                var entity = db.ClientDetails.Where(x => x.Id == modelData.Id).FirstOrDefault();


                entity.NIC           = modelData.NIC;
                entity.FirstName     = modelData.FirstName;
                entity.LastName      = modelData.LastName;
                entity.Gender        = (int)modelData.GenderType;
                entity.Cast          = (int)modelData.CasteName;
                entity.Religion      = (int)modelData.Religion;
                entity.Job           = modelData.Job;
                entity.Height        = modelData.Height;
                entity.Qualification = (int)modelData.Qualification;
                entity.Expectation   = (int)modelData.Expectation;

                var entity1 = db.JothidaDetails.Where(x => x.ClientId == modelData.Id).FirstOrDefault();


                entity1.Lagna        = (int)modelData.Lagna;
                entity1.StarId       = (int)modelData.StarName;
                entity1.Paavam       = modelData.Paavam;
                entity1.LagnaChart   = modelData.LagnaChart;
                entity1.NavamsaChart = modelData.NavamsaChart;



                var entity2 = db.BirthDetails.Where(x => x.ClientId == modelData.Id).FirstOrDefault();

                entity2.DOB          = modelData.BirthOfDate;
                entity2.BirthPlace   = modelData.BirthPlace;
                entity2.BirthTime    = modelData.BirthTime;
                entity2.FartherPlace = modelData.FartherPlace;
                entity2.MotherPlace  = modelData.MotherPlace;



                var entity3 = db.ContactDetails.Where(x => x.ClientId == modelData.Id).FirstOrDefault();

                entity3.Address     = modelData.Address;
                entity3.Residence   = modelData.Residence;
                entity3.PhoneHome   = modelData.HomePhone;
                entity3.PhoneMobile = modelData.MobileNo;
                entity3.Email       = modelData.Email;
                entity3.Country     = (int)modelData.Country;
            }


            //if (UploadLagna != null || UploadNawamsa != null)
            //{
            //    JothidaDetail chartModel = new JothidaDetail();
            //    if (UploadLagna.ContentType == "image/jpeg" || UploadLagna.ContentType == "image/png" || UploadLagna.ContentType == "image/gif" || UploadNawamsa.ContentType == "image/jpeg" || UploadNawamsa.ContentType == "image/png" || UploadNawamsa.ContentType == "image/gif")
            //    {
            //        chartModel.PhotoType = UploadLagna.ContentType;
            //        chartModel.LagnaChart = ConvertToBytes(UploadLagna);

            //        chartModel.PhotoType = UploadLagna.ContentType;
            //        chartModel.NavamsaChart = ConvertToBytes(UploadNawamsa);
            //    }
            //    else
            //    {
            //        //emsg = "ImageType Should Be 'jpeg' Or 'png' Or 'gif' ";
            //        //return false;
            //    }
            //}

            //db.ClientDetails.Add(clientetail);
            //db.JothidaDetails.Add(jothidaDetail);
            //db.BirthDetails.Add(birthDetail);
            //db.ContactDetails.Add(contact);
            db.SaveChanges();
        }
Пример #35
0
        private void btnAddCompmayContactDetail_Click(object sender, EventArgs e)
        {
            using (frmAddUpdateContactDetails frm = new frmAddUpdateContactDetails(0))
            {
                frm.ShowDialog();
                if (frm.CurrentDetail != null)
                {
                    using (var Dbconnection = new MCDEntities())
                    {
                        using (System.Data.Entity.DbContextTransaction dbTran = Dbconnection.Database.BeginTransaction())
                        {
                            try
                            {
                                //CRUD Operations

                                /*
                                 * this steps follow to both entities
                                 *
                                 * 1 - create instance of entity with relative primary key
                                 *
                                 * 2 - add instance to context
                                 *
                                 * 3 - attach instance to context
                                 */

                                // 1
                                Data.Models.Company c = new Data.Models.Company {
                                    CompanyID = CurrentlySelectedCompany.CompanyID
                                };
                                // 2
                                Dbconnection.Companies.Add(c);
                                // 3
                                Dbconnection.Companies.Attach(c);

                                // 1
                                ContactDetail cd = new ContactDetail {
                                    ContactDetailID = frm.CurrentDetail.ContactDetailID
                                };
                                // 2
                                Dbconnection.ContactDetails.Add(cd);
                                // 3
                                Dbconnection.ContactDetails.Attach(cd);

                                // like previous method add instance to navigation property
                                c.ContactDetails.Add(cd);
                                ////saves all above operations within one transaction
                                Dbconnection.SaveChanges();

                                //commit transaction
                                dbTran.Commit();
                            }
                            catch (Exception ex)
                            {
                                if (ex is DbEntityValidationException)
                                {
                                    foreach (DbEntityValidationResult entityErr in ((DbEntityValidationException)ex).EntityValidationErrors)
                                    {
                                        foreach (DbValidationError error in entityErr.ValidationErrors)
                                        {
                                            MessageBox.Show(error.ErrorMessage, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                        }
                                    }
                                }
                                else
                                {
                                    MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                                //Rollback transaction if exception occurs
                                dbTran.Rollback();
                            }
                        }
                    };

                    using (var Dbconnection = new MCDEntities())
                    {
                        Dbconnection.ContactDetails.Attach(frm.CurrentDetail);
                        Dbconnection.Entry(frm.CurrentDetail).Reference(a => a.LookupContactType).Load();
                    };
                    CurrentlySelectedCompany.ContactDetails.Add(frm.CurrentDetail);
                    refreshCompanyContactDetails();
                }
            }
        }
        public StructureDefinition Convert(Template template, SimpleSchema schema, SummaryType?summaryType = null)
        {
            var fhirStructureDef = new fhir_stu3.Hl7.Fhir.Model.StructureDefinition()
            {
                Id          = template.FhirId(),
                Name        = template.Name,
                Description = template.Description != null ? new Markdown(template.Description.RemoveInvalidUtf8Characters()) : null,
                Kind        = template.PrimaryContextType == "Extension" ? StructureDefinition.StructureDefinitionKind.ComplexType : StructureDefinition.StructureDefinitionKind.Resource,
                Url         = template.FhirUrl(),
                Type        = template.TemplateType.RootContextType,
                Context     = new List <string> {
                    template.PrimaryContextType
                },
                ContextType = StructureDefinition.ExtensionContext.Resource,
                Abstract    = false,
                Derivation  = StructureDefinition.TypeDerivationRule.Constraint
            };

            // If this is an extension, determine what uses the extension and list them in the
            // "context" field so that the extension knows where it can be used.
            foreach (var extension in template.Extensions)
            {
                var fhirExtension = Convert(extension);

                if (fhirExtension != null)
                {
                    fhirStructureDef.Extension.Add(fhirExtension);
                }
            }

            // Status
            if (template.Status == null || template.Status.IsDraft || template.Status.IsBallot)
            {
                fhirStructureDef.Status = PublicationStatus.Draft;
            }
            else if (template.Status.IsPublished)
            {
                fhirStructureDef.Status = PublicationStatus.Active;
            }
            else if (template.Status.IsDraft)
            {
                fhirStructureDef.Status = PublicationStatus.Retired;
            }

            // Publisher and Contact
            if (template.Author != null)
            {
                if (!string.IsNullOrEmpty(template.Author.ExternalOrganizationName))
                {
                    fhirStructureDef.Publisher = template.Author.ExternalOrganizationName;
                }

                var newContact = new ContactDetail();
                newContact.Name = string.Format("{0} {1}", template.Author.FirstName, template.Author.LastName);
                newContact.Telecom.Add(new ContactPoint()
                {
                    Value  = template.Author.Phone,
                    Use    = ContactPoint.ContactPointUse.Work,
                    System = ContactPoint.ContactPointSystem.Phone
                });
                newContact.Telecom.Add(new ContactPoint()
                {
                    Value  = template.Author.Email,
                    Use    = ContactPoint.ContactPointUse.Work,
                    System = ContactPoint.ContactPointSystem.Email
                });

                fhirStructureDef.Contact.Add(newContact);
            }

            // Base profile
            if (template.ImpliedTemplate != null)
            {
                fhirStructureDef.BaseDefinitionElement = new FhirUri(template.ImpliedTemplate.FhirUrl());
            }
            else
            {
                fhirStructureDef.BaseDefinitionElement = new FhirUri(string.Format("http://hl7.org/fhir/StructureDefinition/{0}", template.TemplateType.RootContextType));
            }

            // Constraints
            if (summaryType == null || summaryType == SummaryType.Data)
            {
                var differential = new StructureDefinition.DifferentialComponent();
                fhirStructureDef.Differential = differential;

                // Add base element for resource
                var rootElement = new ElementDefinition();
                rootElement.Path      = template.PrimaryContextType;
                rootElement.ElementId = template.PrimaryContextType;
                differential.Element.Add(rootElement);

                var rootConstraints = template.ChildConstraints.Where(y => y.ParentConstraint == null).OrderBy(y => y.Order);
                foreach (var constraint in rootConstraints)
                {
                    SimpleSchema.SchemaObject schemaObject = null;

                    if (schema != null)
                    {
                        schemaObject = schema.Children.SingleOrDefault(y => y.Name == constraint.Context);
                    }

                    CreateElementDefinition(fhirStructureDef, constraint, schemaObject);
                }

                // Slices
                var slices                 = template.ChildConstraints.Where(y => y.IsBranch);
                var sliceGroups            = slices.GroupBy(y => y.GetElementPath(template.TemplateType.RootContextType));
                int currentSliceGroupCount = 2;

                // Adds an element that contains "slicing" information for the branch(es)
                foreach (var sliceGroup in sliceGroups)
                {
                    ElementDefinition newElementDef = new ElementDefinition();
                    //newElementDef.ElementId = string.Format("{0}-{1}", template.Id, currentSliceGroupCount.ToString("00"));
                    newElementDef.Path      = sliceGroup.Key;
                    newElementDef.ElementId = sliceGroup.First().GetElementPath(template.PrimaryContextType);

                    foreach (var branchConstraint in sliceGroup)
                    {
                        var igSettings          = GetIGSettings(branchConstraint);
                        var constraintFormatter = FormattedConstraintFactory.NewFormattedConstraint(this.tdb, igSettings, this.igTypePlugin, branchConstraint);
                        var branchIdentifiers   = branchConstraint.ChildConstraints.Where(y => y.IsBranchIdentifier);

                        newElementDef.Definition = constraintFormatter.GetPlainText(false, false, false);
                        newElementDef.Slicing    = new ElementDefinition.SlicingComponent()
                        {
                            Rules = template.IsOpen ? ElementDefinition.SlicingRules.Open : ElementDefinition.SlicingRules.Closed
                        };

                        if (branchIdentifiers.Count() > 0)
                        {
                            newElementDef.Slicing.Discriminator = (from bi in branchIdentifiers
                                                                   select new ElementDefinition.DiscriminatorComponent()
                            {
                                Type = ElementDefinition.DiscriminatorType.Value,
                                Path = bi.GetElementPath(null, branchConstraint)
                            }).ToList();
                        }
                        else if (branchConstraint.Context == "extension")
                        {
                            newElementDef.Slicing.Discriminator.Add(new ElementDefinition.DiscriminatorComponent()
                            {
                                Type = ElementDefinition.DiscriminatorType.Value,
                                Path = "url"
                            });
                        }
                        else        // If no discriminators are specified, assume the child SHALL constraints are discriminators
                        {
                            var discriminatorConstraints  = branchConstraint.ChildConstraints.Where(y => y.Conformance == "SHALL");
                            var singleValueDiscriminators = discriminatorConstraints.Where(y => !string.IsNullOrEmpty(y.Value));

                            // If there are constraints that have specific single-value bindings, prefer those
                            if (singleValueDiscriminators.Count() > 0 && singleValueDiscriminators.Count() != discriminatorConstraints.Count())
                            {
                                discriminatorConstraints = singleValueDiscriminators;
                            }

                            newElementDef.Slicing.Discriminator = (from d in discriminatorConstraints
                                                                   select new ElementDefinition.DiscriminatorComponent()
                            {
                                Type = ElementDefinition.DiscriminatorType.Value,
                                Path = d.GetElementPath(template.PrimaryContextType, branchConstraint)
                            }).ToList();
                        }
                    }

                    // Find where to insert the slice in the element list
                    var firstElement      = fhirStructureDef.Differential.Element.First(y => y.Path == sliceGroup.Key);
                    var firstElementIndex = fhirStructureDef.Differential.Element.IndexOf(firstElement);
                    differential.Element.Insert(firstElementIndex, newElementDef);
                    currentSliceGroupCount++;
                }
            }

            return(fhirStructureDef);
        }
Пример #37
0
        private void FillValues(TerminologyOperation termOp, string version, string code, string filter, int offsetNo, int countNo)
        {
            this.valueSet = new ValueSet();

            this.valueSet.Id  = "extensional-case-3";
            this.valueSet.Url = "http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-3";
            this.valueSet.Identifier.Add(new Identifier {
                Value = this.valueSet.Id
            });
            this.valueSet.Name         = this.valueSet.Id;
            this.valueSet.Title        = "Terminology Services Test: Extensional case #3";
            this.valueSet.Description  = new Markdown("an enumeration of codes defined by SNOMED CT");
            this.valueSet.Version      = "R4";
            this.valueSet.Status       = PublicationStatus.Active;
            this.valueSet.Experimental = true;
            this.valueSet.Date         = Hl7.Fhir.Model.Date.Today().Value;
            this.valueSet.Publisher    = "Grahame Grieve";
            this.valueSet.Copyright    = new Markdown("This value set includes content from SNOMED CT, which is copyright © 2002+ International Health Terminology Standards Development Organisation (IHTSDO), and distributed by agreement between IHTSDO and HL7. Implementer use of SNOMED CT is not covered by this agreement");

            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };
            ContactDetail cd = new ContactDetail();

            cd.Telecom.Add(cp);
            this.valueSet.Contact.Add(cd);

            ValueSet.ComposeComponent   comp = new ValueSet.ComposeComponent();
            ValueSet.ExpansionComponent es   = new ValueSet.ExpansionComponent();

            ValueSet.ConceptSetComponent csc = new ValueSet.ConceptSetComponent {
                System = FhirSnomed.URI
            };

            if (string.IsNullOrEmpty(version) || version == this.valueSet.Version)
            {
                Dictionary <string, string> codeVals = new Dictionary <string, string>
                {
                    { "371037005", "Systolic dysfunction" },
                    { "56218007", "Systolic hypertension" },
                    { "271657009", "Systolic cardiac thrill" },
                    { "429457004", "Systolic essential hypertension" },
                    { "417996009", "Systolic heart failure" },
                    { "44623008", "Systolic ejection sound" },
                    { "248677002", "Systolic flow murmur" },
                    { "31574009", "Systolic murmur" },
                    { "120871000119108", "Systolic heart failure stage B" },
                    { "120851000119104", "Systolic heart failure stage D" },
                    { "120861000119102", "Systolic heart failure stage C" },
                    { "609556008", "Systolic heart failure stage A" },
                    { "61926008", "Basal systolic thrill" },
                    { "248672008", "Soft systolic murmur" },
                    { "65254001", "Late systolic murmur" },
                    { "89985004", "Early systolic murmur" },
                    { "248692001", "Mid-systolic click" },
                    { "248678007", "Mitral late systolic murmur" },
                    { "443254009", "Acute systolic heart failure" },
                    { "441481004", "Chronic systolic heart failure" },
                    { "48965007", "Single non-ejection systolic click" },
                    { "68519006", "Multiple non-ejection systolic clicks" },
                    { "134401001", "Left ventricular systolic dysfunction" },
                    { "416158002", "Right ventricular systolic dysfunction" },
                    { "68494000", "Mid-systolic murmur" },
                    { "442304009", "Combined systolic and diastolic dysfunction" },
                    { "18352002", "Abnormal systolic arterial pressure" },
                    { "407596008", "Echocardiogram shows left ventricular systolic dysfunction" },
                    { "371857005", "Normal left ventricular systolic function and wall motion" },
                    { "430396006", "Chronic systolic dysfunction of left ventricle" },
                    { "12929001", "Normal systolic arterial pressure" },
                    { "275285009", "On examination - systolic murmur" },
                    { "443253003", "Acute on chronic systolic heart failure" },
                    { "371862006", "Depression of left ventricular systolic function" },
                    { "81010002", "Decreased systolic arterial pressure" },
                    { "163030003", "On examination - Systolic BP reading" },
                    { "163069009", "On examination - systolic cardiac thrill" },
                    { "18050000", "Increased systolic arterial pressure" },
                    { "163094005", "On examination - pulmonary systolic murmur" },
                    { "426263006", "Congestive heart failure due to left ventricular systolic dysfunction" },
                    { "417081007", "Systolic anterior movement of mitral valve" },
                    { "248679004", "Mitral pansystolic murmur" },
                    { "248687003", "Presystolic mitral murmur" },
                    { "248688008", "Presystolic tricuspid murmur" },
                    { "71201008", "Pansystolic murmur" },
                    { "23795000", "Presystolic murmur" },
                    { "248680001", "Tricuspid inspiratory pansystolic murmur" },
                    { "248681002", "Left parasternal pansystolic murmur" }
                };

                foreach (KeyValuePair <string, string> codeVal in codeVals)
                {
                    if (TerminologyValueSet.MatchValue(codeVal.Key, codeVal.Value, code, filter))
                    {
                        csc.Concept.Add(new ValueSet.ConceptReferenceComponent {
                            Code = codeVal.Key, Display = codeVal.Value
                        });
                        es.Contains.Add(new ValueSet.ContainsComponent {
                            Code = codeVal.Key, Display = codeVal.Value, System = csc.System
                        });
                    }
                }

                if (termOp == TerminologyOperation.expand || termOp == TerminologyOperation.validate_code)
                {
                    this.valueSet = TerminologyValueSet.AddExpansion(this.valueSet, es, offsetNo, countNo);
                }
                else if (termOp == TerminologyOperation.define_vs)
                {
                    comp.Include.Add(csc);
                    this.valueSet.Compose = comp;
                }
            }
        }
        public async Task <IResult> AddAsync(ContactDetail contactDetail)
        {
            await _contactDetailRepository.AddAsync(contactDetail);

            return(new SuccessResult(Messages.ContactDetailAdded));
        }
Пример #39
0
        public static Resource GetStatement(bool inBundle)
        {
            TerminologyCapabilities tsCapabilityStatement = new TerminologyCapabilities
            {
                Url          = ServerCapability.TERMINZ_CANONICAL + "/TerminologyCapabilities/Terminz-Example",
                Id           = "Terminz-Example",
                Description  = new Markdown("HL7© FHIR© terminology services for use in New Zealand."),
                Name         = "Patients First Terminology Server (Terminz)",
                Purpose      = new Markdown("Exemplar of terminology services approach for New Zealand."),
                Publisher    = "Patients First Ltd",
                Version      = "4.0.0",
                Status       = PublicationStatus.Draft,
                Date         = "2019-05-08",
                Experimental = true,
                Copyright    = new Markdown("© 2019+ Patients First Ltd"),
                LockedDate   = false
            };

            ContactDetail cd = new ContactDetail {
                Name = "Peter Jordan"
            };
            ContactPoint cp = new ContactPoint {
                System = ContactPoint.ContactPointSystem.Email, Value = "*****@*****.**"
            };

            cd.Telecom.Add(cp);
            tsCapabilityStatement.Contact.Add(cd);

            CodeableConcept cc = new CodeableConcept("http://hl7.org/fhir/ValueSet/jurisdiction", "NZL", "New Zealand", "New Zealand");

            tsCapabilityStatement.Jurisdiction.Add(cc);

            tsCapabilityStatement.CodeSystem.Add(FhirSnomed.GetCapabilities());
            tsCapabilityStatement.CodeSystem.Add(FhirLoinc.GetCapabilities());
            tsCapabilityStatement.CodeSystem.Add(NzMt.GetCapabilities());
            tsCapabilityStatement.CodeSystem.Add(FhirRxNorm.GetCapabilities());

            tsCapabilityStatement.Expansion = new TerminologyCapabilities.ExpansionComponent
            {
                Hierarchical = false,
                Paging       = true,
                Incomplete   = false,
                TextFilter   = new Markdown("Results include synonyms, not just preferred terms.")
            };

            tsCapabilityStatement.CodeSearch = TerminologyCapabilities.CodeSearchSupport.All;

            tsCapabilityStatement.ValidateCode = new TerminologyCapabilities.ValidateCodeComponent()
            {
                Translations = false
            };

            tsCapabilityStatement.Translation = new TerminologyCapabilities.TranslationComponent()
            {
                NeedsMap = true
            };

            tsCapabilityStatement.Closure = new TerminologyCapabilities.ClosureComponent()
            {
                Translation = false
            };

            // text element

            XNamespace ns = "http://www.w3.org/1999/xhtml";

            var summary = new XElement(ns + "div",
                                       new XElement(ns + "h2", tsCapabilityStatement.Name),
                                       new XElement(ns + "p", tsCapabilityStatement.Description),
                                       new XElement(ns + "table",
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", "Purpose"),
                                                                 new XElement(ns + "td", tsCapabilityStatement.Purpose.ToString())
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", "Publisher"),
                                                                 new XElement(ns + "td", tsCapabilityStatement.Publisher)
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", "Version"),
                                                                 new XElement(ns + "td", tsCapabilityStatement.Version)
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", "Date"),
                                                                 new XElement(ns + "td", tsCapabilityStatement.Date)
                                                                 )
                                                    ),
                                       new XElement(ns + "table",
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "th", "Code System"),
                                                                 new XElement(ns + "th", "Description"),
                                                                 new XElement(ns + "th", "URI"),
                                                                 new XElement(ns + "th", "Version")
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", FhirSnomed.TITLE),
                                                                 new XElement(ns + "td", FhirSnomed.DESCRIPTION),
                                                                 new XElement(ns + "td", FhirSnomed.URI),
                                                                 new XElement(ns + "td", FhirSnomed.CURRENT_VERSION)
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", FhirLoinc.TITLE),
                                                                 new XElement(ns + "td", FhirLoinc.DESCRIPTION),
                                                                 new XElement(ns + "td", FhirLoinc.URI),
                                                                 new XElement(ns + "td", FhirLoinc.CURRENT_VERSION)
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", NzMt.TITLE),
                                                                 new XElement(ns + "td", NzMt.DESCRIPTION),
                                                                 new XElement(ns + "td", NzMt.URI),
                                                                 new XElement(ns + "td", NzMt.CURRENT_VERSION)
                                                                 ),
                                                    new XElement(ns + "tr",
                                                                 new XElement(ns + "td", FhirRxNorm.TITLE),
                                                                 new XElement(ns + "td", FhirRxNorm.DESCRIPTION),
                                                                 new XElement(ns + "td", FhirRxNorm.URI),
                                                                 new XElement(ns + "td", FhirRxNorm.CURRENT_VERSION)
                                                                 )
                                                    )
                                       );

            tsCapabilityStatement.Text = new Narrative
            {
                Status = Narrative.NarrativeStatus.Generated,
                Div    = summary.ToString()
            };

            // place in a bundle

            if (inBundle)
            {
                Bundle tcsBundle = new Bundle
                {
                    Id   = Guid.NewGuid().ToString(),
                    Type = Bundle.BundleType.Searchset
                };

                tcsBundle.Link.Add(new Bundle.LinkComponent {
                    Url = ServerCapability.TERMINZ_CANONICAL + "/TerminologyCapabilities", Relation = "self"
                });
                tcsBundle.AddResourceEntry(tsCapabilityStatement, tsCapabilityStatement.Url);
                tcsBundle.Total = tcsBundle.Entry.Count;

                return(tcsBundle);
            }

            return(tsCapabilityStatement);
        }