コード例 #1
0
 public static void Refresh(this Patient patient, PatientDto from, ISession session)
 {
     if (from.Tag != null) { patient.Tag = session.Get<Tag>(from.Tag.Id) ?? patient.Tag; }
     if (from.Insurance != null) { patient.Insurance = session.Get<Insurance>(from.Insurance.Id) ?? patient.Insurance; }
     if (from.Practice != null) { patient.Practice = session.Get<Practice>(from.Practice.Id) ?? patient.Practice; }
     if (from.Profession != null) { patient.Profession = session.Get<Profession>(from.Profession.Id) ?? patient.Profession; }
     if (from.Reputation != null) { patient.Reputation = session.Get<Reputation>(from.Reputation.Id) ?? patient.Reputation; }
 }
コード例 #2
0
 public void IsInvalid_Patient()
 {
     var item = new PatientDto()
     {
         FirstName = string.Empty,
         LastName = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
コード例 #3
0
ファイル: Creator.cs プロジェクト: seniorOtaka/ndoctor
        /// <summary>
        /// Create the specified item into the database
        /// </summary>
        /// <param name="item">The item to add in the database</param>
        public long Create(PatientDto item)
        {
            Assert.IsNotNull(item, "item");

            var found = (from p in this.Session.Query<Patient>()
                         where p.Id == item.Id
                         select p).ToList().Count() > 0;
            if (found) throw new ExistingItemException();

            var entity = Mapper.Map<PatientDto, Patient>(item);
            item.Id = (long)this.Session.Save(entity);
            return item.Id;
        }
コード例 #4
0
 public void IsValid_Patient()
 {
     var item = new PatientDto()
     {
         FirstName = Guid.NewGuid().ToString(),
         LastName = Guid.NewGuid().ToString(),
     };
     Assert.IsTrue(item.IsValid());
 }
コード例 #5
0
        /// <summary>
        /// Updates the patient with the new data.
        /// </summary>
        /// <param name="item">The patient.</param>
        public void Update(PatientDto item)
        {
            Assert.IsNotNull(item, "item");
            item.LastUpdate = DateTime.Today;

            var entity = this.Session.Get<Patient>(item.Id);

            Mapper.Map<PatientDto, Patient>(item, entity);
            if (entity.Address == null) { entity.Address = new Address(); }

            entity.Refresh(item, this.Session);

            this.Session.Merge(entity);
        }
コード例 #6
0
 /// <summary>
 /// Gets the thumbnail of the specified patient.
 /// </summary>
 /// <param name="patientDto">The patient dto.</param>
 /// <returns></returns>
 public byte[] GetThumbnail(PatientDto patientDto)
 {
     return (from p in this.Session.Query<Patient>()
             where p.Id == patientDto.Id
             select p.Thumbnail).Single();
 }
コード例 #7
0
 private void SaveAsync(PatientDto context)
 {
     PluginDataContext.Instance.Actions.Execute();
     this.component.Update(context);
 }