예제 #1
0
 public int create(User user) {
   try {
     Statement stat = conn.createStatement();
     ResultSet rs = stat.executeQuery("Select ID FROM USERS ");
     int i = user.getId();
     String n = user.getName();
     String pass = user.getPassword();
     Date d = user.getDate();
     System.out.println("i= " + i);
     stat.execute(
         "INSERT INTO USERS VALUES("
             + i
             + ",'"
             + n
             + "', '"
             + pass
             + "', TO_DATE('"
             + d
             + "','YYYY-MM-DD'))");
   } catch (SQLException e) {
     e.printStackTrace();
     System.out.println("Alarm in addUser");
   }
   return 1;
 }
예제 #2
0
  public void add(final User user) throws ClassNotFoundException, SQLException {

    final String query = "insert into userinfo (id, name, password) values (?,?,?)";
    final String[] params = new String[] {user.getId(), user.getName(), user.getPassword()};

    getJdbcTemplate().update(query, params);
  }
예제 #3
0
  /* get/create device list entry */
  public static GroupList getGroupList(User user, String groupID, boolean createOK)
      throws DBException {
    // does not return null, if 'createOK' is true

    /* User specified? */
    if (user == null) {
      throw new DBException("User not specified.");
    }
    String accountID = user.getAccountID();
    String userID = user.getUserID();

    /* group exists? */
    if (StringTools.isBlank(groupID)) {
      throw new DBException("DeviceGroup ID not specified.");
    } else if (!DeviceGroup.exists(accountID, groupID)) {
      throw new DBException("DeviceGroup does not exist: " + accountID + "/" + groupID);
    }

    /* create/save record */
    GroupList.Key grpListKey = new GroupList.Key(accountID, userID, groupID);
    if (grpListKey.exists()) { // may throw DBException
      // already exists
      GroupList listItem = grpListKey.getDBRecord(true);
      listItem.setUser(user);
      return listItem;
    } else if (createOK) {
      GroupList listItem = grpListKey.getDBRecord();
      listItem.setCreationDefaultValues();
      listItem.setUser(user);
      return listItem;
    } else {
      // record doesn't exist, and caller doesn't want us to create it
      return null;
    }
  }
예제 #4
0
 public User getUser() {
   if (user == null && !user_id.equals("")) {
     User sp = new User(debug, user_id);
     String back = sp.doSelect();
     if (back.equals("")) {
       user = sp;
     }
   }
   return user;
 }
예제 #5
0
 public void testStoring() throws Throwable {
   System.out.println("Storing...???");
   User lazar = new User();
   lazar.setUserId("LZ");
   lazar.setUserName("Lazar");
   dbSess.startTransaction();
   UserFactory.getInstance().store(dbSess, lazar);
   dbSess.commitTransaction();
   System.out.println("Done");
 }
예제 #6
0
  public User readByNamePass(String login, String pass) {
    List<User> list = findAll();

    for (User u : list) {
      if (u.getName().equals(login) && u.getPassword().equals(pass)) ;
      return u;
    }
    System.out.println("Неправильный логин или пароль");
    return null;
  }
  public void getTestCaseExecutionDetails() throws Exception {
    //                testCaseObj.setTestCaseId("001");
    TestCase testCaseObj = tmsManager.getTestCaseExecutionDetails("001");

    Activity activityObj = testCaseObj.getActivityObj();
    System.out.println(activityObj.getActivityId());
    System.out.println(testCaseObj.getTestCaseId());
    User userObj = testCaseObj.getUserObj();
    System.out.println(userObj.getUserId());
    System.out.println(testCaseObj.getActualDate());

    System.out.println(testCaseObj.getTestCaseStatus());
    System.out.println(testCaseObj.getComments());
    System.out.println(testCaseObj.getActualBehaviour());
  }
  public void getTestCase() throws Exception {

    TestCase testCaseObj = tmsManager.getTestCase("15");

    System.out.println(testCaseObj.getTestCaseId());
    System.out.println(testCaseObj.getTestCaseDescription());
    System.out.println(testCaseObj.getTestCasePhase());
    Project projectObj = testCaseObj.getProjectObj();
    System.out.println(projectObj.getProjectId());
    User userObj = testCaseObj.getUserObj();
    System.out.println(userObj.getUserId());
    Activity activityObj = testCaseObj.getActivityObj();
    System.out.println(activityObj.getActivityId());
    System.out.println(testCaseObj.getExpectedBehaviour());
  }
