コード例 #1
0
        ///////////////////////////////////////////////
        //        Issuing the Book to Member         //
        ///////////////////////////////////////////////

        private void btn_Issue_Click(object sender, EventArgs e)
        {
            if (dgv_Books.SelectedRows.Count == 0)
            {
                MessageBox.Show("Must select Some Book First to issue it...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Verifing the Member's Membersihp Validity
            if (DateTime.Now >= Convert.ToDateTime(member.MembershipExpiryDate))
            {
                MessageBox.Show("Membership of Selected Member Expired...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Checking Whether the Book is Issued to Some Member or Not
            if (!string.IsNullOrWhiteSpace(dgv_Books.SelectedRows[0].Cells[7].Value.ToString()))
            {
                MessageBox.Show("The Selected Book Has Already been Issued to Some User...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            StatusOfIssue issueStatus = new StatusOfIssue();

            issueStatus.BookID     = dgv_Books.SelectedRows[0].Cells[0].Value.ToString();
            issueStatus.MemberID   = member.MemberID;
            issueStatus.IssueDate  = DateTime.Now.ToString("yyyy-MM-dd");
            issueStatus.ExpiryDate = dtp_Expiry.Value.ToString("yyyy-MM-dd");

            if (business.IssueBook_Scure(issueStatus) == 1)
            {
                MessageBox.Show("Book Issued to Member Successfully...!", "Book Issued", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
コード例 #2
0
        ///////////////////////////////////////////////
        //        Issuing the Book to Member         //
        ///////////////////////////////////////////////

        private void btn_Issue_Click(object sender, EventArgs e)
        {
            if (dgv_Members.SelectedRows.Count == 0)
            {
                MessageBox.Show("Must select Some Member First to issue it...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Verifing the Member's Membership Validity
            if (DateTime.Now >= Convert.ToDateTime(dgv_Members.SelectedRows[0].Cells[4].Value))
            {
                MessageBox.Show("Membership of Selected Member Expired...!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            StatusOfIssue issueStatus = new StatusOfIssue();

            issueStatus.BookID     = book.BookID;
            issueStatus.MemberID   = dgv_Members.SelectedRows[0].Cells[0].Value.ToString();
            issueStatus.IssueDate  = DateTime.Now.ToString("yyyy-MM-dd");
            issueStatus.ExpiryDate = dtp_Expiry.Value.ToString("yyyy-MM-dd");

            if (business.IssueBook_Scure(issueStatus) == 1)
            {
                MessageBox.Show("Book Issued to Member Successfully...!", "Book Issued", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
コード例 #3
0
        /////////////////////////////////////////////////////////////////////////////////////////
        //     Defining Functions to Manipulate the StatusOfIssue Table of DataBase LMS        //
        /////////////////////////////////////////////////////////////////////////////////////////

        public int IssueBook_Scure(StatusOfIssue issueStatus)
        {
            int check = 0;

            try
            {
                check = dataAccess.IssueBook(issueStatus);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                dataAccess.closeConnection();
            }

            return(check);
            /////////////////////////////////////////////////////////////////////////////////////
        }