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

📄 chanceaction.java

📁 crm系统 有源码 及相关文档sql2005 数据库 客户反馈模块
💻 JAVA
字号:
package org.jb.y272.team0.web.action;

import java.util.List;

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

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.jb.common.web.action.BaseAction;

import org.jb.y272.team0.biz.ChanceBiz;
import org.jb.y272.team0.biz.UserBiz;
import org.jb.y272.team0.entity.SalChance;
import org.jb.y272.team0.web.form.ChanceForm;

/**
 * 销售机会 Action Bean
 * @author 北大青鸟
 */
public class ChanceAction extends BaseAction {
	/**
	 * 指派
	 */
	public ActionForward toDispatch(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;		
		 
		String id = request.getParameter("id");
		SalChance item = this.chanceBiz.get(Long.parseLong(id));
		myForm.setItem(item);		
		
		List roles = super.getUsersOptions(this.getServlet().getServletConfig().getServletContext(), this.userBiz);
		request.setAttribute("USERS_OPTIONS", roles);
		
		return mapping.findForward("dispatch");	
	}
	public ActionForward doDispatch(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		this.chanceBiz.dispatch(myForm.getItem());
		response.sendRedirect("chance.do?o=toList");
		return null;
	}
	/**
	 * 转到 查询页面
	 */
	public ActionForward toList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		myForm.getItem().setChcStatus("未指派");
		this.chanceBiz.search(myForm.getItem(), myForm.getPageResult());
		return mapping.findForward("list");
	}
	
	/**
	 * 转到 新建页面
	 */
	public ActionForward toAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		
		List roles = super.getUsersOptions(this.getServlet().getServletConfig().getServletContext(), this.userBiz);
		request.setAttribute("USERS_OPTIONS", roles);
		
		myForm.setItem(new SalChance());
		return mapping.findForward("add");
	}
	
	/**
	 * 执行 新建操作
	 */
	public ActionForward doAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		this.chanceBiz.add(myForm.getItem());
		response.sendRedirect("chance.do?o=toList");
		return null;
	}
	
	/**
	 * 转到 编辑页面
	 */
	public ActionForward toEdit(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		
		String id = request.getParameter("id");
		SalChance item = this.chanceBiz.get(Long.parseLong(id));
		myForm.setItem(item);
		
		return mapping.findForward("edit");	
	}
	
	/**
	 * 执行 编辑操作
	 */
	public ActionForward doEdit(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		this.chanceBiz.update(myForm.getItem());
		response.sendRedirect("chance.do?o=toList");
		return null;
	}
	
	/**
	 * 执行 删除操作
	 */
	public ActionForward doDel(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		String id = request.getParameter("id");
		this.chanceBiz.del(Long.parseLong(id));
		response.sendRedirect("chance.do?o=toList");
		return null;
	}
	
	/**
	 * 转到 明细页面
	 */
	public ActionForward doDetail(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception{
		ChanceForm myForm = (ChanceForm)form;
		
		String id = request.getParameter("id");
		SalChance item = this.chanceBiz.get(Long.parseLong(id));
		myForm.setItem(item);
		
		return mapping.findForward("detail");
	}
	
	/*	注入Biz方法 */
	private ChanceBiz chanceBiz = null;
	public void setChanceBiz(ChanceBiz chanceBiz){
		this.chanceBiz = chanceBiz; 
	}
	
	private UserBiz userBiz = null;
	public void setUserBiz(UserBiz userBiz){
		this.userBiz = userBiz; 
	}
}

⌨️ 快捷键说明

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