public void IsInvalid()
 {
     var item = new PathologyDto()
     {
         Name = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
 public void IsValid()
 {
     var item = new PathologyDto()
     {
         Name = Guid.NewGuid().ToString(),
         Tag = new TagDto(TagCategory.Appointment) { Id = 14 },
     };
     Assert.IsTrue(item.IsValid());
 }
示例#3
0
 public static void SetPathology(DependencyObject target, PathologyDto value)
 {
     target.SetValue(PathologyProperty, value);
 }
示例#4
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);
 }
示例#9
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;
        }