/**
   * Description of the Method
   *
   * @param ctx Description of the Parameter
   * @param conn Description of the Parameter
   * @param instance Description of the Parameter
   * @param msgs Description of the Parameter
   * @param manager Description of the Parameter
   * @return Description of the Return Value
   */
  public int beforeInsert(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager) {
    instance.setValue("OLDADM", ctx.getParameter("ADMINEDBY"));
    instance.setValue("CREATEDATE", SystemDate.getSystemDate5(""));
    instance.setFieldReadonly("OLDADM", true);
    instance.setFieldReadonly("CREATEDATE", true);
    instance.setValue("BMNO", this.bmno);
    instance.setFieldReadonly("BMNO", true);
    instance.setValue("OPERATOR", SessionInfo.getLoginUserName(ctx));
    instance.setValue("OLDADM", InactLoanMan.getInactLoan(this.bmno).adminedBy);

    return 0;
  }
Exemple #2
0
  public int load(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager,
      String parameter) {

    int userNo = SessionInfo.getLoginUserNo(ctx);
    String roleStr = "select * from scuserrole where userno=" + userNo + " and roleno=1";
    RecordSet roleRs = conn.executeQuery(roleStr);
    if (roleRs.next()) {
      instance.useCloneFormBean();
      instance.getFormBean().setUseDelete(true);
    }

    // flag
    flag = (String) ctx.getRequestAttribute("flag");
    if (flag == null) {
      flag = "read";
    }
    flag = flag.toLowerCase();
    if (flag.equals("write")) {
      instance.setReadonly(false);
    } else {
      instance.setReadonly(true);
    }
    // CLIENTNO
    String CLIENTNO = ctx.getParameter("CLIENTNO");
    if (CLIENTNO == null) {
      CLIENTNO = (String) ctx.getRequestAttribute("CLIENTNO");
    }
    initClientNo = (String) ctx.getRequestAttribute("INITCLIENTNO");
    guarantorID = (String) ctx.getRequestAttribute("GID");
    String sql = "select * from cmindvclient where ";
    if (CLIENTNO != null && CLIENTNO.length() > 0) {
      strClientNo = CLIENTNO;
      sql += "clientno='" + CLIENTNO + "'";
    } else if (guarantorID != null && guarantorID.trim().length() > 0) {
      sql += "id='" + guarantorID + "'";
    }
    if (sql.endsWith("where ")) {
      return 0;
    }

    RecordSet rs = conn.executeQuery(sql);
    if (rs.next()) {
      // lj del in 20090316
      //      UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
      //      String BRHID = SCUser.getBrhId(um.getUserName()); //登录用户所在网点
      //      String APPBRHID = rs.getString("APPBRHID").trim(); //客户资料的登记网点
      //      if ( strClientNo!=null && ! (SCBranch.checkSub(APPBRHID, BRHID) ||
      // APPBRHID.equals(BRHID))) {
      //        flag = "read";
      //        msgs.add("该客户不在本网点维护范围内!");
      //        instance.setReadonly(true);
      //      }
      //      else
      if (guarantorID != null && guarantorID.trim().length() > 0) {
        flag = "read";
        msgs.add("客户信息已经存在,不需要再做转移,请删除原来的保证人信息即可!");
        instance.setReadonly(true);
        strClientNo = rs.getString("clientno");
      }
      // trigger
      instance.setValue("CLIENTNO", strClientNo);
      trigger(manager, instance, EventType.EDIT_VIEW_EVENT_TYPE, Event.BRANCH_CONTINUE_TYPE);
    }
    return 0;
  }