/*
 * 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 javax.servlet.http.HttpSession;

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.Y_addAFinfoForm;
import com.yuntong.service.Y_IAreaFreightInfoService;

/** 
 * MyEclipse Struts
 * Creation date: 04-23-2007
 * 添加运时运费信息
 * XDoclet definition:
 * @struts.action path="/y_addAFinfo" name="y_addAFinfoForm" scope="request" validate="true"
 * @struts.action-forward name="go" path="/Y_YSYF.jsp"
 */
public class Y_addAFinfoAction extends Action {
	public Y_IAreaFreightInfoService freightInfoService;
	public Y_IAreaFreightInfoService getFreightInfoService() {
		return freightInfoService;
	}
	public void setFreightInfoService(Y_IAreaFreightInfoService freightInfoService) {
		this.freightInfoService = freightInfoService;
	}
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		HttpSession session=request.getSession();
		Y_addAFinfoForm y_addAFinfoForm = (Y_addAFinfoForm) form;
		System.out.println(y_addAFinfoForm.getEnd());
		System.out.println(y_addAFinfoForm.getZhongliang());
		//添加或修改		
		boolean tag=freightInfoService.addAFinfo(y_addAFinfoForm.getIid(), y_addAFinfoForm.getStrat(), y_addAFinfoForm.getEnd(), y_addAFinfoForm.getPjtime(), y_addAFinfoForm.getZhongliang(),y_addAFinfoForm.getFangliang());
		if(tag==true){
			session.setAttribute("Y_aftag", "操作成功！");
		}else{
			session.setAttribute("Y_aftag", "不能添加重复记录!");
		}
		
		return mapping.findForward("go");
	}
}