Jump to content

User:Geeta Pargai

From Wikipedia, the free encyclopedia

package ctrlr.action;

import java.io.IOException; import java.sql.SQLException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.form.TopicCatalog; import model.utility.TopicCatalogUtility; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;

public class AddAction extends Action { public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException,SQLException { TopicCatalog tc = (TopicCatalog)form; TopicCatalogUtility tut = new TopicCatalogUtility(); tc = tut.addNew(tc); return map.findForward("addout"); } } /////////////////////////////////////////////////////////////////////////////// package ctrlr.action;

import java.io.IOException; import java.sql.SQLException;

import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession;

import model.form.Associate; import model.form.AssociateUtility;

import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;

public class AddMarkAction extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException, SQLException { AssociateUtility asu = (AssociateUtility)form; asu=asu.addmark(asu); String id = asu.getUserid(); HttpSession hs = req.getSession(true); hs.setAttribute("userid",id );

return map.findForward("addmark"); }

} ////////////////////////////////////////////////////////////////////////////////package ctrlr.action;

import java.io.IOException;

import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession;

import model.form.AssociateUtility;

import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;

public class AddMarkAction1 extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException { AssociateUtility asu = (AssociateUtility)form; HttpSession hs = req.getSession(true); String id = (String)hs.getAttribute("userid"); asu.setUserid(id); asu=asu.addmark1(asu); System.out.println("AddAction 1"); System.out.println("mark "+asu.getMark()); System.out.println("userid "+asu.getUserid()); return map.findForward("addmark1"); }

} /////////////////////////////////////////////////////////////////////////////// package ctrlr.action;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession;

import model.form.Associate; import model.utility.AssociateUtility;

import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;

public class AssociateAction extends Action{ String option=""; public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws Exception { HttpSession hs=req.getSession(true); Associate asObj=(Associate)form; asObj.setUserid((String)hs.getAttribute("userid")); AssociateUtility utilityobj=new AssociateUtility(); System.out.println("Regd as topic:"+asObj.getTopic()); System.out.println("Regd as course:"+asObj.getCourse()); asObj=utilityobj.regAssociateInfo(asObj);

String topic = asObj.getTopic(); String course = asObj.getCourse(); System.out.println("Ass Action "+topic); System.out.println("Ass ACtion "+course);


HttpSession hs1 = req.getSession(true); hs1.setAttribute("topic", topic); hs1.setAttribute("course", course);


if(asObj.getReg_id()>0) { /*if(asObj.getClass_mark()==-1){ option="regsuccess1"; System.out.println("success wbt....1...class mark..."+asObj.getClass_mark()); } else{ option="regsuccess2"; System.out.println("success class ....1...wbt mark..."+asObj.getWbt_mark()); }*/ if(asObj.getMode().equals("wbt")) { option="regd_wbt"; } else { option="regd_cbt"; } }

else{ if((asObj.getMode().equals("wbt")) && (asObj.getStatus().equals("registered")) && (asObj.getClass_mark()==-1)) { asObj.setStatus("wbt_Not Completed"); } option="regfailure"; System.out.println("failure....1...wbt mark"+asObj.getWbt_mark()); System.out.println("failure....1...class mark"+asObj.getClass_mark()); }

return map.findForward(option); }

} /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import org.apache.struts.action.*;

import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import model.form.*; import model.utility.*; import java.util.*;


public class AssociateReportAction extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException { AssociateReport ar=(AssociateReport)form; ArrayList<Associate> aslist=ar.viewAssociateReport(); return map.findForward("associatelist"); }

} /////////////////////////////////////////////////////////////////////////////////**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package ctrlr.action;

import java.io.*; import java.sql.SQLException; import model.form.TopicCatalog; import model.utility.TopicCatalogUtility; import org.apache.struts.action.*; import javax.servlet.http.*; import javax.servlet.*;

