⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gbs_cusprofileaction.java

📁 对日软件外包 为东芝做的一个全球商业管理系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		}

		GBS_Customer_stBean stBean = new GBS_Customer_stBean();

		stBean.setCustomerID(requestForm.getCustomerID());
		if(!requestForm.getDisplayOrder().trim().equals("")){
			stBean.setDispOrder(requestForm.getDisplayOrder());
		}else{
			stBean.setDispOrder("0");
		}
		stBean.setCustomerCategory(requestForm.getCategory());
		stBean.setCustomerCode(requestForm.getCode());
		stBean.setCustomerName(requestForm.getName());
		stBean.setCustomerAbbr(requestForm.getAbbreviation());
		stBean.setIndustry(requestForm.getIndustry());
		stBean.setAddr1(requestForm.getCityState());
		stBean.setAddr2(requestForm.getStreet());
		stBean.setZipCode(requestForm.getZipCode());
		stBean.setCountryCode(requestForm.getCountry());
		stBean.setTelephone(requestForm.getTel());
		stBean.setFax(requestForm.getFax());
		stBean.setEmail(requestForm.getEmail());
		stBean.setContactPerson(requestForm.getContactPerson());
		stBean.setUrl(requestForm.getUrl());
		// wxf modified at 2004.08.20 Start
		//stBean.setNumberOfEmployee(requestForm.getNumberOfEmployees());
		stBean.setNumberOfEmployee(remove(requestForm.getNumberOfEmployees(), ','));
		// wxf modified at 2004.08.20 End
		stBean.setUpdateUser(requestForm.getLoginUserId());

		returnValue = logic.updateCustomer(stBean);
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return (mapping.findForward(nextview));
		}
		this.setSuccessInfo(
			request,
			"00000006",
			"./GBS_cusprofile.do?method=init&customerID=" + requestForm.getCustomerID());
		return (mapping.findForward(success));
	}

	/** 
	* Method delete
	* @param ActionMapping mapping
	* @param ActionForm form
	* @param HttpServletRequest request
	* @param HttpServletResponse response
	* @return ActionForward
	* @throws Exception
	*/
	public ActionForward delete(
		ActionMapping mapping,
		ActionForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {
		GBS_CusProfileForm requestForm = (GBS_CusProfileForm) form;
		//write session to form
		this.setUserInfoFromSession(request, requestForm);

		requestForm = getCombo(requestForm, request);

		GBS_CusProfileActionLogic logic = new GBS_CusProfileActionLogic(this.getDataSource(request));

		//屭媞偺RFT忣曬傪専嶕偡傞
		ReturnValue returnValue = logic.getRfpInfo(requestForm.getCustomerID(), requestForm.getLoginPlusHour());
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return (mapping.findForward(nextview));
		} else {
			requestForm.setRfpList((ArrayList) returnValue.getDataValue());
		}

		//input check
		/* wxf deleted at 2004.08.20 
		MessageList errorMsg = inputCheck(requestForm, request);
		if (errorMsg.size() > 0) {
			//save error to request
			this.setMessage(errorMsg);
			return (mapping.findForward(nextview));
		}
		*/
		GBS_Customer_stBean stBean = new GBS_Customer_stBean();

		stBean.setCustomerID(requestForm.getCustomerID());

		stBean.setUpdateUser(requestForm.getLoginUserId());

		returnValue = logic.deleteCustomer(stBean);
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			return (mapping.findForward(nextview));
		}
		this.setSuccessInfo(request, "00000006", "./GBS_customerinquiry.do?method=init");
		return (mapping.findForward(success));
	}

	/**
	 * get combox value
	 * @param form GBS_CusProfileForm
	 * @param request HttpServletRequest
	 * @return GBS_CusProfileForm
	 * @throws Exception
	 */
	private GBS_CusProfileForm getCombo(GBS_CusProfileForm form, HttpServletRequest request) throws Exception {

		GBS_CusProfileActionLogic logic = new GBS_CusProfileActionLogic(this.getDataSource(request));

		ReturnValue returnValue = logic.getCountryList();
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
		} else {
			HashMap map = (HashMap) returnValue.getDataValue();
			form.setCountryLabelList((ArrayList) map.get(COUNTRY_NAME));
			form.setCountryValueList((ArrayList) map.get(COUNTRY_CODE));
		}

		returnValue = logic.getIndustryList();
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
		} else {
			ArrayList industryList = (ArrayList) returnValue.getDataValue();
			ArrayList industryValueList = new ArrayList();
			ArrayList industryLabelList = new ArrayList();
			industryValueList.add("");
			industryLabelList.add("");
			for (int i = 0; industryList != null && i < industryList.size(); i++) {
				GBS_CodeName_stBean codeName_st = (GBS_CodeName_stBean) industryList.get(i);
				industryLabelList.add(codeName_st.getName());
				industryValueList.add(codeName_st.getCode());
			}
			form.setIndustryLabelList(industryLabelList);
			form.setIndustryValueList(industryValueList);
		}
		return form;
	}

	/**
	 * inputCheck
	 * @param thisForm GBS_LoginForm
	 * @param request HttpServletRequest
	 * @throws Exception
	 * @return ErrorMessages
	 */
	private MessageList inputCheck(GBS_CusProfileForm form, HttpServletRequest request) throws Exception {

		//create ErrorMessages to display error message
		MessageList messages = new MessageList();

		if (BaseCommonCheck.isEmpty(form.getCustomerID())) {
			messages.setMessage(
				"customerID",
				form.getCustomerID(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Customer ID" });
		}
		/*if (BaseCommonCheck.isEmpty(form.getDisplayOrder())) {
			messages.setMessage(
				"DisplayOrder",
				form.getDisplayOrder(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Display Order By" });
		} else if (!BaseCommonCheck.isDigit(form.getDisplayOrder())) {
			messages.setMessage("DisplayOrder", "", "90000008", Integer.MIN_VALUE);
		}*/
		if (!BaseCommonCheck.isDigit(form.getDisplayOrder())) {
			messages.setMessage("DisplayOrder", "", "90000008", Integer.MIN_VALUE);
		}
		if (BaseCommonCheck.isEmpty(form.getCode())) {
			messages.setMessage("code", "", "10000009", Integer.MIN_VALUE, new Object[] { "Customer Code" });
		}
		if (BaseCommonCheck.isEmpty(form.getCategory())) {
			messages.setMessage(
				"",
				form.getCategory(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Customer Category" });
		}
		if (BaseCommonCheck.isEmpty(form.getName())) {
			messages.setMessage(
				"name",
				form.getName(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Customer Name" });
		}
		if (BaseCommonCheck.isEmpty(form.getCountry()) || form.getCountry().equals("-1")) {
			messages.setMessage(
				"country",
				form.getCountry(),
				"10000009",
				Integer.MIN_VALUE,
				new Object[] { "Country" });
		}
		if (!BaseCommonCheck.isEmpty(form.getEmail()) && !BaseCommonCheck.isValidEmail(form.getEmail())) {
			messages.setMessage("email", form.getEmail(), "90000036", Integer.MIN_VALUE);
		}
		if (!BaseCommonCheck.isEmpty(form.getUrl()) && !BaseCommonCheck.isURL(form.getUrl())) {
			messages.setMessage("url", form.getUrl(), "90000038", Integer.MIN_VALUE);
		}
		if (!BaseCommonCheck.isDigit(remove(form.getNumberOfEmployees().trim(), ','))) {
			//Edit by Gxk 20040823 "90000026"->"90000008"
			messages.setMessage("numberOfEmployees", form.getNumberOfEmployees(), "90000008", Integer.MIN_VALUE);
		}
		return messages;
	}
	/**
	 * remove all re in the in.
	 * @param String in
	 * @param char re
	 * @return String
	 */
	private String remove(String in, char re) {
		String out = "";
		for (int i = 0; i < in.length(); i++) {
			char charst = in.charAt(i);
			if (charst != re) {
				out += charst;
			}
		}
		return out;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -