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

📄 actionent_customer_lost.java

📁 公司CRM部分原代码,采用的是java技术.
💻 JAVA
字号:
package GDPE.customer.lost;

import java.util.StringTokenizer;

import levin.base.*;
import levin.util.*;
import GDPE.customer.enterprise.*;

import javax.servlet.http.*;

import portal.sa.auditor.EnAuditor;

public class ActionEnt_Customer_Lost extends Service {

	public ActionEnt_Customer_Lost() {
	}

	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		throw new Exception("Error on doType=" + request.getParameter("doType")
				+ ".");
	}

	public String summary(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		EnEnt_Customer_Lost aEnEnt_Customer_Lost[] = (EnEnt_Customer_Lost[]) (DAOBase
				.findAll(new DbAccess(), EnEnt_Customer_Lost.class.getName()));
		request.setAttribute("aEnEnt_Customer_Lost", aEnEnt_Customer_Lost);
		return this.getTargetPage("summary");
	}

	public String addQuery(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		EnEnt_Customer_Lost cEnEnt_Customer_Lost = new EnEnt_Customer_Lost();
		String iEnterprise = request.getParameter("iEnterpriseId");
		//DbAccess db = new DbAccess();
		//String iEnterprise = (String)request.getParameter("iEnterpriseId");
		//System.out.print("777777777777777777"+iEnterprise);
		EnEnt_Customer_Enterprise en = (EnEnt_Customer_Enterprise) DAOBase
				.findByPK(new DbAccess(), EnEnt_Customer_Enterprise.class
						.getName(), iEnterprise);

		cEnEnt_Customer_Lost.setChCommitCode(en.getChCommitCode());
		cEnEnt_Customer_Lost.setChCommitName(en.getChCommitName());
		cEnEnt_Customer_Lost.setChCustomerName(en.getChEnterpriseFullName());
		cEnEnt_Customer_Lost.setChLinkMan(en.getChEnterpriseLinkman());
		cEnEnt_Customer_Lost.setChLinkTel(en.getChEnterprisePhone());
		cEnEnt_Customer_Lost.setChSeatCode(en.getChSeatCode());
		cEnEnt_Customer_Lost.setChStationCode(en.getChStationCode());
		cEnEnt_Customer_Lost.setChStation(en.getChStation());
		
		request.setAttribute("cEnEnt_Customer_Lost", cEnEnt_Customer_Lost);
		request.setAttribute("doType", "add");
		request.setAttribute("iEnterprise", iEnterprise);
		return this.getTargetPage("detail");
	}

	public String add(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		EnEnt_Customer_Lost cEnEnt_Customer_Lost = (EnEnt_Customer_Lost) request
				.getAttribute("cEnEnt_Customer_Lost");

		DbAccess db = new DbAccess();

		String iEnterprise = request.getParameter("iEnterpriseId");
		if (iEnterprise!=null){
		   try {
			db.beginTransaction();
			DAOBase.delete(db, EnEnt_Customer_Enterprise.class.getName(),
					iEnterprise);
			db.commit();
		   } catch (Exception ex) {
			db.rollback();
			throw ex;
		   }
		}
		try {
			db.beginTransaction();
			DAOBase.insert(db, cEnEnt_Customer_Lost);
			db.commit();
		} catch (Exception ex) {
			db.rollback();
			throw ex;
		}
		levin.iMessage msg = levin.iMessage
				.getNewInstance("客户管理", "新增成功.",
						"openTop(\"GDPE.customer.lost.ActionEnt_Customer_Lost.do?doType=summary\");");
		msg.save(request);
		return this.getTargetPage("Message");
	}

	public String modifyQuery(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");
		EnEnt_Customer_Lost cEnEnt_Customer_Lost = (EnEnt_Customer_Lost) DAOBase
				.findByPK(new DbAccess(), EnEnt_Customer_Lost.class.getName(),
						id);
		
		if (!cEnEnt_Customer_Lost.getDtLostTime().equals("")) {
			if (cEnEnt_Customer_Lost.getDtLostTime().startsWith("1900")) {
				cEnEnt_Customer_Lost.setDtLostTime("");
			} else {
				String year = cEnEnt_Customer_Lost.getDtLostTime()
						.substring(0, 4);
				String month = cEnEnt_Customer_Lost.getDtLostTime()
						.substring(5, 7);
				String day = cEnEnt_Customer_Lost.getDtLostTime()
						.substring(8, 10);
				cEnEnt_Customer_Lost.setDtLostTime(year + month + day);
			}
		}
		request.setAttribute("cEnEnt_Customer_Lost", cEnEnt_Customer_Lost);
		request.setAttribute("doType", "modify");
		return this.getTargetPage("detail");
	}

	public String modify(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		EnEnt_Customer_Lost cEnEnt_Customer_Lost = (EnEnt_Customer_Lost) request
				.getAttribute("cEnEnt_Customer_Lost");
		DbAccess db = new DbAccess();
		try {
			db.beginTransaction();
			DAOBase.update(db, cEnEnt_Customer_Lost);
			db.commit();
		} catch (Exception ex) {
			db.rollback();
			throw ex;
		}
		levin.iMessage msg = levin.iMessage
				.getNewInstance("客户管理", "修改成功.",
						"openTop(\"GDPE.customer.lost.ActionEnt_Customer_Lost.do?doType=summary\");");
		msg.save(request);
		return this.getTargetPage("Message");
	}

	public String view(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		String id = request.getParameter("id");
		EnEnt_Customer_Lost cEnEnt_Customer_Lost = (EnEnt_Customer_Lost) DAOBase
				.findByPK(new DbAccess(), EnEnt_Customer_Lost.class.getName(),
						id);
		request.setAttribute("cEnEnt_Customer_Lost", cEnEnt_Customer_Lost);
		request.setAttribute("doType", "view");
		return this.getTargetPage("detail");
	}

	public String delete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");
		// System.out.print(id);
		DbAccess db = new DbAccess();
		try {
			db.beginTransaction();
			StringTokenizer st = new StringTokenizer(id, ",");
			while (st.hasMoreElements()) {
				String index = (String) st.nextElement();
				DAOBase.delete(db, EnEnt_Customer_Lost.class.getName(), index);
			}

			//      DAOBase.delete(db,EnEnt_Customer_Lost.class.getName(),id);
			db.commit();
		} catch (Exception ex) {
			db.rollback();
			throw ex;
		}
		levin.iMessage msg = levin.iMessage
				.getNewInstance("客户管理", "删除成功.",
						"openTop(\"GDPE.customer.lost.ActionEnt_Customer_Lost.do?doType=summary\");");
		msg.save(request);
		return this.getTargetPage("Message");
	}

}

⌨️ 快捷键说明

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