public class DeleteCourseAction extends Action { public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException, SQLException { TopicCatalog tc= (TopicCatalog)form; TopicCatalogUtility tcu = new TopicCatalogUtility(); tcu.deleteCourse(tc); return map.findForward("delcourse"); } } /////////////////////////////////////////////////////////////////////////////////**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package ctrlr.action; import java.io.*; import java.sql.SQLException; import model.form.TopicCatalog; import model.utility.TopicCatalogUtility; import org.apache.struts.action.*; import javax.servlet.http.*; import javax.servlet.*;

public class DeleteTopicAction extends Action { public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp)throws IOException, ServletException, SQLException { TopicCatalog tc = (TopicCatalog)form; TopicCatalogUtility tcu = new TopicCatalogUtility(); tcu.deleteTopic(tc); return map.findForward("deltopic"); } } /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import org.apache.struts.action.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import model.form.*; import model.utility.*;

public class LoginAction extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException { Login lf=(Login)form; LoginUtility lu=new LoginUtility(); boolean res=lu.isValid(lf); if(res) { System.out.println(res); String type=lf.getType(); HttpSession hs=req.getSession(true); hs.setAttribute("name",lf.getName()); if(type.equals("associate")) { return map.findForward("associate"); } else { return map.findForward("admin"); } } else return map.findForward("unauthorized");

}

} /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478454
  Emp Name:Geeta Pargai
  Project Name:SABA ITP Learning Automation
    • /

package ctrlr.action; import javax.servlet.http.*;

import model.form.Associate; import model.form.AssociateUtility;

import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.Action; import java.io.*; import java.util.ArrayList;

import javax.servlet.*;


public class ShowDetailsAction extends Action{ public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp)throws IOException,ServletException { HttpSession hs=req.getSession(true); AssociateUtility auObj=(AssociateUtility)form; auObj.setUserid((String)hs.getAttribute("userid")); ArrayList<Associate> aslist=auObj.showDetails(); return map.findForward("details"); } }

/////////////////////////////////////////////////////////////////////////////// package ctrlr.action;


import model.form.*; import model.utility.*;

import org.apache.struts.action.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TestAction extends Action{

public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws IOException,ServletException { String id = "478596"; Test t =(Test)form; Associate as = new Associate(); WBTUtility wbu =new WBTUtility(); t= wbu.calculateMarks(t); int wbtmark = t.getResult(); String topic = t.getTopic(); String course = t.getCourse(); as.setUserid(id); as.setWbt_mark(wbtmark); as.setTopic(topic); as.setCourse(course); wbu.updateAssociateDetails(as); return map.findForward("testoutput"); }

} /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package ctrlr.action;

import org.apache.struts.action.*;

import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import model.form.*; import model.utility.*; import java.util.*;


public class TopicReportAction extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException { TopicReport ar=(TopicReport)form; ArrayList<Associate> aslist=ar.viewTopicReport(); return map.findForward("topiclist"); }

}


/////////////////////////////////////////////////////////////////////////////// package ctrlr.action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;

import model.form.TopicCatalog; import model.form.TopicCatalogUtility;

import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping;

public class TopicSearchAction extends Action{


@Override public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest req, HttpServletResponse resp) throws Exception { //TopicCatalog topicObj=(TopicCatalog)form; TopicCatalogUtility tu_obj=(TopicCatalogUtility)form; tu_obj=tu_obj.searchCourse(tu_obj); //System.out.println("arrlist size"+topic_list.size()); return map.findForward("searchlist"); }

} /////////////////////////////////////////////////////////////////////////////// package ctrlr.action;

import org.apache.struts.action.*;

import javax.servlet.*; import javax.servlet.http.*;

import java.io.*; import java.util.ArrayList;

import model.form.*; import model.utility.TopicCatalogUtility;;

public class TopicSearchAction1 extends Action{

public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse resp) throws IOException,ServletException {

TopicCatalog tc=(TopicCatalog)form; TopicCatalogUtility tcu=new TopicCatalogUtility(); ArrayList<TopicCatalog> tclist=tcu.searchTopic(tc); return map.findForward("searchout"); } } /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478454
  Emp Name:Geeta Pargai
  Project Name:SABA ITP Learning Automation
    • /

package model.form;

import java.io.Serializable; import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.*;

import java.util.*;

public class Associate extends ActionForm implements Serializable{ private String userid; private String topic; private String course; private Date reg_date; private Date completed_date; private double wbt_mark; private double class_mark; private double total_mark; private String status; private int reg_id;

   private String mode;

public String getMode() { return mode; } public void setMode(String mode) { this.mode = mode; }

public double getClass_mark() { return class_mark; } public void setClass_mark(double class_mark) { this.class_mark = class_mark; } public Date getCompleted_date() { return completed_date; } public void setCompleted_date(Date completed_date) { this.completed_date = completed_date; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public Date getReg_date() { return reg_date; } public void setReg_date(Date reg_date) { this.reg_date = reg_date; } public int getReg_id() { return reg_id; } public void setReg_id(int reg_id) { this.reg_id = reg_id; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public double getTotal_mark() { return total_mark; } public void setTotal_mark(double total_mark) { this.total_mark = total_mark; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public double getWbt_mark() { return wbt_mark; } public void setWbt_mark(double wbt_mark) { this.wbt_mark = wbt_mark; } public void reset(ActionMapping map,HttpServletRequest req) { this.mode=null; }

/* public void reset(ActionMapping map,HttpServletRequest req) {

this.userid=null; this.topic=null; this.course=null; this.reg_date=null; this.completed_date=null; this.wbt_mark=Double.parseDouble(null); this.class_mark=Double.parseDouble(null); this.total_mark=Double.parseDouble(null); this.status=null; this.reg_id=Integer.parseInt(null);

   }

public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors();

if(userid.trim().length()<=0) { ae.add("userid_req", new ActionMessage("userid_required")); } if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(course.trim().length()<=0) { ae.add("course_req", new ActionMessage("course_required")); } if(reg_date==null) { ae.add("reg_date_req", new ActionMessage("reg_date_required")); } if(completed_date==null) { ae.add("completed_date_req", new ActionMessage("completed_date_required")); } if(wbt_mark<=0||wbt_mark==Double.parseDouble(null)) { ae.add("wbt_mark_req", new ActionMessage("wbt_mark_required")); } if(class_mark<=0||class_mark==Double.parseDouble(null)) { ae.add("class_mark_req", new ActionMessage("class_mark_required")); } if(total_mark<=0||total_mark==Double.parseDouble(null)) { ae.add("total_mark_req", new ActionMessage("total_mark_required")); } if(status.trim().length()<=0) { ae.add("status_req", new ActionMessage("status_required")); } if(reg_id<=0||reg_id==Integer.parseInt(null)) { ae.add("reg_id", new ActionMessage("reg_id_required")); }

return ae; }*/ public ActionErrors validate(ActionMapping map,HttpServletRequest req){ ActionErrors ae=new ActionErrors();

if(mode==null) { ae.add("mode_err", new ActionMessage("mode.required")); } return ae; } } /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  Method:viewAssociateReport
  Purpose:To Display the Associate-Wise Report
  • /

package model.form;

import java.io.Serializable; import java.sql.ResultSet; import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.*;

import dbopr.DBHandler;

import java.util.*;

public class AssociateReport extends ActionForm implements Serializable{

private String userid; private String month; private ArrayList<Associate> alist=new ArrayList<Associate>();

public ArrayList<Associate> getAlist() { return alist; }

public void setAlist(ArrayList<Associate> alist) { this.alist = alist; }

public String getUserid() { return userid; }

public void setUserid(String userid) { this.userid = userid; }

public String getMonth() { return month; }

public void setMonth(String month) { this.month = month; }

public void reset(ActionMapping map,HttpServletRequest req) { this.userid=null; this.month=null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(userid.trim().length()<=0) { ae.add("userid_req", new ActionMessage("userid_required")); } if(month.trim().length()<=0 || month.trim().equals("none")) { ae.add("month_req", new ActionMessage("month_required")); } return ae; }

public ArrayList<Associate> viewAssociateReport() { DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String query="select * from associate,dual where userid = '"+userid.trim().toUpperCase()+"' and (to_char(reg_date,'mm')='"+month+"' or to_char(com_date,'mm')='"+month+"' ) and (to_char(reg_date,'yyyy')='"+(new Date().getYear() + 1900)+"' or to_char(com_date,'yyyy')='"+(new Date().getYear()+ 1900)+"')"; try{ ResultSet rs=db.executeDRLOperation(query); while(rs.next()) { Associate as=new Associate(); as.setUserid(rs.getString(1)); as.setTopic(rs.getString(2)); as.setCourse(rs.getString(3)); as.setReg_date(rs.getDate(4)); as.setCompleted_date(rs.getDate(5)); as.setClass_mark(rs.getDouble(6)); as.setWbt_mark(rs.getDouble(7)); as.setStatus(rs.getString(8)); alist.add(as); } }catch(Exception e) { System.out.println("Exception in viewAssociateReport:"+e); } }

return alist;

        }

} /////////////////////////////////////////////////////////////////////////////// package model.form; import java.util.*;

import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage;

import model.form.Associate; import dbopr.DBHandler;

public class AssociateUtility extends ActionForm implements Serializable{ private ArrayList<Associate> aslist=new ArrayList<Associate>(); private String userid; private String course; private double mark; private int chk; private ArrayList<String> topiclist=new ArrayList<String>(); private ArrayList<String> courselist=new ArrayList<String>();


public int getChk() { return chk; } public void setChk(int chk) { this.chk = chk; } public ArrayList<Associate> getAslist() { return aslist; } public void setAslist(ArrayList<Associate> aslist) { this.aslist = aslist; }

public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; }

public ArrayList<String> getCourselist() { return courselist; } public void setCourselist(ArrayList<String> courselist) { this.courselist = courselist; } public ArrayList<String> getTopiclist() { return topiclist; } public void setTopiclist(ArrayList<String> topiclist) { this.topiclist = topiclist; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public double getMark() { return mark; } public void setMark(double mark) { this.mark = mark; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); HttpSession hs = req.getSession(); if(hs.getAttribute("name").toString().equals("Admin")) { if(userid.trim().length()<=0 || userid.trim().equals("none")) { ae.add("userid_req", new ActionMessage("userid_required")); } System.out.println("Mark value is:"+mark); if(mark<=0) { System.out.println("Recognized mark error!!!!"); ae.add("mark_req", new ActionMessage("mark_required")); } if(mark>100) { ae.add("mark_inv", new ActionMessage("mark_invalid")); } }


return ae; }


public ArrayList<Associate> showDetails(){ try{ DBHandler db=new DBHandler(); boolean stat=db.establishConnection();

if(stat){ String query="select * from associate where userid='"+this.getUserid()+"'"; System.out.println(query); ResultSet res=db.executeDRLOperation(query);

while(res.next())

{ Associate ascObj=new Associate(); ascObj.setUserid(res.getString(1)); ascObj.setTopic(res.getString(2)); ascObj.setCourse(res.getString(3)); ascObj.setReg_date(res.getDate(4)); System.out.println(ascObj.getReg_date()); ascObj.setCompleted_date(res.getDate(5)); ascObj.setClass_mark(res.getDouble(6)); ascObj.setWbt_mark(res.getDouble(7)); ascObj.setStatus(res.getString(8)); aslist.add(ascObj); } } db.closeConnection(); }

catch(SQLException e) { System.out.println(e); } catch(Exception e) { System.out.println(e); } return aslist; }


public AssociateUtility addmark(AssociateUtility assutl) throws SQLException { DBHandler db = new DBHandler(); boolean conExists = db.establishConnection(); if(conExists) { String query = "select course_name from associate where userId='"+userid.trim()+"' and wbt_mark = -1 and status='registered'"; ResultSet rs = db.executeDRLOperation(query); while(rs.next()) { Associate a = new Associate(); //a.setTopic(rs.getString(1)); //a.setCourse(rs.getString(2)); //aslist.add(a); //topiclist.add(rs.getString(1)); System.out.println(rs.getString(1)); courselist.add(rs.getString(1)); } } return assutl; }


public AssociateUtility addmark1(AssociateUtility au) { DBHandler db = new DBHandler(); boolean conExists = db.establishConnection(); if(conExists) { if(mark>=75) { String query = "update associate set classroom_mark="+mark+", status = 'completed', com_date=sysdate where userId='"+userid.trim()+"'and course_name='"+course.trim().toUpperCase()+"'"; System.out.println(query); chk = db.executeDMLOperation(query); System.out.println("chk "+chk); au.setChk(chk); } else { String query = "update associate set classroom_mark="+mark+" where userId='"+userid.trim()+"'and course_name='"+course.trim().toUpperCase()+"'"; System.out.println(query); chk = db.executeDMLOperation(query); System.out.println("chk "+chk); au.setChk(chk); }

} return au; }

} /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  • /

package model.form;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;

import org.apache.struts.action.*;

public class Login extends ActionForm implements Serializable{

private String userid; private String pwd; private String type; private String name;

public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; }

public void reset(ActionMapping map,HttpServletRequest req) { this.userid=null; this.pwd=null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(userid.trim().length()<=0) { System.out.println("Blk 1"); ae.add("userid_req", new ActionMessage("userid_required")); } if(pwd.length()<=0) { System.out.println("Blk 2"); ae.add("pass_req",new ActionMessage("password_info")); } HttpSession hs=req.getSession(true); hs.setAttribute("userid",userid); return ae; }


} /////////////////////////////////////////////////////////////////////////////// package model.form; //import java.util.ArrayList;

import java.io.Serializable;

import org.apache.struts.action.*;

public class Test extends ActionForm implements Serializable {


//private ArrayList<String> alist;

private String quest1;

   private String quest2;

private String quest3; private String quest4; private String quest5; private String topic; private String course;

   private int result;



public String getQuest1() { return quest1; } public void setQuest1(String quest1) { this.quest1 = quest1; }

public String getQuest2() { return quest2; }

public void setQuest2(String quest2) { this.quest2 = quest2; }

public String getQuest3() { return quest3; }

public void setQuest3(String quest3) { this.quest3 = quest3; }

public String getQuest4() { return quest4; }

public void setQuest4(String quest4) { this.quest4 = quest4; }

public String getQuest5() { return quest5; }

public void setQuest5(String quest5) { this.quest5 = quest5; }

public int getResult() { return result; }

public void setResult(int result) { this.result = result; }

public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; System.out.println("current topic "+this.topic); }

// public ArrayList<String> getAlist() { // return alist; // } // // public void setAlist(ArrayList<String> alist) { // this.alist = alist; // } //




} /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478549
  Emp Name:Sarpharaaj Alam Sarkar
  Project Name:SABA ITP Learning Automation
    • /

package model.form;

import java.io.Serializable; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.*;

public class TopicCatalog extends ActionForm implements Serializable{ private String topic; private String course; private int chk; private int topicExistChk; private int courseExistChk;

public int getChk() { return chk; } public void setChk(int chk) { this.chk = chk; } public int getCourseExistChk() { return courseExistChk; } public void setCourseExistChk(int courseExistChk) { this.courseExistChk = courseExistChk; } public int getTopicExistChk() { return topicExistChk; } public void setTopicExistChk(int topicExistChk) { this.topicExistChk = topicExistChk; } public String getCourse() { return course; } public void setCourse(String course) { this.course = course; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public void reset(ActionMapping map,HttpServletRequest req) { this.topic=null; this.course = null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(course.trim().length()<=0) { ae.add("course_req", new ActionMessage("course.requird")); } return ae; } } /////////////////////////////////////////////////////////////////////////////// package model.form;

import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashSet;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage;

import dbopr.DBHandler; import model.form.TopicCatalog;

public class TopicCatalogUtility extends ActionForm implements Serializable{ //private String srchcriteria1; private String topic; private HashSet<String> courselist=new HashSet<String>();


public HashSet<String> getCourselist() { return courselist; } public void setCourselist(HashSet<String> courselist) { this.courselist = courselist; }

public TopicCatalogUtility searchCourse(TopicCatalogUtility tobj){ DBHandler db=new DBHandler(); boolean constatus=db.establishConnection(); if(constatus){ try{ String query="select course_name from topic where topic_name='"+topic.toUpperCase()+"'"; ResultSet rs=db.executeDRLOperation(query); courselist.clear(); while(rs.next()){ //TopicCatalog cobj=new TopicCatalog(); //cobj.setTopic(rs.getString(1)); //cobj.setCourse(rs.getString(2)); //topiclist.add(rs.getString(1)); courselist.add(rs.getString(1));


} } catch(SQLException e){ System.out.println("search course exception"+e); } } System.out.println("in utility array size"+courselist.size()); return tobj; } public ActionErrors validate(ActionMapping map,HttpServletRequest req){ ActionErrors ae=new ActionErrors(); topic=topic.trim(); if(topic.length()<=0){ ae.add("topic_err", new ActionMessage("topic.required")); } return ae; }

/*public String getSrchcriteria1() { return srchcriteria1; }

public void setSrchcriteria1(String srchcriteria1) { this.srchcriteria1 = srchcriteria1; }

public ArrayList<String> getTopiclist() { return topiclist; }

public void setTopiclist(ArrayList<String> topiclist) { this.topiclist = topiclist; }*/

public String getTopic() { return topic; }

public void setTopic(String topic) { this.topic = topic; }



} /////////////////////////////////////////////////////////////////////////////// /**

  Created By:-
  Team No:B-4
  Emp Id:478514
  Emp Name:Sameer Kalra
  Project Name:SABA ITP Learning Automation
  Method:viewTopicReport
  Purpose:To Display the Topic-Wise Report
  • /

package model.form;

import java.io.Serializable; import java.sql.ResultSet; import java.util.ArrayList; import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.*;

import dbopr.DBHandler;

import java.util.*;

public class TopicReport extends ActionForm implements Serializable{

private String topic; private String month; private ArrayList<Associate> alist=new ArrayList<Associate>();

public ArrayList<Associate> getAlist() { return alist; }

public void setAlist(ArrayList<Associate> alist) { this.alist = alist; }

public String getTopic() { return topic; }

public void setTopic(String topic) { this.topic = topic; }

public String getMonth() { return month; }

public void setMonth(String month) { this.month = month; }

public void reset(ActionMapping map,HttpServletRequest req) { this.topic=null; this.month=null; } public ActionErrors validate(ActionMapping map,HttpServletRequest req) { ActionErrors ae=new ActionErrors(); if(topic.trim().length()<=0) { ae.add("topic_req", new ActionMessage("topic_required")); } if(month.trim().length()<=0 || month.trim().equals("none")) { ae.add("month_req", new ActionMessage("month_required")); } return ae; }

public ArrayList<Associate> viewTopicReport() { DBHandler db=new DBHandler(); boolean connstatus=db.establishConnection(); if(connstatus) { String query="select * from associate,dual where topic_name = '"+topic.trim().toUpperCase()+"' and (to_char(reg_date,'mm')='"+month+"' or to_char(com_date,'mm')='"+month+"' ) and (to_char(reg_date,'yyyy')='"+(new Date().getYear() + 1900)+"' or to_char(com_date,'yyyy')='"+(new Date().getYear()+ 1900)+"')"; try{ ResultSet rs=db.executeDRLOperation(query); while(rs.next()) { Associate as=new Associate(); as.setUserid(rs.getString(1)); as.setTopic(rs.getString(2)); as.setCourse(rs.getString(3)); as.setReg_date(rs.getDate(4)); as.setCompleted_date(rs.getDate(5)); as.setClass_mark(rs.getDouble(6)); as.setWbt_mark(rs.getDouble(7)); as.setStatus(rs.getString(8)); alist.add(as); } }catch(Exception e) { System.out.println("Exception in viewTopicReport:"+e); } }

return alist;

        }

} ///////////////////////////////////////////////////////////////////////////////