Пример #1
0
 public AddBookForm(Employee e, FrmMenu menuForm)
 {
     this.EMPLOYEE = e;
     this.menuForm = menuForm;
     InitializeComponent();
     publishers = PublisherDAO.SelectAllPublishers();
     categories = CategoryDAO.SelectAllCategories();
 }
Пример #2
0
 public EditBookForm(int bookID, FrmMenu frmMenu, Employee e)
 {
     InitializeComponent();
     this.bookID  = bookID;
     this.frmMenu = frmMenu;
     EMPLOYEE     = e;
     authors      = AuthorDAO.SelectAllAuthors();
     publishers   = PublisherDAO.SelectAllPublishers();
     categories   = CategoryDAO.SelectAllCategories();
 }
Пример #3
0
 public void UpdateCheckedListBoxCategories(int categoryID)
 {
     checkedListBoxCategories.Items.Clear();
     categories = CategoryDAO.SelectAllCategories();
     for (int index = 0; index < categories.Count; index++)
     {
         Category category = categories[index];
         checkedListBoxCategories.Items.Add(category.CategoryName);
         if (category.CategoryID == categoryID)
         {
             checkedListBoxCategories.SetItemChecked(index, true);
         }
     }
 }
        private void TextBoxCategoryName_TextChanged(object sender, EventArgs e)
        {
            string categoryName = textBoxCategoryName.Text.Trim();

            if (categoryName.Length == 0)
            {
                labelCategoryNameMessage.ForeColor = Color.Red;
                labelCategoryNameMessage.Text      = "Category Name is required";
                return;
            }
            List <Category> categories = CategoryDAO.SelectAllCategories();

            foreach (Category category in categories)
            {
                if (category.CategoryName.Equals(categoryName))
                {
                    labelCategoryNameMessage.ForeColor = Color.Red;
                    labelCategoryNameMessage.Text      = "Category Name already existed";
                    return;
                }
            }
            labelCategoryNameMessage.ForeColor = Color.Green;
            labelCategoryNameMessage.Text      = "Category Name is OK";
        }
Пример #5
0
 public SearchBookPanel(Form containerForm)
 {
     this.containerForm = containerForm;
     authors            = AuthorDAO.SelectAllAuthors();
     publishers         = PublisherDAO.SelectAllPublishers();
     categories         = CategoryDAO.SelectAllCategories();
     Size     = new Size(1205, 265);
     groupBox = new GroupBox()
     {
         Text     = "Search Book",
         Location = new Point(12, 12),
         Size     = new Size(1190, 250)
     };
     labelTitle = new Label()
     {
         Text     = "Title",
         AutoSize = true,
         Location = new Point(6, 23),
         Size     = new Size(27, 13)
     };
     textBoxTitle = new TextBox()
     {
         Location = new Point(69, 19),
         Size     = new Size(175, 20)
     };
     labelAuthor = new Label()
     {
         Text     = "Author",
         AutoSize = true,
         Location = new Point(6, 49),
         Size     = new Size(38, 13)
     };
     comboBoxAuthors = new ComboBox()
     {
         Location = new Point(69, 46),
         Size     = new Size(175, 21)
     };
     labelPublisher = new Label()
     {
         Text     = "Publisher",
         AutoSize = true,
         Location = new Point(6, 76),
         Size     = new Size(30, 13)
     };
     comboBoxPublishers = new ComboBox()
     {
         Location = new Point(69, 73),
         Size     = new Size(175, 21)
     };
     labelCategories = new Label()
     {
         Text     = "Categories",
         AutoSize = true,
         Location = new Point(6, 103),
         Size     = new Size(57, 13)
     };
     checkedListBoxCategories = new CheckedListBox()
     {
         ScrollAlwaysVisible = true,
         Location            = new Point(69, 103),
         Size = new Size(175, 94)
     };
     labelPublicationDate = new Label()
     {
         Text     = "Publication Date",
         AutoSize = true,
         Location = new Point(6, 204),
         Size     = new Size(85, 13)
     };
     comboBoxPublicationDate = new ComboBox()
     {
         Location = new Point(9, 221),
         Size     = new Size(82, 21)
     };
     labelMonth = new Label()
     {
         Text     = "Month",
         AutoSize = true,
         Location = new Point(97, 204),
         Size     = new Size(37, 13)
     };
     comboBoxMonth = new ComboBox()
     {
         Location = new Point(97, 221),
         Size     = new Size(72, 21)
     };
     labelYear = new Label()
     {
         Text     = "Year",
         AutoSize = true,
         Location = new Point(172, 204),
         Size     = new Size(29, 13)
     };
     numericUpDownYear = new NumericUpDown()
     {
         Location = new Point(175, 222),
         Size     = new Size(69, 20)
     };
     labelSearchResult = new Label()
     {
         Text     = "Search Result",
         AutoSize = true,
         Location = new Point(250, 16),
         Size     = new Size(74, 13)
     };
     dataGridViewSearchResult = new DataGridView()
     {
         AllowUserToAddRows    = false,
         AllowUserToDeleteRows = false,
         AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.AllCells,
         Location = new Point(253, 32),
         Size     = new Size(600, 210)
     };
     AddControls();
     AddItemsToComboBoxAuthors();
     AddItemsToComboBoxPublishers();
     AddItemsToCheckedListBoxCategories();
     AddItemsToComboBoxPublicationDate();
     AddItemsToComboBoxMonth();
     AddItemsToNumericUpDownYear();
     AddEventsToControls();
     UpdateDataGridViewSearchResult();
 }