Esempio n. 1
0
 private void Returnbtn_Click(object sender, EventArgs e)
 {
     try
     {
         Reader r = new Reader();
         loan   l = new loan(usernamereturn.Text, Convert.ToInt32(textBox1.Text));
         if (r.Data_is_correct(usernamereturn.Text, Convert.ToInt32(textBox1.Text)) != 0)
         {
             if (l.Check_data_is_true_in_request(ISBNForreturnBook.Text) != 0)
             {
                 if (l.return_book(ISBNForreturnBook.Text))
                 {
                     MessageBox.Show("You return book in the time");
                 }
                 else
                 {
                     MessageBox.Show("Ufortunatly you blocked due to late in return book");
                 }
             }
             else
             {
                 MessageBox.Show("There are an error of request data you entered");
             }
         }
         else
         {
             MessageBox.Show("Data of reader is in correct");
         }
     }
     catch (Exception)
     {
     }
 }
Esempio n. 2
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         Reader  r = new Reader();
         context c = new context();
         loan    l = new loan(usernametxt.Text, Convert.ToInt32(ReaderIDtxt.Text));
         c.Setstrategy(new loan(usernametxt.Text, Convert.ToInt32(ReaderIDtxt.Text)));
         if (r.Data_is_correct(usernametxt.Text, Convert.ToInt32(ReaderIDtxt.Text)) == 1)
         {
             if (l.Check_data_is_true_in_request(ISBNtxt.Text) == 0)
             {
                 if (r.Checking_block_or_not(usernametxt.Text, Convert.ToInt32(ReaderIDtxt.Text)))
                 {
                     if (c.Execute_strategy(ISBNtxt.Text))
                     {
                         MessageBox.Show("Done");
                     }
                     else
                     {
                         MessageBox.Show("Unfortunately there are no copies from this book");
                     }
                 }
                 else
                 {
                     MessageBox.Show("Unfortunately you are blocked");
                 }
             }
             else
             {
                 MessageBox.Show("There is the same data for current request");
             }
         }
         else
         {
             MessageBox.Show("Error in Data you entered");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("You forget to enter some data");
     }
 }