/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.yuntong.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.yuntong.action.actionform.G_DriverInfoForm;
import com.yuntong.business.vo.G_DriverInfoVO;
import com.yuntong.service.G_IDriverInfoService;

/** 
 * MyEclipse Struts
 * Creation date: 04-08-2007
 * 
 * XDoclet definition:
 * @struts.action path="/g_AddDriverInfo" name="g_DriverInfoForm" scope="request" validate="true"
 */
public class G_AddDriverInfoAction extends Action {
	private G_IDriverInfoService driverInfoService;
	/*
	 * Generated Methods
	 */

	public G_IDriverInfoService getDriverInfoService() {
		return driverInfoService;
	}

	public void setDriverInfoService(G_IDriverInfoService driverInfoService) {
		this.driverInfoService = driverInfoService;
	}

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		G_DriverInfoForm g_DriverInfoForm = (G_DriverInfoForm) form;// TODO Auto-generated method stub
		
		String driverCardID=request.getParameter("driverCardID");
		String driverRemarkInfo=request.getParameter("driverRemarkInfo");
		String driverDriverCardID=request.getParameter("driverDriverCardID");
		String driverPhoto=request.getParameter("driverPhoto");
		int driverCompanyID=Integer.parseInt(request.getParameter("driverCompanyID"));
		String driverName=request.getParameter("driverName");
		String driverPhoneNum=request.getParameter("driverPhoneNum");
		int driverAge=Integer.parseInt(request.getParameter("driverAge"));
		System.out.println(request.getParameter("driverSex"));
		int driverSex=Integer.parseInt(request.getParameter("driverSex"));
		
		
		String[] str=driverPhoto.replace("\\", "/").split("/");
		String photo=request.getContextPath()+"/picture/driver/s"+str[str.length-1];
		
		G_DriverInfoVO driverInfoVO=new G_DriverInfoVO();
		driverInfoVO.setDriverAge(driverAge);
		driverInfoVO.setDriverCardID(driverCardID);
		driverInfoVO.setDriverCompanyID(driverCompanyID);
		driverInfoVO.setDriverDriverCardID(driverDriverCardID);
		driverInfoVO.setDriverName(driverName);
		driverInfoVO.setDriverPhoneNum(driverPhoneNum);
		driverInfoVO.setDriverPhoto(photo);
		driverInfoVO.setDriverRemarkInfo(driverRemarkInfo);
		driverInfoVO.setDriverSex(driverSex);
		driverInfoVO.setIsLeisure(0);
		driverInfoService.addDriverInfo(driverInfoVO);
		return null;
	}
}