public void IsInvalid()
        {
            var item = new PathologyDto()
            {
                Name = string.Empty,
            };

            Assert.IsFalse(item.IsValid());
        }
Beispiel #2
0
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item to remove</param>
 public void Remove(PathologyDto item)
 {
     Assert.IsNotNull(item, "item");
     if (!this.CanRemove(item))
     {
         throw new ReferencialIntegrityException();
     }
     this.Remove <Pathology>(item);
 }
        public void IsValid()
        {
            var item = new PathologyDto()
            {
                Name = Guid.NewGuid().ToString(),
                Tag  = new TagDto(TagCategory.Appointment)
                {
                    Id = 14
                },
            };

            Assert.IsTrue(item.IsValid());
        }
Beispiel #4
0
        /// <summary>
        /// Creates the specified pathology.
        /// </summary>
        /// <param name="item">The item.</param>
        public long Create(PathologyDto item)
        {
            var found = (from p in this.Session.Query <Pathology>()
                         where p.Id == item.Id ||
                         item.Name.ToLower() == p.Name.ToLower()
                         select p).ToList().Count() > 0;

            if (found)
            {
                throw new ExistingItemException();
            }

            var entity = Mapper.Map <PathologyDto, Pathology>(item);

            item.Id = (long)this.Session.Save(entity);
            return(item.Id);
        }
Beispiel #5
0
 /// <summary>
 /// Determines whether the specified item can be removed.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///   <c>true</c> if this instance can remove the specified item; otherwise, <c>false</c>.
 /// </returns>
 public bool CanRemove(PathologyDto item)
 {
     return((from t in this.Session.Query <Patient>()
             where t.IllnessHistory.Where(e => e.Pathology.Id == item.Id).Count() > 0
             select t).Count() == 0);
 }
Beispiel #6
0
 /// <summary>
 /// Creates the specified pathology.
 /// </summary>
 /// <param name="item">The item.</param>
 public void Create(PathologyDto item)
 {
     new Creator(this.Session).Create(item);
 }
 /// <summary>
 /// Determines whether the specified item can be removed.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///   <c>true</c> if this instance can remove the specified item; otherwise, <c>false</c>.
 /// </returns>
 public bool CanRemove(PathologyDto item)
 {
     return(new Remover(this.Session).CanRemove(item));
 }
 /// <summary>
 /// Updates the specified pathology.
 /// </summary>
 /// <param name="pathology">The drug.</param>
 public void Update(PathologyDto pathology)
 {
     new Updator(this.Session).Update(pathology);
 }
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item to remove</param>
 public void Remove(PathologyDto item)
 {
     new Remover(this.Session).Remove(item);
 }
 /// <summary>
 /// Creates the specified pathology.
 /// </summary>
 /// <param name="pathology">The drug.</param>
 public long Create(PathologyDto pathology)
 {
     return(new Creator(this.Session).Create(pathology));
 }
Beispiel #11
0
 public static void SetPathology(DependencyObject target, PathologyDto value)
 {
     target.SetValue(PathologyProperty, value);
 }
Beispiel #12
0
        /// <summary>
        /// Updates the specified pathology.
        /// </summary>
        /// <param name="pathology">The drug.</param>
        public void Update(PathologyDto pathology)
        {
            var entity = Mapper.Map <PathologyDto, Pathology>(pathology);

            this.Session.Update(entity);
        }