예제 #9
0
  private void drawBalance(Graphics g)
        //  POST: Draws the balance of the current player
      {

    Font font; // Font used to draw balance
    String message; // Message for balance
    Color oldColor; // Sets for color
    int x1; // Upper-left x coordinate
    int y1; // Upper-left y coordinate
    int x2; // Bottom-right x coordinate
    int y2; // Bottom-right y coordinate
    int width; // Width of the dialogue box
    int height; // Height of the dialogue box
    int offset; // Offset so the dialogue box is positioned
    int balance; // Offset so the dialogue box is positioned
    User player; // User value for the player

    player = usersArray[0];

    balance = player.getBalance();
    oldColor = g.getColor();

    x1 = ScaledPoint.scalerToX(0.72);
    y1 = ScaledPoint.scalerToY(0.81);
    x2 = ScaledPoint.scalerToX(0.88);
    y2 = ScaledPoint.scalerToY(0.86);
    width = x2 - x1;
    height = y2 - y1;
    message = "Balance:";
    font = Drawing.getFont(message, width, height, FONTNAME, FONTSTYLE);
    offset = (width - getFontMetrics(font).stringWidth(message)) / 2;
    g.setColor(Color.WHITE);
    g.drawString(message, x1 + offset, y2);

    x1 = ScaledPoint.scalerToX(0.72);
    y1 = ScaledPoint.scalerToY(0.865);
    x2 = ScaledPoint.scalerToX(0.88);
    y2 = ScaledPoint.scalerToY(0.915);

    width = x2 - x1;
    height = y2 - y1;
    message = "$" + Integer.toString(balance);
    font = Drawing.getFont(message, width, height, FONTNAME, FONTSTYLE);
    offset = (width - getFontMetrics(font).stringWidth(message)) / 2;
    g.drawString(message, x1 + offset, y2);

    g.setColor(oldColor);
  }
  public void getTestActivityEffort(String activityId) throws Exception {
    Effort effortObj = tmsManager.getTestActivityEffort(activityId);

    Activity activityObj = effortObj.getActivityObj();

    System.out.println(activityObj.getActivityId());
    User userObj = effortObj.getUserObj();

    System.out.println(userObj.getEmpNo());
    System.out.println(effortObj.getEffortDate());
    System.out.println(effortObj.getStartDate());
    System.out.println(effortObj.getEndDate());
    System.out.println(effortObj.getEffort());
    System.out.println(effortObj.getEffortDescription());
    System.out.println(effortObj.getEffortTimeStamp());
  }
예제 #11
0
 @Override
 public void deleteUser(User user) throws Exception {
   StringBuffer sqlStmt = new StringBuffer();
   sqlStmt.append("DELETE FROM ").append(usersTable);
   sqlStmt.append(" WHERE username='******'");
   doUpdate(sqlStmt.toString());
 }
