Пример #1
0
 public void IsInvalid()
 {
     var item = new PathologyDto()
     {
         Name = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
Пример #2
0
 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;
        }