コード例 #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
ファイル: BookManager.cs プロジェクト: furkank14/WebDev
 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
ファイル: BookManager.cs プロジェクト: deniz1989/BookStore
 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
ファイル: BookManager.cs プロジェクト: dengizUmit/WebDev
 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
ファイル: BookManager.cs プロジェクト: mehmetkicirti/WebDev
 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
ファイル: BookManager.cs プロジェクト: Magicianred/WebDev
        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
ファイル: BookManager.cs プロジェクト: anilguzel/RentABook
 public Book Add(Book book)
 {
     return(_bookDal.Add(book));
 }
コード例 #18
0
 public void Add(Book book)
 {
     ValidationTool.Validate(new BookValidator(), book);
     _bookDal.Add(book);
 }
コード例 #19
0
 public void Add(Book book)
 {
     _bookDal.Add(book);
 }
コード例 #20
0
 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);
 }