예제 #12
0
  @Override
  public void updateUser(User user) throws Exception {
    StringBuffer sqlStmt = new StringBuffer().append("UPDATE ").append(usersTable).append(" SET");
    sqlStmt.append(" firstname='").append(user.getFirstname());
    sqlStmt.append("', lastname='").append(user.getLastname());
    sqlStmt.append("', email='").append(user.getEmail());
    sqlStmt.append("' WHERE username='******'");

    /*String sqlStmt = "UPDATE "+usersTable+" SET"
    + " firstname='" + user.getFirstname()
    + "', lastname='" + user.getLastname()
    + "', email='" + user.getEmail()
    + "' WHERE username='******'";*/
    doUpdate(sqlStmt.toString());
  }
  @Override
  public User getUserDetails(String uname) {
    Connection con = null;
    try {
      con = DBConnectionFactory.getConnection();
      Statement st = con.createStatement();
      String sql =
          "select fname, lname, email, mobile, usertype "
              + "from user_details "
              + "where uname='"
              + uname
              + "'";
      ResultSet rs = st.executeQuery(sql);
      if (rs.next()) {
        User u = new User();
        u.setUname(uname);
        u.setFname(rs.getString(1));
        u.setLname(rs.getString(2));
        u.setEmail(rs.getString(3));
        u.setMobile(rs.getString(4));
        u.setUsertype(rs.getString(5));

        return u;
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      try {
        con.close();
      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
    return null;
  }
예제 #14
0
  @Override
  public void addUser(User user) throws Exception {
    StringBuffer sqlStmt = new StringBuffer();
    sqlStmt.append("INSERT INTO ").append(usersTable);
    sqlStmt.append(" (username, firstname, lastname, email) VALUES ('");
    sqlStmt.append(user.getUsername()).append("','");
    sqlStmt.append(user.getFirstname()).append("','");
    sqlStmt.append(user.getLastname()).append("','");
    sqlStmt.append(user.getEmail());
    sqlStmt.append("')");

    /*String sqlStmt = "INSERT INTO "+usersTable+" (username, firstname, lastname, email) VALUES ('"
    + user.getUsername() + "','"
    + user.getFirstname() + "','"
    + user.getLastname() + "','"
    + user.getEmail()
    + "')";*/
    doUpdate(sqlStmt.toString());
  }
예제 #15
0
 /** checks database for this user */
 private boolean realAuthentication(HttpServletRequest request, ConnectionPool conPool)
     throws SQLException {
   // user authentication is required!
   User user = (User) request.getSession().getAttribute(StringInterface.USERATTR);
   if (user == null) {
     return false;
   }
   Connection con = conPool.getConnection();
   boolean authenticated = false;
   try {
     authenticated = userUtils.confirmUserWithEncrypted(user.getID(), user.getEncrypted(), con);
   } catch (Exception e) {
     throw new SQLException(e.getMessage());
   } finally {
     conPool.free(con);
     con = null;
   }
   return authenticated;
 } // end realAuthentication
예제 #16
0
  @Override
  public int add(User t) {
    String sql = "INSERT INTO EmployeeLoginDetails VALUES (?,?,?)";
    int rowAdded = 0;

    try {
      PreparedStatement pstmt = con.prepareStatement(sql);
      pstmt.setInt(1, t.getEmpId());
      pstmt.setString(2, t.getPassword());
      pstmt.setString(3, t.getRole());

      rowAdded = pstmt.executeUpdate();

    } catch (SQLException e) {
      e.printStackTrace();
    }

    return rowAdded;
  }
예제 #17
0
  public int update(User u) {

    String sql = "UPDATE EmployeeLoginDetails SET password = ? , role = ? WHERE EmpId = ?";
    int rowUpdated = 0;
    try {
      PreparedStatement pstmt = con.prepareStatement(sql);

      pstmt.setString(1, u.getPassword());
      pstmt.setString(2, u.getRole());
      pstmt.setInt(2, u.getEmpId());

      rowUpdated = pstmt.executeUpdate();

    } catch (SQLException e) {
      e.printStackTrace();
    }

    return rowUpdated;
  }
  public void createTestCase() throws Exception {
    testCaseObj.setTestCaseId("15");
    testCaseObj.setTestCaseDescription("this s Next testcase Description");
    testCaseObj.setTestCasePhase("normal ");

    Project projectObj = new Project();
    projectObj.setProjectId("2");
    testCaseObj.setProjectObj(projectObj);

    User userObj = new User();
    userObj.setUserId("123");
    testCaseObj.setUserObj(userObj);

    Activity activityObj = new Activity();
    activityObj.setActivityId("001");
    testCaseObj.setActivityObj(activityObj);

    testCaseObj.setExpectedBehaviour("Bad");
    System.out.println(tmsManager.createTestCase(testCaseObj));
  }
예제 #19
0
  public void buyItemFromUser(User buyer, User seller, Item currentItem)
        // PRE:  buyer, seller, currentItem must be initialized
        // POST: Purchases item from the store and has stores it into inventory.
      {

    int buyer_balance; // The new balance of the buyer
    int seller_balance; // The new balance of the seller
    String str; // First query
    String str2; // Second query
    String str3; // Third query

    buyer_balance = buyer.getBalance() - currentItem.getPrice();
    seller_balance = seller.getBalance() + currentItem.getPrice();

    if (buyer_balance > 0) // If the buyer wont go negative
    {
      str =
          String.format(
              "Update users set balance = (%d) where user_name = '%s'",
              buyer_balance, buyer.getUserName());

      str2 =
          String.format(
              "Update users set balance = (%d) where user_name = '%s'",
              seller_balance, seller.getUserName());

      str3 =
          String.format(
              "Update items set owner_id = (%d) where item_name = '%s'",
              buyer.getUserId(), currentItem.getItemName());

      updateTables(str, str2, str3);

    } else {
      // Prompt the user with an error
      JOptionPane.showMessageDialog(
          null, "You will go bankrupt if you try buying that, try selling some items.");
    }
  }
예제 #20
0
파일: jdbc.java 프로젝트: eric62451/aaaaa
 public User getUser(String user) throws SQLException {
   start();
   rs = stmt.executeQuery("SELECT * FROM userInfo WHERE username = '******'");
   User rtrn = null;
   if (rs.next()) {
     rtrn = new User();
     rtrn.setUserName(rs.getString(1));
     rtrn.setPassWord(rs.getString(2));
     rtrn.setFirstName(rs.getString(3));
     rtrn.setLastName(rs.getString(4));
     rtrn.setEmail(rs.getString(5));
     long number = 0;
     String num = rs.getString(6);
     if (num != null)
       number = Long.parseLong(num.replace("-", "").replace("(", "").replace(")", ""));
     rtrn.setPhoneNumber(number);
     rtrn.setCity(rs.getString(7));
     rtrn.setState(rs.getString(8));
     rtrn.setRating(rs.getInt(9));
   }
   close();
   return rtrn;
 }
 public void updateActivityAssignment() throws Exception {
   activityObj.setActivityId("1001");
   activityUserObj.setActivityObj(activityObj);
   userObj.setEmpNo("002");
   activityUserObj.setUserObj(userObj);
   activityUserObj.setActivityEffort(0);
   Date startDate = new Date(2010, 05, 07);
   activityUserObj.setStartDate(startDate);
   Date endDate = new Date(2010, 05, 10);
   activityUserObj.setEndDate(endDate);
   activityUserObj.setStatus(0);
   activityUserObj.setPercentageCompleted(0);
   activityUserObj.setTimeStamp("null");
   System.out.println(tmsManager.updateTestActivityAssignment(activityUserObj));
 }
예제 #22
0
 public static DBFactory<GroupList> getFactory() {
   if (factory == null) {
     factory =
         DBFactory.createDBFactory(
             GroupList.TABLE_NAME(),
             GroupList.FieldInfo,
             DBFactory.KeyType.PRIMARY,
             GroupList.class,
             GroupList.Key.class,
             true /*editable*/,
             true /*viewable*/);
     factory.addParentTable(Account.TABLE_NAME());
     factory.addParentTable(User.TABLE_NAME());
     factory.addParentTable(DeviceGroup.TABLE_NAME());
   }
   return factory;
 }
  public void addTestCaseExecutionDetails() throws Exception {

    activityObj.setActivityId("001");
    testCaseObj.setActivityObj(activityObj);

    testCaseObj.setTestCaseId("001");

    userObj.setUserId("12");
    testCaseObj.setUserObj(userObj);

    testCaseObj.setActualDate(new Date(1970, 01, 01));
    testCaseObj.setTestCaseStatus("complete");
    testCaseObj.setComments("better");
    testCaseObj.setActualBehaviour("got value");

    System.out.println(tmsManager.addTestCaseExecutionDetails(testCaseObj));
  }
  /*---------------------------------------------------VieTestPhase----------------------------*/
  public void getTestActivity() throws Exception {
    activityObj.setActivityId("1001");

    Activity activityObj1 = tmsManager.getTestActivity(activityObj.getActivityId());
    System.out.println("activity_id:  " + activityObj1.getActivityId());

    TestPhase testphaseObj1 = activityObj1.getTestPhaseObj();
    System.out.println("phase_id:  " + testphaseObj1.getPhaseId());
    System.out.println("activity_name: " + activityObj1.getActivityName());
    System.out.println("activity_description: " + activityObj1.getActivityDescription());
    System.out.println("activity_type: " + activityObj1.getActivityType());
    System.out.println("start_date: " + activityObj1.getStartDate());
    System.out.println("end_date: " + activityObj1.getEndDate());
    System.out.println("activity_effort: " + activityObj1.getActivityEffort());
    System.out.println("status: " + activityObj1.getStatus());
    userObj = activityObj.getUserObj();
    System.out.println("emp_no: " + userObj.getEmpNo());
    System.out.println("time_stamp: " + activityObj1.getTimeStamp());
  }
 /*-------------------------------------UpdateTestActivity-----------------------------------------*/
 public void updateTestActivity() throws Exception {
   activityObj.setActivityId("1001");
   testPhaseObj.setPhaseId("101");
   activityObj.setTestPhaseObj(testPhaseObj);
   activityObj.setActivityName("first activity test");
   activityObj.setActivityDescription("I am the latest activity to execute ");
   activityObj.setActivityType(1);
   Date startDate = new Date(2010, 05, 07);
   activityObj.setStartDate(startDate);
   Date endDate = new Date(2010, 06, 11);
   activityObj.setEndDate(endDate);
   activityObj.setActivityEffort(30);
   activityObj.setStatus(1);
   userObj.setEmpNo("002");
   activityObj.setUserObj(userObj);
   java.sql.Date date1 = java.sql.Date.valueOf("2011-03-28");
   activityObj.setTimeStamp(date1);
   System.out.println(tmsManager.updateTestActivity(activityObj));
 }
 /*-----------------------------------------ViewAssignment------------------------------------------*/
 public void getActivityAssignment() throws Exception {
   activityObj.setActivityId("1001");
   activityUserObj.setActivityObj(activityObj);
   activityObj = activityUserObj.getActivityObj();
   ActivityUser activityUserObj1 =
       tmsManager.getTestActivityAssignment(activityObj.getActivityId());
   activityObj = activityUserObj1.getActivityObj();
   System.out.println(activityObj.getActivityId());
   activityObj = activityUserObj1.getActivityObj();
   System.out.println("activity_id : " + activityObj.getActivityId());
   userObj = activityUserObj1.getUserObj();
   System.out.println("emp_no : " + userObj.getEmpNo());
   System.out.println("activity_effort : " + activityUserObj1.getActivityEffort());
   System.out.println("start_date : " + activityUserObj1.getStartDate());
   System.out.println("end_date : " + activityUserObj1.getEndDate());
   System.out.println("status : " + activityUserObj1.getStatus());
   System.out.println("percentage_completed : " + activityUserObj1.getPercentageCompleted());
   System.out.println("time_stamp : " + activityUserObj1.getTimeStamp());
 }
  public void addTestActivityEffort() throws Exception {

    activityObj.setActivityId("001");
    effortObj.setActivityObj(activityObj);
    userObj.setEmpNo("1");
    effortObj.setUserObj(userObj);

    effortObj.setEffortDate(new Date(2010, 10, 01));

    effortObj.setStartDate(new Date(2010, 10, 02));

    effortObj.setEndDate(new Date(2010, 11, 01));

    effortObj.setEffort(4);

    effortObj.setEffortDescription("I dont Know");

    effortObj.setEffortTimeStamp("2010-11-17");

    System.out.println(tmsManager.addTestActivityEffort(effortObj));
  }
예제 #28
0
  /** Persist Saves the post to the database, this function will create a new database connection */
  public void Persist() {

    PreparedStatement pstmt = null;
    Connection conn = null;
    try {
      conn = DB.getConnection();
      String sql = "UPDATE " + User.dquote(Post.POST);
      sql += " set " + Post.CONTENT + " = ?, ";
      sql += Post.TYPE + " = ?, ";
      sql += Post.TIMESTAMP + " = ?, ";
      sql += Post.USER_ID + " = ?, ";
      sql += Post.WALL_ID + " = ?, ";
      sql += "where " + Post.POST_ID + " = ?";

      Logger.debug("Generated update: [%s]", sql);
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, this.content);
      pstmt.setString(2, this.type);
      pstmt.setTimestamp(3, this.time_stamp);
      pstmt.setLong(4, this.user_ID);
      pstmt.setLong(5, this.wall_ID);
      pstmt.setLong(6, this.post_ID);

      pstmt.executeUpdate();

      pstmt.close();
      conn.close();
    } catch (SQLException e) {
      // Attempt to close the connection
      Logger.debug("Error while persisting Post");
      if (conn != null) {
        try {
          conn.close();
        } catch (Exception x) {
          Logger.debug("Error while closing connection during exception", x);
        }
      }
    }
  }
예제 #29
0
 public void setUser(User val) {
   if (val != null) {
     user = val;
     user_id = user.getId();
   }
 }
예제 #30
0
  /*
   * Add a new record to the Organization table,
   * creates an admin account when SA creates a new consulting company
   * @param OrganizationCode (based on Company Name)
   * @param OrganizationName (based on Company Description)
   * @param FKCompanyID
   * @param NameSequence
   * @param PKUser
   * @param nomRater
   * @throws SQLException
   * @throws Exception
   * @author: Mark Oei
   * @since v.1.3.12.63 09 Mar 2010
   */
  public boolean addOrganisationByCons(
      String OrganizationCode,
      String OrganizationName,
      int FKCompanyID,
      int NameSequence,
      int PKUser,
      String nomRater)
      throws SQLException, Exception {
    Connection con = null;
    Statement st = null;

    boolean bIsAdded = false;

    String sql =
        "INSERT INTO tblOrganization (OrganizationCode, OrganizationName, FKCompanyID, NameSequence, NominationModule)";
    sql =
        sql
            + " VALUES ('"
            + OrganizationCode
            + "', '"
            + OrganizationName
            + "', "
            + FKCompanyID
            + ", "
            + NameSequence
            + ", '"
            + Boolean.parseBoolean(nomRater)
            + "')";
    try {
      con = ConnectionBean.getConnection();
      st = con.createStatement();
      int iSuccess = st.executeUpdate(sql);
      System.out.println(iSuccess);
      if (iSuccess != 0) bIsAdded = true;
    } catch (Exception E) {
      System.err.println("Organization.java - AddRecord - " + E);
    } finally {
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }

    System.out.println("1. Add Organization");

    // add default under the organization.
    String defaultName = "NA";
    int FKOrganization = checkOrgExist(OrganizationCode, OrganizationName, FKCompanyID);
    // Change to disable print statement. Used for debugging only
    // Mark Oei 19 Mar 2010
    // System.out.println("testing " + FKOrganization);
    System.out.println("2. Check Organization Exist");
    if (FKOrganization != 0) {
      // Add Division
      div.addRecord(defaultName, FKOrganization, PKUser);
      System.out.println("3. Add Division");
      // Add Department
      dept.addRecord(defaultName, FKOrganization, PKUser);
      System.out.println("4. Add Department");
      // Add Group
      G.addRecord(defaultName, FKOrganization, PKUser);
      System.out.println("5. Add Group");
      // Check whether exists
      int FKDivision = div.checkDivExist(defaultName, FKOrganization);
      int FKDepartment = dept.checkDeptExist(defaultName, FKOrganization);
      int FKGroup = G.checkGroupExist(defaultName, FKOrganization);
      // Create links
      dept.linkDepartment(FKDivision, FKDepartment);
      G.linkGroup(FKDepartment, FKGroup);
      // Establish new admin account and password
      Date timeStamp = new java.util.Date();
      SimpleDateFormat dFormat = new SimpleDateFormat("ddMMyyHHmmss");
      String temp = dFormat.format(timeStamp);
      String loginName = OrganizationCode + "admin";
      String password = OrganizationCode + temp;
      int userType = 6;
      // Insert record into database
      U.addRecord(
          FKDepartment,
          FKDivision,
          userType,
          "Admin",
          "Admin",
          loginName,
          "NA",
          "NA",
          FKGroup,
          password,
          1,
          FKCompanyID,
          FKOrganization,
          "NA",
          PKUser);

      System.out.println("6. Add User");
      int userExist =
          U.checkUserExist(
              FKDepartment,
              FKDivision,
              userType,
              "Admin",
              "Admin",
              loginName,
              "NA",
              "NA",
              FKGroup,
              password,
              1,
              FKCompanyID,
              FKOrganization);

      System.out.println(
          "FKDivision = "
              + FKDivision
              + ", FKDepartment = "
              + FKDepartment
              + ", FKGroup = "
              + FKGroup
              + " and User Exist = "
              + userExist);

      if (userExist != 0) {
        try {
          U.insertRelation(userExist, userExist, 0);
        } catch (SQLException SE) {
          System.out.println(SE.getMessage());
        }
        // Send email notification
        String content = template.ForgotPass_temp(loginName, password);
        String email = "*****@*****.**";
        // Edited By Roger 13 June 2008
        Email.sendMail(
            server.getAdminEmail(),
            email,
            "New Admin Assignment for " + OrganizationName,
            content,
            FKOrganization);
      }

      System.out.println("8. Add User Relation");
    }

    sDetail = detail.getUserDetail(PKUser);
    ev.addRecord("Insert", itemName, OrganizationName, sDetail[2], sDetail[11], sDetail[10]);

    return bIsAdded;
  } // End Method for addOrganisationByCons