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

import java.util.List;

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.hibernate.database.po.TAgioInfo;
import com.yuntong.hibernate.database.po.TAgioType;
import com.yuntong.hibernate.database.po.TRegisterInfo;
import com.yuntong.service.M_TAgionInfoManagerService;

/** 
 * MyEclipse Struts
 * Creation date: 04-09-2007
 * 
 * XDoclet definition:
 * @struts.action
 * @struts.action-forward name="addok" path="/SCGL/M_scgl_1.jsp"
 */
public class AddInfoAction extends Action {
	private M_TAgionInfoManagerService M_service;
	/*
	 * Generated Methods
	 */

	public M_TAgionInfoManagerService getM_service() {
		return M_service;
	}

	public void setM_service(M_TAgionInfoManagerService m_service) {
		M_service = m_service;
	}

	/** 
	 * Method execute
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try {
			TAgioInfo info= new TAgioInfo();
			
			int piaoid=Integer.parseInt(request.getParameter("piaoId").trim());
			int leiid=Integer.parseInt(request.getParameter("leiId").trim());
			float money=Float.parseFloat(request.getParameter("shao").trim());
			String beizhu=request.getParameter("bei");
			
			System.out.println(piaoid+"--------");
			System.out.println(leiid+"--------");
			System.out.println(money+"--------");
			System.out.println(beizhu+"--------");
			
			
			//类型编号
			TAgioType type= new TAgioType();
			type.setAtypeId(leiid);
			info.setTAgioType(type);
			//票编号
			TRegisterInfo tr= new TRegisterInfo();
			tr.setRegisterId(piaoid);
			info.setTRegisterInfo(tr);
			//钱
			info.setAgioMoney(money);
			//备注
			info.setAgioInfo(beizhu);
			//执行更新
			M_service.updateInfo(info);
			List list=M_service.getAllInfo();
			request.getSession().setAttribute("agionInfoList",list);
		} catch (Exception e) {
			e.printStackTrace();
		}
			return mapping.findForward("addok");
	}
}