Ejemplo n.º 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 1 && dataGridView3.SelectedRows.Count == 1)
     {
         if (Convert.ToInt32(dataGridView3.SelectedCells[2].Value) == 0)
         {
             MessageBox.Show("Selected Book not available", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             double d = (dateTimePicker2.Value.Date - DateTime.Now.Date).TotalDays;
             if (d > 0)
             {
                 MessageBox.Show(lc.assignBookalreadyCustomer(DateTime.Today, dateTimePicker2.Value, Convert.ToInt32(dataGridView3.SelectedCells[0].Value), Convert.ToInt32(dataGridView1.SelectedCells[0].Value), Convert.ToInt32(dataGridView3.SelectedCells[2].Value)), "Successful");
                 dataGridView3.DataSource = null;
                 dateTimePicker2.Value    = DateTime.Today;
             }
             else
             {
                 MessageBox.Show("Submission date must be greater than today's date", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     else
     {
         MessageBox.Show("Please Select any Book and Customer First", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }