Exemple #1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (dgvBookList.Rows.Count > 0)
            {
                if (dgvBookList.SelectedRows.Count == 1)
                {
                    int selectIndex = dgvBookList.CurrentRow.Index;
                    var bookID      = dgvBookList.Rows[selectIndex].Cells[0].Value;

                    var book = BooksHelper.GetBookByID(Convert.ToInt32(bookID));

                    cmbDepartment.SelectedItem = DepartmentsHelper.GetByNameFromID(book.DepartmentID);
                    cmbCategory.SelectedItem   = BookCategoriesHelper.GetByNameFromID(book.BookCategoryID);
                    txtBookName.Text           = book.BookName;
                    txtTitle.Text    = book.Title;
                    txtAuthor.Text   = book.Author;
                    txtEdition.Text  = book.Edition;
                    txtEdition.Text  = string.Empty;
                    dtpRegDate.Value = book.DateOfRegister;
                    txtPrice.Text    = book.Price.ToString();

                    DisableComponent();
                }
            }
        }
Exemple #2
0
 private void FillGridBook(Books b)
 {
     dgvBookDetail.Rows.Clear();
     dgvBookDetail.Rows.Add($"Adı       : {b.BookName}");
     dgvBookDetail.Rows.Add($"Yazarı    : {b.Author}");
     dgvBookDetail.Rows.Add($"Kategori  : {BookCategoriesHelper.GetByNameFromID(b.BookCategoryID)}");
     dgvBookDetail.Rows.Add($"Bölüm     : {DepartmentsHelper.GetByNameFromID(b.DepartmentID)}");
     dgvBookDetail.Rows.Add($"Miktar    : {b.NoOfCopies}");
 }
Exemple #3
0
 private void FillGrid()
 {
     dgvBookTypeList.Rows.Clear();
     foreach (var bookCategory in BookCategoriesHelper.GetBookCategoriesList())
     {
         int row = dgvBookTypeList.Rows.Add();
         dgvBookTypeList.Rows[row].Cells[0].Value = bookCategory.BookCategoryID;
         dgvBookTypeList.Rows[row].Cells[1].Value = bookCategory.Name;
         row++;
     }
 }
Exemple #4
0
 private void FillGrid()
 {
     dgvBookList.Rows.Clear();
     foreach (var book in BooksHelper.GetBooksList())
     {
         int row = dgvBookList.Rows.Add();
         dgvBookList.Rows[row].Cells[0].Value  = book.BookID;
         dgvBookList.Rows[row].Cells[1].Value  = book.BookName;
         dgvBookList.Rows[row].Cells[2].Value  = BookCategoriesHelper.GetByNameFromID(book.BookCategoryID);
         dgvBookList.Rows[row].Cells[3].Value  = DepartmentsHelper.GetByNameFromID(book.DepartmentID);
         dgvBookList.Rows[row].Cells[4].Value  = book.Author;
         dgvBookList.Rows[row].Cells[5].Value  = book.Title;
         dgvBookList.Rows[row].Cells[6].Value  = book.Edition;
         dgvBookList.Rows[row].Cells[7].Value  = book.NoOfCopies;
         dgvBookList.Rows[row].Cells[8].Value  = book.DateOfRegister.ToString("dd MMMM yyyy");
         dgvBookList.Rows[row].Cells[9].Value  = book.Price;
         dgvBookList.Rows[row].Cells[10].Value = StaffsHelper.GetByNameFromID(_staffID);
         row++;
     }
 }
Exemple #5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ep.Clear();
            if (txtBookType.Text.Trim().Length == 0)
            {
                ep.SetError(txtBookType, "Kitap türü boş bırakılamaz!");
                txtBookType.Focus();
                return;
            }

            BookCategories bc = new BookCategories();

            bc.Name = txtBookType.Text;

            BookCategoriesHelper.Add(bc);

            MessageBox.Show("Kitap Türü Ekleme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);

            txtBookType.Text = string.Empty;

            FillGrid();
        }
Exemple #6
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            ep.Clear();

            if (txtBookName.Text.Trim().Length == 0)
            {
                ep.SetError(txtBookName, "Book Name boş bırakılamaz!");
                txtBookName.Focus();
                return;
            }
            if (txtTitle.Text.Trim().Length == 0)
            {
                ep.SetError(txtTitle, "Title boş bırakılamaz!");
                txtTitle.Focus();
                return;
            }
            if (txtAuthor.Text.Trim().Length == 0)
            {
                ep.SetError(txtAuthor, "Author boş bırakılamaz!");
                txtAuthor.Focus();
                return;
            }
            if (txtEdition.Text.Trim().Length == 0)
            {
                ep.SetError(txtEdition, "Edition boş bırakılamaz!");
                txtEdition.Focus();
                return;
            }
            if (txtNoOfCopies.Text.Trim().Length == 0)
            {
                ep.SetError(txtNoOfCopies, "Edition boş bırakılamaz!");
                txtNoOfCopies.Focus();
                return;
            }
            if (txtPrice.Text.Trim().Length == 0)
            {
                ep.SetError(txtPrice, "Price boş bırakılamaz!");
                txtPrice.Focus();
                return;
            }

            if (!BooksHelper.HaveBook(txtBookName.Text, txtAuthor.Text, txtAuthor.Text))
            {
                Books b = new Books();
                b.BookCategoryID = BookCategoriesHelper.GetByName(cmbCategory.SelectedItem.ToString());
                b.StaffID        = _staffID;
                b.DepartmentID   = DepartmentsHelper.GetByName(cmbDepartment.SelectedItem.ToString());
                b.BookName       = txtBookName.Text;
                b.Author         = txtAuthor.Text;
                b.Title          = txtTitle.Text;
                b.Edition        = txtEdition.Text;
                b.NoOfCopies     = Convert.ToInt32(txtNoOfCopies.Text);
                b.DateOfRegister = dtpRegDate.Value;
                b.Price          = Convert.ToInt32(txtPrice.Text);
                BooksHelper.Add(b);

                MessageBox.Show("Kitap Ekleme Başarılı", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);

                cmbDepartment.SelectedIndex = 0;
                cmbCategory.SelectedIndex   = 0;
                txtBookName.Text            = string.Empty;
                txtTitle.Text      = string.Empty;
                txtAuthor.Text     = string.Empty;
                txtEdition.Text    = string.Empty;
                txtNoOfCopies.Text = string.Empty;
                dtpRegDate.Value   = DateTime.Now;
                txtPrice.Text      = string.Empty;

                FillGrid();
            }
            else
            {
                MessageBox.Show("Eklemk istediğiniz kitap sistemde zaten mevcut!", "Library Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #7
0
 private void FrmAddBook_Load(object sender, EventArgs e)
 {
     cmbDepartment.DataSource = DepartmentsHelper.GetDepartmentsNameList();
     cmbCategory.DataSource   = BookCategoriesHelper.GetBookCategoriesNameList();
     FillGrid();
 }