////////////////////調用Controller裡的函數PaymentUpdateD、/PaymentUpdate
$.post("<%=request.getContextPath()%>/Payment/PaymentUpdateD",{code:code});
$.post("<%=request.getContextPath()%>/Payment/PaymentUpdate", $('#myform').serialize() ,function(tx){
if(tx=="success"){
/* parent.$.messager.alert('提示','添加成功'); */
// alert('提示','添加成功');
parent.$.messager.show({
title : '提示',
msg : '修改成功'
});
/* parent.$('#dialog').dialog('close'); */
parent.$('#dg').datagrid('reload');
}
});
//////////////////////Controller裡的函數
@RequestMapping(value="Payment/PaymentUpdateD")
public void Delete1(HttpServletRequest request,HttpServletResponse response,HttpSession session,Payment payment,
@RequestParam(required=false,value="code") String code) throws IOException{
if(null!=code){
PaySService.deleteAll(code);
}
}
@RequestMapping(value="Payment/PaymentUpdate")
public void Update(HttpServletRequest request,HttpServletResponse response,HttpSession session,Payment payment,
@RequestParam(required=false,value="code") String code,
@RequestParam(required=false,value="includes") String includes,
@RequestParam(required=false,value="Select") String Select,
@RequestParam(required=false,value="stime") String stime,
@RequestParam(required=false,value="etime") String etime,
@RequestParam(required=false,value="outlet") String outlet) throws IOException{
/*if(null!=PaySService.getPayS(code)){
Delete1(code);
}*/
DateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Date stimee = null;
try {
stimee = sdf.parse(stime);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
DateFormat sdf1 = new SimpleDateFormat("HH:mm:ss");
Date etimee = null;
try {
etimee = sdf1.parse(etime);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String canSelect=null;
if(null==Select){
canSelect="FALSE";
}else {
canSelect="TRUE";
}
String include=null;
if(null==includes){
include="FALSE";
}else {
include="TRUE";
outlet=null;
}
payment.setStarttime(stimee);
payment.setEndtime(etimee);
payment.setOutline("6");
payment.setUpdatedBy("0000001");
payment.setCanSelect(canSelect);
payment.setInclude(include);
String result="failed";
if(null!=payment){
paymentService.Update(payment);
if(null!=outlet){
String[] outlets = outlet.split(",");
for(int i=0;i<outlets.length;i++){
PayS payS=new PayS();
payS.setOutlet(outlets[i]);
payS.setPaytype(code);
payS.setOutline("6");
payS.setUpdatedBy("0000001");
PaySService.Save(payS);
}
result="success";
}else{
result = "success";
}
}
response.setHeader("Content-type", "text/html;charset=UTF-8");
// 如果是默認繁體中文查看,則設置為UTF-8
response.setCharacterEncoding("UTF-8");
response.getWriter().write(result);
}