public IDataReader RetrieveBookCheckOutHistory(int bookID)
        {
            IDataReader reader  = null;
            SqlCommand  command = new SqlCommand();

            try
            {
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = Constants.SP_BookBorrowingHistory;

                command.Parameters.AddWithValue("@BookID", bookID);
                reader = base.ExecuteReader(command);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw new Exception("Oops! Something went wrong.");
            }
            catch (Exception ex)
            {
                ErroLogDBOperations db = ErroLogDBOperations.getInstance();
                db.ErrorLog(ex.Message, "In RetrieveBookCheckOutHistory ");

                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                reader.Dispose();
            }
            finally
            {
                command.Dispose();
            }

            return(reader);
        }
        public IDataReader RetriveGazetteHoliday()
        {
            IDataReader reader  = null;
            SqlCommand  command = new SqlCommand();

            try
            {
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = Constants.SP_RetriveGazetteHoliday;
                reader = base.ExecuteReader(command);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw new Exception("Oops! Something went wrong.");
            }
            catch (Exception ex)
            {
                ErroLogDBOperations db = ErroLogDBOperations.getInstance();
                db.ErrorLog(ex.Message, "In RetriveGazetteHoliday ");
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
                reader.Dispose();
            }
            finally
            {
                command.Dispose();
            }

            return(reader);
        }
        public int CheckIn(int bookID)
        {
            SqlCommand command = new SqlCommand();
            int        result  = 0;

            try
            {
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = Constants.SP_CheckIn;

                command.Parameters.AddWithValue("@BookID", bookID);
                result = base.ExecuteNonQuery(command);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw new Exception("Oops! Something went wrong.");
            }
            catch (Exception ex)
            {
                ErroLogDBOperations db = ErroLogDBOperations.getInstance();
                db.ErrorLog(ex.Message, "In CheckIn Book insertion");
            }
            finally
            {
                command.Dispose();
            }

            return(result);
        }
        public int CheckOut(int bookID, string Name, string MobileNo, string NationalID, DateTime checkOutDate, DateTime ReturnDate)
        {
            SqlCommand command = new SqlCommand();
            int        result  = 0;

            try
            {
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = Constants.SP_CheckOut;

                command.Parameters.AddWithValue("@BookID", bookID);
                command.Parameters.AddWithValue("@Name", Name);
                command.Parameters.AddWithValue("@MobileNo", MobileNo);
                command.Parameters.AddWithValue("@NationalID", NationalID);
                command.Parameters.AddWithValue("@CheckOutDate", checkOutDate);
                command.Parameters.AddWithValue("@ReturnDate", ReturnDate);

                result = base.ExecuteNonQuery(command);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw new Exception("Oops something went wrong.");
            }
            catch (Exception ex)
            {
                ErroLogDBOperations db = ErroLogDBOperations.getInstance();
                db.ErrorLog(ex.Message, "In CheckOut Book insertion");
            }
            finally
            {
                command.Dispose();
            }

            return(result);
        }
 private new void initialize()
 {
     try
     {
         base.initialize();
     }
     catch (Exception ex)
     {
         ErroLogDBOperations db = ErroLogDBOperations.getInstance();
         db.ErrorLog(ex.Message, "In BookCheckInCheckOutDBOperations initialize");
     }
 }