private void isssueButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(bookIdTexBox.Text) || string.IsNullOrEmpty(nameTextBox.Text))
         {
             MessageBox.Show("Enter Book Id Or Name", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         else
         {
             info.Id   = int.Parse(bookIdTexBox.Text);
             info.Name = nameTextBox.Text;
             // info.BookIssueTo = issueDateTextBox.Text;
             cm.InsertIssue(info);
             ob       = sd.GetBookName(info.Id);
             quantity = ob.BookInventory - 1;
             if (quantity > 0)
             {
                 sd.ReturnBook(info.Id, quantity);
                 MessageBox.Show("Issued Successfully", "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
             else
             {
                 MessageBox.Show("Book Is not Available.", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             }
         }
     }
     catch (FormatException)
     {
         MessageBox.Show("Book Id Can Not Be Name", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Beispiel #2
0
 private void returnBookText_TextChanged(object sender, EventArgs e)
 {
     name               = returnBookText.Text;
     ob                 = sd.GetBookName(name);
     nameLabel.Text     = ob.AuthorName;
     idLabel.Text       = ob.Id.ToString();
     catagoryLabel.Text = ob.Catagory;
     returnbook         = ob.BookInventory + 1;
     id                 = ob.Id;
 }