コード例 #1
0
        private void Button6_Click(object sender, EventArgs e)
        {
            int    issueID = Convert.ToInt32(cmbIssueID_return.SelectedValue.ToString());
            string newDate = newReturnDate.Value.ToShortDateString();

            int bookID       = SelectQueries.GetBookidFromIssueId(issueID);
            int crntIssueReq = SelectQueries.GetBookCountInIssueRequests(bookID);

            //Book issue can be extended as no issue requests are there for that book
            if (crntIssueReq == 0)
            {
                UpdateQueries.UpdateReturnDate(issueID, newDate);
                string message = "Return Date successfully changed";
                MessageBox.Show(message, "DONE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ViewToUpdateReturns();
            }
            else
            {
                string message = "Cannot change return date as there is a issue request for same book";
                MessageBox.Show(message, "PROBIHATED", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }