📄 itemchargeaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.nitpro.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.nitpro.dao.DAOFactory;
import com.nitpro.form.ItemChargeForm;
/**
* MyEclipse Struts
* Creation date: 12-25-2007
*
* XDoclet definition:
* @struts.action parameter="method" validate="true"
*/
public class ItemChargeAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward itemPriceInput(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String medicine_id = request.getParameter("medicine_id");
String medicine_name = request.getParameter("medicine_name");
float medicine_price = Float.parseFloat(request.getParameter("medicine_price"));
String[] type = request.getParameter("D1").split("/");
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
ItemChargeForm iform = new ItemChargeForm();
iform.setMedicine_id(medicine_id);
iform.setMedicine_name(medicine_name);
iform.setMedicine_price(medicine_price);
iform.setType_id(type[0]);
int rst = dao.getAllMethodDAO().checkMedicine_id(medicine_id);
if (rst == 2){
dao.getAllMethodDAO().itemChargeInput(iform);
return mapping.findForward("itemchargeinputok");
}else{
ActionErrors errors = new ActionErrors();
errors.add("medicine_id", new ActionError("medicineIDError"));
this.saveErrors(request, errors);
return mapping.findForward("itemchargeinputfail");
}
}
public ActionForward itemPriceSelect(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String selectoption = request.getParameter("selectoption");
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
List ilist = dao.getAllMethodDAO().itemChargeSelect(selectoption);
request.setAttribute("ilist", ilist);
return mapping.findForward("selectOK");
}
public ActionForward itemPriceDelect(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String medicine_id = request.getParameter("medicine_id");
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
dao.getAllMethodDAO().itemChargeDelect(medicine_id);
return mapping.findForward("delectOK");
}
public ActionForward changeUrl(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String medicine_id = request.getParameter("medicine_id");
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
List ilist = dao.getAllMethodDAO().itemChargeSpecalSelect(medicine_id);
request.setAttribute("i_s_list", ilist);
return mapping.findForward("changeOK");
}
public ActionForward itemPriceUpdate(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String medicine_id = request.getParameter("medicine_id");
float medicine_price = Float.parseFloat(request.getParameter("medicine_price"));
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
dao.getAllMethodDAO().itemChargeUpdate(medicine_id, medicine_price);
return mapping.findForward("updateOK");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -