Exemplo n.º 1
0
        private void btnAddBook_Click(object sender, EventArgs e)
        {
            BookAddUpdateFrm addBook = new BookAddUpdateFrm();  // for connecting first constructor of BookAddUpdate form.

            if (addBook.ShowDialog(this) == DialogResult.OK)
            {
                fill_listView();  // after the changes, clear and fill the listView again.
            }
        }
Exemplo n.º 2
0
 private void lvBooks_DoubleClick(object sender, EventArgs e)
 {
     if (lvBooks.SelectedItems.Count == 1)                                                      // if user select 'a line of listView' not more not less.
     {
         int indiceBookID            = Convert.ToInt32(ALbookID[lvBooks.SelectedIndices[0]]);   // for finding selected bookID from the array that we create.
         int indiceWriterID          = Convert.ToInt32(ALwriterID[lvBooks.SelectedIndices[0]]); //for finding selected writerID from the array that we create.
         BookAddUpdateFrm updateBook = new BookAddUpdateFrm(indiceBookID, indiceWriterID);      // for connecting other constructor of BookAddUpdate form.
         if (updateBook.ShowDialog(this) == DialogResult.OK)
         {
             fill_listView();  // after the changes, clear and fill the listView again.
         }
     }
 }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            BookAddUpdateFrm bridge = new BookAddUpdateFrm();                                    // I define number control function on BookAddUpdateFrm. So I have to create an object to call this function.

            if (tbCurrentStock.Text != "" && bridge.number_control(tbCurrentStock.Text) == true) //if the only space is not empty and if it is a number...
            {
                if (tbCurrentStock.Text != lblPreviousStockDynamic.Text)                         // if new stock is different from previous one...
                {
                    updateStock();                                                               //update the stock
                    MessageBox.Show("Stock is updated successfully", " :) ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = DialogResult.OK;                                         //conditions are completed.
                    this.Close();                                                                //close the StockIncreaseDecreaseFrm
                }
                else
                {
                    MessageBox.Show("You should change the stock for update", "Not Valid", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
            else
            {
                MessageBox.Show("Please check the stock information.", "Not Valid", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }