Beispiel #1
0
 public void IsInvalid_Drug()
 {
     var item = new DrugDto()
     {
         Name = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
Beispiel #2
0
 public void IsValid_Drug()
 {
     var item = new DrugDto()
     {
         Name = Guid.NewGuid().ToString(),
         Tag = new TagDto(TagCategory.Appointment) { Id = 14 },
     };
     Assert.IsTrue(item.IsValid());
 }
Beispiel #3
0
        /// <summary>
        /// Create the specified item into the database
        /// </summary>
        /// <param name="item">The item to add in the database</param>
        public long Create(DrugDto item)
        {
            Assert.IsNotNull(item, "item");

            var exist = (from i in this.Session.Query<Drug>()
                         where i.Name.ToUpper() == item.Name.ToUpper()
                            || i.Id == item.Id
                         select i).ToList().Count() > 0;
            if (exist) throw new ExistingItemException();

            var entity = Mapper.Map<DrugDto, Drug>(item);
            item.Id = (long)this.Session.Save(entity);
            return item.Id;
        }
 /// <summary>
 /// Updates the specified drug.
 /// </summary>
 /// <param name="drug">The drug.</param>
 public void Update(DrugDto drug)
 {
     new Updator(this.Session).Update(drug);
 }
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item to remove</param>
 public void Remove(DrugDto item)
 {
     new Remover(this.Session).Remove(item);
 }
 /// <summary>
 /// Create the specified item into the database
 /// </summary>
 /// <param name="item">The item to add in the database</param>
 /// <returns></returns>
 public long Create(DrugDto item)
 {
     return new Creator(this.Session).Create(item);
 }
 /// <summary>
 /// Determines whether this instance can remove the specified drug dto.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///   <c>true</c> if this instance can remove the specified drug dto; otherwise, <c>false</c>.
 /// </returns>
 public bool CanRemove(DrugDto item)
 {
     return new Remover(this.Session).CanRemove(item);
 }
Beispiel #8
0
 public static void SetDrug(DependencyObject target, DrugDto value)
 {
     target.SetValue(DrugyProperty, value);
 }