Пример #1
0
        public void Add(Book book)
        {
            var result = Utilities.Run(CheckBookCountExceed(1700), CheckMaintenanceTime(0, 6));

            if (!result)
            {
                throw new Exception(Messages.BookCountExceed);
            }
            _bookDal.Add(book);
        }
Пример #2
0
		public void Add(Book book)
		{
			//throw new NotImplementedException();
			//EfBookDal efBookDal = new EfBookDal();
			_bookDal.Add(book);
			if (_bookDal.Get(b=>b.Name == book.Name && b.AuthorId==book.AuthorId ) == null)
			{
				_bookDal.Add(book);
			}
			throw new Exception("Bu kitap adı zaten var");
		}
Пример #3
0
        public IResult Add(Book book)
        {
            IResult result = BusinessRules.Run(CheckIfBookNameExists(book.BookName));

            if (result != null)
            {
                return(result);
            }
            _bookDal.Add(book);
            return(new SuccessResult(BookMessages.BookAdded));
        }
Пример #4
0
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            MainWindow main  = Application.Current.Windows.OfType <MainWindow>().First();
            book       _book = new book()
            {
                bibtexkey = bibtexkey_Txt.Text,
                title     = title_Txt.Text,
                year      = year_Txt.Text != "" ? Convert.ToInt32(year_Txt.Text) : null as int?,
                month     = month_Txt.Text != "" ? Convert.ToInt32(month_Txt.Text) : null as int?,
                volume    = volume_Txt.Text != "" ? Convert.ToInt32(volume_Txt.Text) : null as int?,
                author    = author_Txt.Text,
                address   = address_Txt.Text,
                publisher = publisher_Txt.Text,
                note      = note_Txt.Text,
                edition   = edition_Txt.Text != "" ? Convert.ToInt32(edition_Txt.Text): null as int?,
                series    = series_Txt.Text != "" ? Convert.ToInt32(series_Txt.Text): null as int?,
                url       = url_Txt.Text,
                entrytype = GetEntryType.GetValueByEnum(GetEntryType.EntryType.Book)
            };


            bool result = AllFieldEmpty();

            if (!result)
            {
                _iBookService.Add(_book);
                SetFieldClear();
                UIElement parent = App.Current.MainWindow;
                parent.IsEnabled = true;
                main.DataGridMain.ItemsSource = GetEntryType.GetAllByTypes();
                this.Close();
            }
            else
            {
                if (MessageBox.Show("Are you Sure to create a empty .bib", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    //do no stuff
                    return;
                }
                else
                {
                    _iBookService.Add(_book);
                    SetFieldClear();
                    main.DataGridMain.ItemsSource = GetEntryType.GetAllByTypes();
                    UIElement parent = App.Current.MainWindow;
                    parent.IsEnabled = true;
                    this.Close();
                    //do yes stuff
                }
            }
        }
Пример #5
0
 public void Add(Book book)
 {
     if (_bookDal.Get(b => b.Name == book.Name) == null)
     {
         _bookDal.Add(book);
     }
 }
Пример #6
0
        public void Add(Book book)
        {
            int lastId = LastIdentity(GetAll());

            book.Identity = lastId;
            LastId        = lastId;
            bookDal.Add(book);
        }
Пример #7
0
 public void Add(Book book)
 {
     if (_bookDal.Get(b => b.Name == book.Name && b.AuthorId == book.AuthorId) == null)
     {
         _bookDal.Add(book);
         return;
     }
     throw new Exception("Bu kitap zaten ekli");
 }
Пример #8
0
 public IResult AddBookToStock(Book book)
 {
     if (_iSBNCheckService.IsValidISBN(book.ISBN))
     {
         _bookDal.Add(book);
         return(new SuccessResult("Kitap stoğa eklendi"));
     }
     return(new ErrorResult("Geçersiz ISBN!"));
 }
Пример #9
0
 public void Add(Book book)
 {
     if (_bookDal.Get(b => b.Name == book.Name && b.Authorid == book.Authorid) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception("Bu kitap adı zaten mevcut");
     }
 }
Пример #10
0
 public void Add(Book book)
 {
     if (_bookDal.Get(filter: b => b.Name == book.Name && b.AuthorId == book.AuthorId) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception(message: "Bu Kitap adı zaten mevcut");
     }
 }
Пример #11
0
 public void Add(Book book)
 {
     // İş Kodları
     if (_bookDal.Get(filter: b => b.Name == book.Name && b.AuthorId == book.AuthorId) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception(message: "Girmek istediğiniz kitap adı zaten var!");
     }
 }
Пример #12
0
 public void Add(Book book)
 {
     // Bu kontrol update içinde gerekeceğinden burayı farklı şekilde yönetmek gerek
     if (_bookDal.Get(filter: b => b.Name == book.Name) == null)
     {
         _bookDal.Add(book);
     }
     else
     {
         throw new Exception(message: "Bu kitap adı zaten mevcut");
     }
 }
Пример #13
0
 public void Add(Book book)
 {
     if (book.UnitPrice > 0)
     {
         _bookDal.Add(book);
         Console.WriteLine("Kitap eklendi.");
     }
     else
     {
         Console.WriteLine("Fiyat 0'dan büyük olmalıdır!");
     }
 }
Пример #14
0
 public void Add(Book entity)
 {
     //iş kodu
     //Örnegin bu iş kuralını biz birden fazla yerde kullanabiliriz bu yüzden bu kod kötü bunu ayrı bir yerde ele almamız lazım.
     if (_bookDal.Get(b => b.Name == entity.Name && b.AuthorId == entity.AuthorId) == null)
     {
         _bookDal.Add(entity);
     }
     else
     {
         throw new Exception("Bu kitap daha önce eklenmiş");
     }
 }
Пример #15
0
        public void Add(Book book)
        {
            // kitap eklerken kurallar varsa buraya yazılır.
            // İş kodu

            if (_bookDal.Get(b => b.Name == book.Name && book.AuthorId == book.AuthorId) == null)
            {
                _bookDal.Add(book);
            }
            else
            {
                throw new Exception("Bu kitap adı zaten mevcut...");
            }
        }
Пример #16
0
 public Book Add(Book book)
 {
     //ValidationTool.Validate(new BookValidator(), book);
     return(_bookDal.Add(book));
 }
Пример #17
0
 public Book Add(Book book)
 {
     return(_bookDal.Add(book));
 }
Пример #18
0
 public void Add(Book book)
 {
     ValidationTool.Validate(new BookValidator(), book);
     _bookDal.Add(book);
 }
 public void Add(Book book)
 {
     _bookDal.Add(book);
 }
 public Book Add(Book model)
 {
     return(_bookDal.Add(model));
 }
Пример #21
0
 public IResult Add(Book book)
 {
     _bookDal.Add(book);
     return(new SuccessResult());
 }
Пример #22
0
 public void Add(Book entity)
 {
     _bookDal.Add(entity);
 }