Ejemplo n.º 1
0
  public int postInsertOk(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager) {
    if (this.isG) {
      return conn.executeUpdate(
          "delete from cmguarantor where id='" + ctx.getParameter("ID") + "'");
    }

    if (this.initClientNo == null) {
      return 0;
    }

    MyDB.getInstance().addDBConn(conn);
    int ret = 0;
    try {
      UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
      String OPERATOR = null;
      OPERATOR = um.getUserName();

      String clientno = null;

      if (this.initClientNo != null) {
        if (currClientNo == null) {
          msgs.add("客户号码未发现,请重做交易!");
          return -1;
        } else {
          ret = ClientMigration.clientMrig(initClientNo, currClientNo, OPERATOR);
          if (ret >= 0) {
            /** I comment following line temporarily to speed up perfomance JGO on 20040905 */
            // ret = CMClientMan.updateClientCatAndType(currClientNo, OPERATOR);
            ret = 0;
          }
          if (ret < 0) {
            String msg = PropertyManager.getProperty("" + ret);
            if (msg == null) {
              msg = "" + ret;
            }
            ctx.setRequestAtrribute("title", "客户信息移行");
            ctx.setRequestAtrribute("msg", "处理失败:" + msg);
            ctx.setRequestAtrribute("flag", "0");
            ctx.setTarget("/showinfo.jsp");
          } else {
            ctx.setRequestAtrribute("title", "客户信息移行");
            ctx.setRequestAtrribute("msg", "处理成功完成!");
            ctx.setRequestAtrribute("flag", "1");
            ctx.setTarget("/showinfo.jsp");
          }
        }
      }
    } catch (Exception e) {
      if (Debug.isDebugMode) {
        e.printStackTrace();
      }
      ret = -1;
    } finally {
      MyDB.getInstance().releaseDBConn();
      return ret;
    }
  }
Ejemplo n.º 2
0
  /** 扩展基类的beforeInsert方法,点击“添加”按钮后响应的事件 */
  public int beforeInsert(
      SessionContext ctx,
      DatabaseConnection conn,
      FormInstance instance,
      ErrorMessages msgs,
      EventManager manager) {

    String GID = (String) ctx.getRequestAttribute("GID");
    String GIDTYPE = (String) ctx.getRequestAttribute("GIDTYPE");
    String GNAME = (String) ctx.getRequestAttribute("GNAME");
    String GCREDITCLASS = (String) ctx.getRequestAttribute("GCREDITCLASS");
    if (GID != null) {
      instance.setReadonly(false);
      instance.setValue("NAME", GNAME);
      instance.setValue("IDTYPE", GIDTYPE);
      instance.setValue("ID", GID);
      instance.setValue("CREDITCLASS", GCREDITCLASS);
      instance.setFieldReadonly("NAME", true);
      instance.setFieldReadonly("IDTYPE", true);
      instance.setFieldReadonly("ID", true);
      instance.setFieldReadonly("CREDITCLASS", true);
      this.isG = true;
    }

    UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME);
    String BrhId = SCUser.getBrhId(um.getUserName());
    String APPDATE = SystemDate.getSystemDate5("");
    String OPERATOR = null;
    try {
      OPERATOR = um.getUserName();
    } catch (Exception ex) {
      return -1;
    }
    if (BrhId != null) {
      instance.setValue("MNTBRHID", BrhId);
      if (!SCBranch.getBrhtype(BrhId).trim().equals("9")) {
        instance.setValue("APPBRHID", BrhId);
      }
      instance.setValue("OPERATOR", OPERATOR);
      instance.setValue("APPDATE", APPDATE);
      instance.setValue("INVESTDATE", APPDATE);
      instance.setValue("LASTMODIFIED", APPDATE);
    }

    if (this.initClientNo != null) {
      MyDB.getInstance().addDBConn(conn);
      InitClientData initdata = InitClientMan.getInitClient(initClientNo);
      MyDB.getInstance().releaseDBConn();

      if (initdata == null) {
        msgs.add("移行客户信息不存在,请检查数据!");
        return -1;
      } else {
        if (initdata.appBrhID != null) {
          instance.setValue("APPBRHID", initdata.appBrhID);
        }
        if (initdata.appDate != null) {
          instance.setValue("APPDATE", util.calToString(initdata.appDate, null));
        }
        if (initdata.clientType != null) {
          instance.setValue("CLIENTTYPE", initdata.clientType.intValue());
        }
        if (initdata.ecomDeptType != null) {
          instance.setValue("ECOMDEPTTYPE", initdata.ecomDeptType.intValue());
        }
        if (initdata.ecomType != null) {
          instance.setValue("ECOMTYPE", initdata.ecomType.intValue());
        }
        if (initdata.etpScopType != null) {
          instance.setValue("ETPSCOPTYPE", initdata.etpScopType.intValue());
        }
        if (initdata.gender != null) {
          instance.setValue("GENDER", initdata.gender.intValue());
        }
        if (initdata.ID != null) {
          instance.setValue("ID", initdata.ID);
        }
        if (initdata.IDType != null) {
          // instance.setValue("IDTYPE", initdata.IDType.intValue());
        }
        if (initdata.name != null) {
          instance.setValue("NAME", initdata.name);
        }
        if (initdata.sectorCat1 != null) {
          instance.setValue("SECTORCAT1", initdata.sectorCat1.intValue());
        }
      }
    }
    return 0;
  }