/* (non-Java-doc)
   * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    // TODO Auto-generated method stub
    response.setContentType("text/html");
    PrintWriter kout = response.getWriter();
    kout.println("<html><head><title>Competition Creation Process</title></head>");
    HttpSession my = request.getSession();

    String taid = "", tsid = "", tsubmittedon = "", tsecuredmarks = "";
    String tfid = "", tsubmissionwas = "", query1 = "";
    int myear = new Date().getYear() - 100, d = new Date().getDate(), m = new Date().getMonth() + 1;

    Connection mycon = null;
    Statement st;

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
      mycon = DriverManager.getConnection("jdbc:odbc:myvcs");
      // kout.println("<br><br>**************************************************************************************************************");
      // kout.println("<br><h1>Your Connection With Mentioned DataSource Was Established
      // Successfully </h1>");
      // kout.println("<br><br>**************************************************************************************************************");
      if (mycon != null) {

        try {
          taid = "11comp02";
          tsid = "4";
          tsubmittedon = "19/10/1989";
          tsecuredmarks = "12";
          tsubmissionwas = "11/2/2011";

          taid = request.getParameter("aid");
          tsid = request.getParameter("sid");
          tsubmissionwas = request.getParameter("submissionwas");
          tsecuredmarks = request.getParameter("securedmarks");

          tsubmittedon = request.getParameter("submittedon");
          tsubmittedon = m + "/" + d + "/" + (myear + 2000); // access
          tsubmittedon = (myear + 2000) + "/" + m + "/" + d; // db2

          tfid = request.getAttribute("uid").toString();

          st = mycon.createStatement();
          ResultSet rs =
              st.executeQuery("select * from assign_allocation where aid='" + taid + "'");
          int tot = 0;
          while (rs.next()) {
            tot = rs.getRow();
          }
          if (tot != 0) {
            query1 =
                "insert into assign_submitted(aid,sid,submittedon,submissionwas,securedmarks,fid) values('"
                    + taid
                    + "','"
                    + tsid
                    + "','"
                    + tsubmittedon
                    + "','"
                    + tsubmissionwas
                    + "','"
                    + tsecuredmarks
                    + "','"
                    + tfid
                    + "')";
            st = mycon.createStatement();
            st.executeUpdate(query1);
            kout.println(
                "<br><br><br><h1>Student's Assignment Marks Are Declared Or Added Successfully");
            mystr = "Assignment Marks Are Declared";
          } else mystr = "Assignment Does Not Exists";
          // kout.println("<br><br><br><h1>Sorry Assignment Does Not Exists");
        } catch (Exception e) {
          System.err.println(e);
          myerror = e.getMessage();

        } finally {
          mycon.close();
        }
      } else mystr = "Sorry Connection Is In-Active";

    } catch (Exception k) {
      System.err.println(k);
      myerror = myerror + "<br>" + k.getMessage();

    } finally {
      kout.println("<html>");
      kout.println("<body OnLoad=document.getElementById('vcs').submit();>");
      kout.println("<form id=vcs method=post action=/VcsTest/Faculty/FacultyAssignmentMarks.jsp>");
      kout.println("<input type=hidden name=common value='" + mystr + "' >");
      kout.println("</form>");
      kout.println("</body></html>");

      kout.println("<html><body background='myreport1.jpg'>");
      kout.println("</body></html>");

      if (myerror != null) kout.println("There Is A Error From Server-Side=" + myerror);

      kout.close();
    }
  }
예제 #2
0
  /* (non-Java-doc)
   * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    // TODO Auto-generated method stub
    response.setContentType("text/html");
    PrintWriter kout = response.getWriter();
    kout.println("<html><head><title>View Blogs In VCS</title></head>");

    HttpSession my = request.getSession(false);

    String tdate = new Date().toGMTString().toString(),
        forrole = my.getAttribute("urole").toString();
    Connection mycon = null;
    Statement st;

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
      mycon = DriverManager.getConnection("jdbc:odbc:myvcs");
      // kout.println("<br><br>**************************************************************************************************************");
      // kout.println("<br><h1>Your Connection With Mentioned DataSource Was Established
      // Successfully </h1>");
      // kout.println("<br><br>**************************************************************************************************************");
      if (mycon != null) {
        try {
          kout.println(
              "<br><br><center>**************************************************************************************************************");
          kout.println("<table border=0>");
          kout.println(
              "<tr><td colspan=100%><center><h2>"
                  + Styles.ccase("Organisation : virtual class room system")
                  + "</center>");
          kout.println("<tr><td><br>");
          kout.println(
              "<tr><td colspan=75%><blockquote><h2>"
                  + Styles.ccase("Report For : " + forrole)
                  + "<td><h2>"
                  + Styles.ccase(tdate));
          kout.println(
              "<tr><td colspan=75%><blockquote><h2>"
                  + Styles.ccase("Report Title : " + "View Blogs")
                  + "<td><h2><a href='javascript:history.go(-1)'>Back</a>");
          kout.println("</table>");
          kout.println(
              "<br><br><br>**************************************************************************************************************</center><br>");

          // kout.println("<br><br><h1>View Blogs In VCS</h1>");
          /*String trole,tuserid,tprior;
          trole=request.getAttribute("urole").toString();
          tuserid=request.getAttribute("uid").toString();
          tprior=request.getAttribute("uprior").toString();*/

          st = mycon.createStatement();
          ResultSet rs = st.executeQuery("select * from blog_master");

          int c = 1;
          kout.println("<center>");
          while (rs.next()) {
            kout.println("<center><table width=95% border=2 bordercolor=black>");
            String str = rs.getString("bid");
            kout.println("<tr><td colspan=100%><center>" + Fortable.display(153, "*"));

            if (c % 2 == 1)
              kout.println("<tr><td colspan=95%><center><h1>Blog Id :" + str + "</center></h1>");
            else kout.println("<tr><td colspan=95%><center><h2>Blog Id :" + str + "</center></h2>");

            kout.println(
                "<tr><td>Sr No:<td>"
                    + c
                    + "<tr><td>Given By:<td>"
                    + rs.getString("userid")
                    + "<tr><td>Blog Date & Time:<td>"
                    + rs.getString("bdate")
                    + "<tr><td>CourseName<td>"
                    + rs.getString("coursename"));
            kout.println("<tr><td colspan=11><center>Blog Message:</center>");
            kout.println("<tr><td colspan=11>" + rs.getString("bmsg"));
            c = c + 1;

            kout.println("<tr><td colspan=100%><center>" + Fortable.display(33, "<<->>"));
            kout.println("</table><br>");
          }
          rs.close();
          st.close();
          if (c == 1)
            kout.println("<br><br><h1>Sorry No Blog Have Been Created Or Available At Present");

        } catch (Exception k) {
          System.err.println(k);
          myerror = k.getMessage();
        } finally {
          mycon.close();
        }
      } else kout.println("<br><br><h2><center>Sorry Connection Is Not Active Now");
    } catch (Exception k) {
      System.err.println(k);
      myerror = myerror + "<br>" + k.getMessage();
    } finally {
      kout.println("<html><body background='myreport1.jpg'>");
      kout.println("</body></html>");

      if (myerror != null) kout.println("There Is A Error From Server-Side=" + myerror);

      kout.close();
    }
  }
  /* (non-Java-doc)
   * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    // TODO Auto-generated method stub
    response.setContentType("text/html");
    PrintWriter kout = response.getWriter();
    kout.println("<html><head><title>Management Deletion Only By Admin</title></head>");

    String tmid = "", query1 = "";

    Connection mycon = null;
    Statement st;

    try {
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
      mycon = DriverManager.getConnection("jdbc:odbc:myvcs");
      // kout.println("<br><br>**************************************************************************************************************");
      // kout.println("<br><h1>Your Connection With Mentioned DataSource Was Established
      // Successfully </h1>");
      // kout.println("<br><br>**************************************************************************************************************");
      if (mycon != null) {
        try {
          /*kout.println("<br><br><center>**************************************************************************************************************");
          kout.println("<br><h1>Management Deletion Only By Admin In VCS</h1>");
          kout.println("<br><br><br>**************************************************************************************************************</center><br>");*/

          tmid = "11mgt1";
          tmid = request.getParameter("mid");
          st = mycon.createStatement();
          ResultSet rs1 = st.executeQuery("select * from mgt_master where mid='" + tmid + "'");
          int tot = 0;
          while (rs1.next()) {
            tot = rs1.getRow();
          }
          if (tot != 0) {
            st = mycon.createStatement();
            query1 = "delete from mgt_master where mid='" + tmid + "'";
            st.executeUpdate(query1);
            st = mycon.createStatement();
            query1 = "delete from login_master where userid='" + tmid + "'";
            st.executeUpdate(query1);

            // kout.println("<br><br><br><h1>Management Deleted Successfully");
            mystr = "Management Info Deleted";
          } else mystr = "Management Is Not Deleted";
          // kout.println("<br><br><br><h1>Sorry Management Cannot Be Deleted Since Management May
          // Not Exists Or Some Other Restriction Are Given");
        } catch (Exception k) {
          System.err.println(k);
          myerror = k.getMessage();

        } finally {
          mycon.close();
        }
      } else mystr = "Sorry Connection Is In-Active";

    } catch (Exception k) {
      System.err.println(k);
      myerror = myerror + "<br>" + k.getMessage();

    } finally {
      kout.println("<html>");
      kout.println("<body OnLoad=document.getElementById('vcs').submit();>");
      kout.println("<form id=vcs method=post action=/VcsTest/Admin/AdminMgtDelete.jsp>");
      kout.println("<input type=hidden name=common value='" + mystr + "' >");
      kout.println("</form>");
      kout.println("</body></html");

      kout.println("<html><body background='myreport1.jpg'>");
      kout.println("</body></html>");

      if (myerror != null) kout.println("There Is A Error From Server-Side=" + myerror);

      kout.close();
    }
  }