/** * 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; }
public int preEdit( SessionContext ctx, DatabaseConnection conn, FormInstance instance, ErrorMessages msgs, EventManager manager, SqlAssistor assistor) { String CLIENTNO = ctx.getParameter("CLIENTNO").trim(); String ID = ctx.getParameter("ID").trim(); String CLIENTMGR = ctx.getParameter("CLIENTMGR").trim(); // String UNIONNO = ctx.getParameter("UNIONNO").trim(); // String RGNCODE = ctx.getParameter("RGNCODE").trim(); String MNTBRHID = ctx.getParameter("MNTBRHID").trim(); String APPBRHID = ctx.getParameter("APPBRHID").trim(); String LASTMODIFIED = SystemDate.getSystemDate2(); UserManager um = (UserManager) ctx.getAttribute(SystemAttributeNames.USER_INFO_NAME); String BrhId = SCUser.getBrhId(um.getUserName()); String OPERATOR = null; try { OPERATOR = um.getUserName(); } catch (Exception ex) { return -1; } // ID唯一检测 String ID2 = ""; if (ID.length() == 18) { ID2 = ID.substring(0, 6) + ID.substring(8, 17); } else if (ID.length() == 15) { ID2 = ID.substring(0, 6) + "19" + ID.substring(6, 15); } else { msgs.add("个人证件号码长度不正确,请仔细检查您输入的号码!"); return -1; } String tmp = ""; if (ID.length() == 18) { tmp = ID2; ID2 = ID; ID = tmp; } String str1 = "select * from CMINDVCLIENT where ID='" + ID + "' and clientno<>'" + ctx.getParameter("CLIENTNO") + "'"; String str2 = "select * from CMINDVCLIENT where ID like '" + ID2 + "%' and clientno<>'" + ctx.getParameter("CLIENTNO") + "'"; RecordSet rs1 = conn.executeQuery(str1); RecordSet rs2 = conn.executeQuery(str2); if (rs1.next() || rs2.next()) { msgs.add("个人证件号码已经存在,请仔细检查您输入的号码!"); return -1; } // CLIENTMGR存在检测 if (DBUtil.getCellValue( conn, "SCUSER", "LOGINNAME", "LOGINNAME='" + CLIENTMGR + "' and USERTYPE<>'3'") == null) { msgs.add("客户经理不存在,请仔细检查后再提交!"); return -1; } // UNIONNO存在检测 // if (DBUtil.getCellValue(conn, "CMFAMILYUNION", "UNIONNO", "UNIONNO=" + UNIONNO) == null) { // msgs.add("联户联保小组代码不存在,请仔细检查后再提交!"); // return -1; // } // UNIONNO在开户网点内 // RGNCODE存在检测 // if (RGNCODE.length() > 0 && // DBUtil.getCellValue(conn, "CMREGION", "RGNCODE", "RGNCODE='" + RGNCODE + "'") == null) // { // msgs.add("行政机构代码不存在,请仔细检查后再提交!"); // return -1; // } // 网点检测 // if (! (SCBranch.checkSub(APPBRHID, MNTBRHID) || MNTBRHID.equals(APPBRHID))) { // msgs.add("登记网点不在维护网点范围内!"); // return -1; // } assistor.setSqlFieldValue(assistor.getDefaultTbl(), "MNTBRHID", BrhId); assistor.setSqlFieldValue(assistor.getDefaultTbl(), "LASTMODIFIED", LASTMODIFIED); assistor.setSqlFieldValue(assistor.getDefaultTbl(), "OPERATOR", OPERATOR); return 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; }