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

📄 linkmanaction.java

📁 做的是一个客户关系管理系统
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.accp.struts.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;

import com.accp.dao.CstCustomer;
import com.accp.dao.CstLinkman;
import com.accp.impl.CustomerImpl;
import com.accp.inf.LinkManInf;

/** 
 * MyEclipse Struts
 * Creation date: 10-14-2008
 * 
 * XDoclet definition:
 * @struts.action path="/linkMan" name="linkManForm" input="/form/linkMan.jsp" parameter="op" scope="request" validate="true"
 */
public class LinkManAction extends DispatchAction {
	/*
	 * Generated Methods
	 */
	public LinkManInf linkman;

	public LinkManInf getLinkman() {
		return linkman;
	}
	public void setLinkman(LinkManInf linkman) {
		this.linkman = linkman;
	}
	
	public CustomerImpl customer;
	public CustomerImpl getCustomer() {
		return customer;
	}
	public void setCustomer(CustomerImpl customer) {
		this.customer = customer;
	}
	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	/**
	 * 通过联系人编号查询联系人信息的方法
	 */
	public ActionForward GetLinkManById(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm linkManForm = (DynaActionForm) form;// TODO Auto-generated method stub
		String id = request.getParameter("id");
		CstLinkman linkmanInfo = linkman.GetLinkmanById(id);
		if(linkmanInfo != null)
		{
			request.setAttribute("linkman", linkmanInfo);
		}
		return mapping.findForward("linkman_edit");
	}	
	/**
	 * 添加联系人的方法
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward Add(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm linkManForm = (DynaActionForm) form;// TODO Auto-generated method stub
		CstLinkman linkManInfo = (CstLinkman)linkManForm.get("linkman");
		HttpSession session = request.getSession();
		String id = (String)session.getAttribute("CustomerNo");		
		if(id != null && id != "")
		{
			CstCustomer customerInfo = customer.GetCustomerById(id);
			linkManInfo.setCstCustomer(customerInfo);
			linkManInfo.setLkmCustName(customerInfo.getCustName());
		}
		linkman.AddLinkMan(linkManInfo);
		return mapping.findForward("linkmando");
	}
	/**
	 * 修改联系人的方法
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward Modify(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm linkManForm = (DynaActionForm) form;// TODO Auto-generated method stub
		CstLinkman linkManInfo = (CstLinkman)linkManForm.get("linkman");
		HttpSession session = request.getSession();
		String customerNO = (String)session.getAttribute("CustomerNo");
		if(customerNO != null && customerNO != "")
		{
			CstCustomer customerInfo = customer.GetCustomerById(customerNO);
			linkManInfo.setCstCustomer(customerInfo);
			linkManInfo.setLkmCustName(customerInfo.getCustName());
		}
		String linkmanId = request.getParameter("linkmanID");
		linkManInfo.setLkmId(new Long(linkmanId));
		linkman.ModifLinkMan(linkManInfo);
		return mapping.findForward("linkmando");
	}
	/**
	 * 创建一个删除联系人的方法
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward Delete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm linkManForm = (DynaActionForm) form;// TODO Auto-generated method stub
		String linkmanId = request.getParameter("linkmanID");
		CstLinkman linkmanInfo = linkman.GetLinkmanById(linkmanId);
		if(linkmanInfo != null)
		{
			linkman.Delete(linkmanInfo);
		}		
		return mapping.findForward("linkmando");
	}
	public ActionForward add2(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DynaActionForm linkManForm = (DynaActionForm) form;// TODO Auto-generated method stub
		return null;
	}
}

⌨️ 快捷键说明

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