示例#1
0
  private String getresult(
      HttpServletRequest request,
      int field1,
      int field2,
      int field3,
      String date1,
      String date2,
      String compId,
      String uId) {
    AdvtMaster advtMaster = new AdvtMaster();

    int subCatCount = advtMaster.subCategoryCount(getDataSource(request, "advt"), compId);

    Vector<String> dataVec = new Vector<String>();
    dataVec.add(String.valueOf(field1));
    dataVec.add(String.valueOf(field2));
    dataVec.add(String.valueOf(field3));
    dataVec.add(date1);
    dataVec.add(date2);
    dataVec.add(compId);
    dataVec.add(String.valueOf(subCatCount));
    dataVec.add(uId);

    Vector resultVec = advtMaster.getMisReport(getDataSource(request, "advt"), dataVec);
    //// System.out.println("resultVec............in Action................"+resultVec);
    String strResult = getFinalResult(resultVec, field1, field2, field3);
    return strResult;
    // return null;
  }
示例#2
0
  /**
   * Method execute
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HttpSession session = request.getSession();
    String numCount = (String) session.getAttribute("numCount");
    int count = Integer.parseInt(numCount);
    int remander = count % 2;

    String uId = (String) session.getAttribute("uId");
    String compId = (String) session.getAttribute("compId");
    Vector allRights = (Vector) session.getAttribute("allRights");
    String adminFlag = allRights.elementAt(18).toString();

    String changePassword = allRights.elementAt(3).toString();
    String users = allRights.elementAt(10).toString();
    String userDeletion = allRights.elementAt(12).toString();
    String userModification = allRights.elementAt(13).toString();

    Vector<String> rigthVec = new Vector<String>();
    rigthVec.add(changePassword);
    rigthVec.add(users);
    rigthVec.add(userDeletion);
    rigthVec.add(userModification);

    Vector<String> infoVec = new Vector<String>();
    infoVec.add(uId);
    infoVec.add(adminFlag);

    String strShortBy =
        (request.getParameter("sby") != null) ? request.getParameter("sby") : "loginname";
    String strSOrder = "";
    String strLoginIdOrder = "asc";
    String strUnameOrder = "asc";

    if (request.getParameter("sby") != null) {
      if (request.getParameter("liorder") != null) {
        if (request.getParameter("liorder").trim().equalsIgnoreCase("asc")) {
          strSOrder = "desc";
          strLoginIdOrder = "desc";
        } else if (request.getParameter("liorder").trim().equalsIgnoreCase("desc")) {
          strSOrder = "asc";
          strLoginIdOrder = "asc";
        }
      }

      if (request.getParameter("unorder") != null) {
        if (request.getParameter("unorder").trim().equalsIgnoreCase("asc")) {
          strSOrder = "desc";
          strUnameOrder = "desc";
        } else if (request.getParameter("unorder").trim().equalsIgnoreCase("desc")) {
          strSOrder = "asc";
          strUnameOrder = "asc";
        }
      }
    }
    String strFShortBy = strShortBy + " " + strSOrder;
    int minVal =
        (request.getParameter("numMin") != null)
            ? Integer.parseInt(request.getParameter("numMin"))
            : 0;
    int maxVal = 20;
    AdvtMaster am = new AdvtMaster();

    Vector<String> paramVec1 = new Vector<String>();
    paramVec1.add(compId);

    int totalRow = am.getUserCount(getDataSource(request, "corpo"), paramVec1);
    ////////// System.out.println("totalRow...getUserCount...."+totalRow);
    // int totalRow=500;
    String strPageHtml = getPages(minVal, maxVal, totalRow, compId, numCount);
    ////////// System.out.println("strPageHtml......."+strPageHtml);

    Vector<String> paramVec = new Vector<String>();
    paramVec.add(String.valueOf(minVal));
    paramVec.add(String.valueOf(maxVal));
    paramVec.add(compId);
    paramVec.add(strFShortBy);

    ////////// System.out.println("paramVec......."+paramVec);
    Vector userVec = new Vector();
    userVec = am.getUserList(getDataSource(request, "corpo"), paramVec);
    //////// System.out.println("result userVec......."+userVec);

    String strUsers =
        getUserList(
            strLoginIdOrder,
            strUnameOrder,
            minVal,
            maxVal,
            totalRow,
            strPageHtml,
            userVec,
            infoVec,
            rigthVec,
            remander,
            uId);
    ////////// System.out.println("Users "+strUsers);
    /**
     * setContentType - text/html to write String on page. PrintWriter - This line use to get writer
     * to write on page. out.println - use to write string.
     */
    response.setContentType("text/html;charset=ISO-8859-1");
    PrintWriter out = response.getWriter();
    out.println(strUsers);
    out.flush();
    return null;
  }
  /**
   * Method execute
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    MentorReqResponseForm responseForm =
        (MentorReqResponseForm) form; // TODO Auto-generated method stub
    RootMaster rootMaster = new RootMaster();
    AdvtMaster advtMaster = new AdvtMaster();
    HttpSession session = request.getSession();
    String uId = (String) session.getAttribute("uId");

    String compId = (String) session.getAttribute("compId");
    Vector allRights = (Vector) session.getAttribute("allRights");
    String adminFlag = allRights.elementAt(18).toString();
    if (((String) session.getAttribute("flag1")).equalsIgnoreCase("1")) {

      Vector<String> dataVec = new Vector<String>();
      String responseTextt = responseForm.getResponsetext();
      ////
      // System.out.println("request.getParameter...respIdrespIdrespId>>>>>"+request.getParameter("respid"));
      String respId = request.getParameter("respid");
      String complaintId = request.getParameter("compId");
      String flagforcom =
          (request.getParameter("flagforcom") != null) ? request.getParameter("flagforcom") : "";
      String recpType =
          (request.getParameter("respType") != null) ? request.getParameter("respType") : "";
      String accept1 =
          (request.getParameter("accept") != null) ? request.getParameter("accept") : "";
      //// System.out.println("to accept...in respons  .....accept....."+accept1);
      String flag = (request.getParameter("flag") != null) ? request.getParameter("flag") : "";
      if (request.getParameter("flag") != null) {
        flag = request.getParameter("flag").trim();
      } else {
        flag = "0";
      }
      //////// System.out.println("to flag...in respons  .....flag.IN RESPaCTION	...."+flag);
      String uid = (String) session.getAttribute("uId");
      java.util.Date dt = new java.util.Date();
      SimpleDateFormat sform = new SimpleDateFormat("yyyy-MM-dd, HH:mm:ss");
      String completeRemDate = sform.format(dt);
      StringTokenizer sttotal = new StringTokenizer(completeRemDate, ",");
      String creationDate = sttotal.nextToken();
      String creationTime = sttotal.nextToken();

      dataVec.add(responseTextt);
      dataVec.add(creationDate);
      dataVec.add(complaintId);
      dataVec.add(uid);
      dataVec.add(creationTime);
      dataVec.add(respId);
      dataVec.add(flag);
      dataVec.add("0");
      dataVec.add("1");
      dataVec.add("0");
      if (flag.equalsIgnoreCase("1")) {
        dataVec.add("Accept");

      } else if (flag.equalsIgnoreCase("0")) {
        dataVec.add("Reject");

      } else {
        dataVec.add("");
      }
      dataVec.add(flagforcom);
      String result = rootMaster.insertMenResponse(getDataSource(request, "advt"), dataVec);

      if ((result.equalsIgnoreCase("success")) && (!respId.equalsIgnoreCase("0"))) {
        ActionErrors errors = new ActionErrors();
        errors.clear();
        errors.add("reply", new ActionError("errors.entp.replySuccess"));
        saveErrors(request, errors);
        result = "success";
      } else if (result.equalsIgnoreCase("success")) {
        ActionErrors errors = new ActionErrors();
        errors.clear();
        errors.add("response", new ActionError("errors.entp.responseSuccess"));
        saveErrors(request, errors);
        result = "success";
      }

      if (result.equalsIgnoreCase("success")) {
        if (!respId.equalsIgnoreCase("0")) {
          Vector<String> respVec = new Vector<String>();
          respVec.add(respId);
          respVec.add("advt");
          // update `entp_rflag` for communication table.
          result = rootMaster.updateResponseFlag(getDataSource(request, "advt"), respVec);
        }
      }

      ////////////// for mail///////////////
      if (result.equalsIgnoreCase("success")) {

        EntpMaster entpMaster = new EntpMaster();
        IndvMaster indvMaster = new IndvMaster();
        Vector<String> complaintVec = new Vector<String>();
        int cid = Integer.parseInt(complaintId);
        complaintVec = entpMaster.getComplaintDetails(getDataSource(request, "advt"), cid);
        String login_id = complaintVec.elementAt(3).toString();
        String cu_id = complaintVec.elementAt(6).toString();
        String fcomId = complaintVec.elementAt(7).toString();

        Vector<String> paramVec = new Vector<String>();

        //////// System.out.println("to Enterprise.............mail");
        paramVec.add(uid);
        paramVec.add(login_id);
        if (!cu_id.equalsIgnoreCase("0")) {
          paramVec.add(cu_id);
          //////// System.out.println(" to Enterprise..in if...........mail");
        }
        Vector emailVec = indvMaster.getEmailList(getDataSource(request, "advt"), paramVec);
        //////// System.out.println("emailVec..............."+emailVec);

        Vector<String> tempMailParam = new Vector<String>();
        tempMailParam.add("Corporates"); // sender company type Advertiser
        tempMailParam.add("Student"); // receipient company type Enterprise
        if (respId.equalsIgnoreCase("0")) {
          //////// System.out.println("Response if status in brand");
          tempMailParam.add("Response"); // mail description
        } else {
          //////// System.out.println("Reply else status in brand");
          tempMailParam.add("Reply"); // mail description
        }

        // get mail text alert fot sending mail to core user and admin core user
        String mailTextLAlert =
            rootMaster.getMailText(getDataSource(request, "advt"), tempMailParam);
        Vector brandVec = (Vector) emailVec.elementAt(0);
        String brandName =
            brandVec.elementAt(0).toString() + " " + brandVec.elementAt(1).toString();
        String brandmail = brandVec.elementAt(2).toString().trim();
        String subject = "";
        if (flag.equalsIgnoreCase("1")) {
          // dataVec.add("Accept");
          subject = "Acceptance of the mentoring request having reference id as (" + fcomId + ").";

        } else if (flag.equalsIgnoreCase("0")) {
          // dataVec.add("Reject");
          subject = "Denial of the mentoring request having reference id as (" + fcomId + ").";

        } else if (respId.equalsIgnoreCase("0")) {

          subject = "Response on mentoring request Id (" + fcomId + ") By " + brandName + ".";
        } else {

          subject =
              "Reply to your mail on mentoring request Id (" + fcomId + ") By " + brandName + ".";
        }

        for (int i = 1; i < emailVec.size(); i++) {
          MailText mt = new MailText();
          Resource resr = new Resource();
          Vector coreMailVec = (Vector) emailVec.elementAt(i);
          String strMailText =
              mt.getReplyByBrand(coreMailVec, fcomId, mailTextLAlert, brandName, flag);

          ////// System.out.println("strMailText....."+strMailText);

          String strEmailStatus =
              resr.sendMail(
                  strMailText,
                  Constant.Email_Sender,
                  ((Vector) emailVec.elementAt(i)).elementAt(2).toString(),
                  subject);
          ////// System.out.println("str Email status in corpo....."+strEmailStatus);
        }
      }
      ///////////////// end mail////////////

      session.setAttribute("numCid", complaintId);
      session.setAttribute("strResult", result);

      Vector dataVec1 = new Vector();
      dataVec1.add(uId);
      dataVec1.add(compId);
      dataVec1.add(adminFlag);
      Vector advtCountVec = advtMaster.complaintCountAdvt(getDataSource(request, "advt"), dataVec1);
      session.setAttribute("advtCountVec", advtCountVec);
      //////// System.out.println("advtCountVec.............ResponseAction...........
      // "+advtCountVec);
      if (result.equalsIgnoreCase("success")) {
        session.setAttribute("flag1", "0");
      }
      return mapping.findForward(result);
    } else {

      return mapping.findForward("success");
    }
  }
  /**
   * Method execute
   *
   * @param mapping
   * @param form
   * @param request
   * @param response
   * @return ActionForward
   */
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HttpSession session = request.getSession();
    //	System.out.println("checkpoint13");
    String numCount = (String) session.getAttribute("numCount");

    int count = Integer.parseInt(numCount);
    int remander = count % 2;
    System.out.println("checkpoint at corpo 2");
    AdvtMaster advtMaster = new AdvtMaster();
    RootMaster rootMaster = new RootMaster();
    IndvMaster indvMaster = new IndvMaster();

    String uId = (String) session.getAttribute("uId");
    String compId = (String) session.getAttribute("compId");

    System.out.println("compId..in Action avdt ........." + compId);
    //	int regFlag= rootMaster.getRegisteredFlag(getDataSource(request, "corpo"), compId);
    //	System.out.println("regFlag..in Action avdt ........."+regFlag);

    Vector allRights = (Vector) session.getAttribute("allRights");
    String adminFlag = allRights.elementAt(18).toString();

    //	 System.out.println("checkpoint at corpo 3");

    String pageid =
        (request.getParameter("pageid") != null) ? request.getParameter("pageid").trim() : "1";
    String aType =
        (request.getParameter("aType") != null) ? request.getParameter("aType").trim() : "0";
    String lowerSubTag =
        (request.getParameter("lowerSubTag") != null)
            ? request.getParameter("lowerSubTag").trim()
            : "1";
    String categoryid =
        (request.getParameter("categoryid") != null)
            ? request.getParameter("categoryid").trim()
            : "0";

    //	System.out.println("lowerSubTag..in Action avdt ........."+lowerSubTag);
    java.util.Date dt = new java.util.Date();
    SimpleDateFormat sform = new SimpleDateFormat("yyyy-MM-dd");
    String completeRemDate = sform.format(dt);
    StringTokenizer sttotal = new StringTokenizer(completeRemDate, ",");
    String creationDate = sttotal.nextToken();
    String dateToday[] = creationDate.split("-");
    String YR = dateToday[0];
    String DaY = dateToday[2];
    String MTH = dateToday[1];

    String month = (request.getParameter("Month") != null) ? request.getParameter("Month") : MTH;
    String nYear = (request.getParameter("Year") != null) ? request.getParameter("Year") : YR;

    System.out.println("month and yesar" + month + " " + nYear);
    String strShortBy =
        (request.getParameter("sby") != null) ? request.getParameter("sby") : "creation_date";
    String strSOrder = "";
    String strComFIdOrder = "asc";
    String strCTitelOrder = "asc";
    String strDateOrder = "asc";

    if (request.getParameter("sby") != null) {
      if (request.getParameter("fidorder") != null) {
        if (request.getParameter("fidorder").trim().equalsIgnoreCase("asc")) {
          strSOrder = "desc";
          strComFIdOrder = "desc";
        } else if (request.getParameter("fidorder").trim().equalsIgnoreCase("desc")) {
          strSOrder = "asc";
          strComFIdOrder = "asc";
        }
      }

      if (request.getParameter("ctorder") != null) {
        if (request.getParameter("ctorder").trim().equalsIgnoreCase("asc")) {
          strSOrder = "desc";
          strCTitelOrder = "desc";
        } else if (request.getParameter("ctorder").trim().equalsIgnoreCase("desc")) {
          strSOrder = "asc";
          strCTitelOrder = "asc";
        }
      }
      if (request.getParameter("dateorder") != null) {
        if (request.getParameter("dateorder").trim().equalsIgnoreCase("asc")) {
          strSOrder = "desc";
          strDateOrder = "desc";
        } else if (request.getParameter("dateorder").trim().equalsIgnoreCase("desc")) {
          strSOrder = "asc";
          strDateOrder = "asc";
        }
      }
    }
    String strFShortBy = strShortBy + " " + strSOrder;
    int minVal =
        (request.getParameter("numMin") != null)
            ? Integer.parseInt(request.getParameter("numMin"))
            : 0;
    int maxVal = 10;
    //// System.out.println("countVec.............InboxAction......minVal..... "+minVal);
    //// System.out.println("countVec.............InboxAction......maxVal..... "+maxVal);

    Vector<String> paramVec1 = new Vector<String>();
    paramVec1.add(uId);
    paramVec1.add(compId);
    paramVec1.add(adminFlag);
    paramVec1.add(pageid);

    Vector<String> paramVec = new Vector<String>();
    paramVec.add(String.valueOf(minVal));
    paramVec.add(String.valueOf(maxVal));
    paramVec.add(strFShortBy);
    paramVec.add(uId);
    paramVec.add(compId);
    paramVec.add(adminFlag);
    paramVec.add(pageid);

    int Cid = Integer.parseInt(compId);
    int Uid = Integer.parseInt(uId);
    int aFid = Integer.parseInt(adminFlag);

    Vector comVec = new Vector();
    Vector comListVec = new Vector();
    String comList = "";

    paramVec1.add("0");
    paramVec.add("0");

    ////// System.out.println("comList................on page."+comList);
    int totalRow = 0;
    paramVec1.add(lowerSubTag);
    paramVec1.add(categoryid);
    paramVec1.add(month);
    paramVec1.add(nYear);

    paramVec.add(lowerSubTag);
    paramVec.add(categoryid);
    paramVec.add(month);
    paramVec.add(nYear);
    totalRow = advtMaster.getComplaintCountL(getDataSource(request, "corpo"), paramVec1);
    Vector UserVec = advtMaster.getBrandComplaintList1L(getDataSource(request, "corpo"), paramVec);

    String country = "", state = "", city = "", brand = "", category = "", firstName = "";

    String countryName = "", stateName = "", cityName = "", brandName = "", categoryName = "";
    String searchFor = "";
    DataSource dataSource = getDataSource(request, "corpo");

    Vector userVec = (Vector) session.getAttribute("userVec");
    Vector cscVec = (Vector) session.getAttribute("cscVec");
    cscVec = userVec;
    Vector userTempVec = new Vector();
    if (session.getAttribute("userVec") != null) {
      userTempVec = (Vector) session.getAttribute("userVec");
      for (int i = 0; i < userTempVec.size(); i++) {
        if (userTempVec.elementAt(i).toString().equals("city =")) {
          city = userTempVec.elementAt(i + 1).toString().trim();
          cityName = rootMaster.getPlaceName(dataSource, Integer.parseInt(city));
          break;
        }
      }
    }
    Vector searchVec = new Vector();

    /*
     *  searchFor (0) Student.
     */

    if (searchFor.equalsIgnoreCase("0")) {
      if (session.getAttribute("searchVec") != null) {
        searchVec = (Vector) session.getAttribute("searchVec");
        for (int i = 0; i < searchVec.size(); i++) {
          paramVec.add(searchVec.elementAt(i).toString());
          if (searchVec.elementAt(i).toString().equals("course =")) {
            category = searchVec.elementAt(i + 1).toString().trim();
            Vector categoryNameVec =
                indvMaster.getCourseName(dataSource, Integer.parseInt(category.trim()));
            categoryName = categoryNameVec.elementAt(0).toString();
          }
          if (searchVec.elementAt(i).toString().equals("first_name like")) {
            firstName = searchVec.elementAt(i + 1).toString().trim();

            String teamCat1[] = firstName.split("%");
            ////////// System.out.println("teamCat[]>>>>>>>searchVec>>>>>>>"+teamCat1[1]);
            firstName = teamCat1[1];
          }
          if (searchVec.elementAt(i).toString().equals("college_id =")) {
            brand = searchVec.elementAt(i + 1).toString().trim();

            String StrArr[] = brand.split("~");
            int compnyid = Integer.parseInt(StrArr[0]);

            if (compnyid == 0) {
              compnyid = Integer.parseInt(userVec.elementAt(27).toString());
              Vector name = indvMaster.getOtherCollege(dataSource, compnyid);
              brandName = name.elementAt(0).toString().trim();
            } else if (StrArr[1].equalsIgnoreCase("1")) {
              brandName = rootMaster.getCompnyName(dataSource, compnyid);
            } else {
              brandName = rootMaster.getCollegeName(dataSource, compnyid);
            }
            // brandName

          }
        }
      }
      if (session.getAttribute("userVec") != null) {
        for (int i = 0; i < userVec.size(); i++) {
          paramVec.add(userVec.elementAt(i).toString());
        }
      }
    }

    String strPageHtml = getPages(minVal, maxVal, totalRow, lowerSubTag, pageid, numCount);

    int regFlag = 0;
    int numcount = UserVec.size();
    String strComplaintList =
        getComplaintList(
            searchFor,
            dataSource,
            numcount,
            strComFIdOrder,
            strCTitelOrder,
            strDateOrder,
            minVal,
            maxVal,
            totalRow,
            strPageHtml,
            UserVec,
            pageid,
            lowerSubTag,
            regFlag,
            city,
            brand,
            categoryName,
            cityName,
            brandName,
            remander,
            firstName,
            month,
            nYear);
    // System.out.println("Users "+strComplaintList);
    /**
     * setContentType - text/html to write String on page. PrintWriter - This line use to get writer
     * to write on page. out.println - use to write string.
     */
    response.setContentType("text/html;charset=ISO-8859-1");
    PrintWriter out = response.getWriter();
    out.println(strComplaintList);
    out.flush();

    // TODO Auto-generated method stub
    return null;
  }