Example #1
0
        public ReturnData addBookIssuingDetails()
        {
            ReturnData rd = new ReturnData();

            SqlConnection con = new SqlConnection(db_connection_string);
            string        sql = "";

            sql = "insert into bookIssuingDetails (bookCode,studentID,issueDate,returnDate) values (@bookID,@studentID,@issueDate,@returnDate) ";

            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.Parameters.AddWithValue("@bookID", this.bookID);
            cmd.Parameters.AddWithValue("@studentID", this.studentID);
            cmd.Parameters.AddWithValue("@issueDate", this.issueDate);
            cmd.Parameters.AddWithValue("@returnDate", this.returnDate);

            int count = 0;

            con.Open();
            try
            {
                count = (int)cmd.ExecuteNonQuery();
            }
            catch (Exception Ex)
            {
                rd.status  = 0;
                rd.message = Ex.Message;
            }
            con.Close();

            if (count > 0)
            {
                rd.status  = 1;
                rd.message = "OK";
                BookCodeDetails bookCodeDetails = new BookCodeDetails();
                bookCodeDetails.updateBorrowedStatus(bookID);
                // rd.para1 = temp_invoice_id;
            }

            return(rd);
        }
Example #2
0
        internal ReturnData extendTheBook(bookIssuingDetails bookIssuing)
        {
            ReturnData rd = new ReturnData();

            SqlConnection con = new SqlConnection(db_connection_string);
            string        sql = "";

            sql = "update bookIssuingDetails set returnDate=@returnDate where bookCode=@bookID";

            SqlCommand cmd = new SqlCommand(sql, con);

            cmd.Parameters.AddWithValue("@bookID", bookIssuing.bookID);
            cmd.Parameters.AddWithValue("@returnDate", getBookReturnDate());

            int count = 0;

            con.Open();
            try
            {
                count = (int)cmd.ExecuteNonQuery();
            }
            catch (Exception Ex)
            {
                rd.status  = 0;
                rd.message = Ex.Message;
            }
            con.Close();

            if (count > 0)
            {
                rd.status  = 1;
                rd.message = "OK";
                BookCodeDetails bookCodeDetails = new BookCodeDetails();
                bookCodeDetails.updateBorrowedStatus(bookID);
                // rd.para1 = temp_invoice_id;
            }

            return(rd);
        }