Пример #1
0
        public void Borrow()
        {
            BorrowDTO borrow1 = new BorrowDTO
            {
                BookId    = 1,
                StudentId = 1,
                BeginDate = new DateTime(2019, 5, 10),
                EndDate   = new DateTime(2019, 5, 13)
            };

            BorrowDTO borrow2 = new BorrowDTO
            {
                BookId    = 2,
                StudentId = 1,
                BeginDate = new DateTime(2019, 5, 10),
                EndDate   = new DateTime(2019, 5, 13)
            };

            BorrowDTO borrow3 = new BorrowDTO
            {
                BookId    = 3,
                StudentId = 1,
                BeginDate = new DateTime(2019, 5, 10),
                EndDate   = new DateTime(2019, 5, 13)
            };

            List <BorrowDTO> list = new List <BorrowDTO>()
            {
                borrow1, borrow2, borrow3
            };

            var result = service.Borrow(list);

            Assert.IsTrue(result);
        }
Пример #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (list.Count == 0)
            {
                MessageBox.Show("Hiç Kitap eklmediniz. ");
                return;
            }

            using (BorrowService service = new BorrowService())
            {
                var result = service.Borrow(list);

                if (result)
                {
                    lblMessage.Text      = "Kayıt başarılı";
                    lblMessage.ForeColor = Color.Green;
                }
                else
                {
                    // MessageBox.Show("Güncelleme sırasında bir hata oluştu", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    lblMessage.Text      = "Kayıt sıtasında hata oluştu.";
                    lblMessage.ForeColor = Color.Red;
                }
            }
        }
Пример #3
0
        public void Borrow()
        {
            List <BorrowDTO> list = new List <BorrowDTO>();

            BorrowDTO book1 = new BorrowDTO
            {
                BookId    = 1,
                StudentId = 1,
                BeginDate = new DateTime(2019, 5, 10),
                EndDate   = new DateTime(2019, 5, 13)
            };

            list.Add(book1);

            BorrowDTO book2 = new BorrowDTO
            {
                BookId    = 2,
                StudentId = 1,
                BeginDate = new DateTime(2019, 5, 10),
                EndDate   = new DateTime(2019, 5, 13),
            };

            list.Add(book2);

            var result = service.Borrow(list);

            Assert.IsTrue(result);
        }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (list.Count == 0)
            {
                MessageBox.Show("Hiç kitap seçmediniz.");
                return;
            }
            using (BorrowService borrowService = new BorrowService())
            {
                var result = borrowService.Borrow(list);

                if (result)
                {
                    lblSaveStatus.Text      = "Kayıt işlemi başarılı";
                    lblSaveStatus.ForeColor = Color.Green;
                }
                else
                {
                    lblSaveStatus.Text      = "Kayıt işlemi başarısız";
                    lblSaveStatus.ForeColor = Color.Red;
                }
            }
        }