CarTypeOperation.jsp
3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="CarTypeComInfo" class="weaver.car.CarTypeComInfo" scope="page"/>
<%
if(!HrmUserVarify.checkUserRight("Car:Maintenance",user)) {
response.sendRedirect("/notice/noright.jsp") ;
return ;
}
String operation = Util.fromScreen(request.getParameter("operation"),user.getLanguage());
String name = Util.fromScreen(request.getParameter("name"),user.getLanguage());
String description = Util.fromScreen(request.getParameter("description"),user.getLanguage());
String usefee = Util.fromScreen(request.getParameter("usefee"),user.getLanguage());
String dialog = Util.null2String(request.getParameter("dialog"),"0");
if(operation.equals("add")){
char separator = Util.getSeparator() ;
String para = name + separator + description + separator + usefee;
RecordSet.executeProc("CarType_Insert",para);
CarTypeComInfo.removeCarTypeCache();
//response.sendRedirect("/cpt/car/CarTypeEdit.jsp?id="+id+"&dialog="+dialog);
response.sendRedirect("/cpt/car/CarTypeAdd.jsp?isclosed=1");
return;
}
else if(operation.equals("addAndNew")){
char separator = Util.getSeparator() ;
String para = name + separator + description + separator + usefee;
RecordSet.executeProc("CarType_Insert",para);
CarTypeComInfo.removeCarTypeCache();
response.sendRedirect("/cpt/car/CarTypeAdd.jsp?dialog="+dialog);
return;
}
else if(operation.equals("edit")){
char separator = Util.getSeparator() ;
String id = Util.fromScreen(request.getParameter("id"),user.getLanguage());
String para = id + separator + name + separator + description + separator + usefee;
RecordSet.executeProc("CarType_Update",para);
CarTypeComInfo.removeCarTypeCache();
response.sendRedirect("/cpt/car/CarTypeEdit.jsp?id="+id+"&dialog="+dialog);
//response.sendRedirect("/cpt/car/CarTypeEdit.jsp?id="+id+"&isclosed=1");
return;
}
else if(operation.equals("delete")){
char separator = Util.getSeparator() ;
String id = Util.fromScreen(request.getParameter("id"),user.getLanguage());
// RecordSet.executeSql("select count(*) from CarDriverData where cartypeid ="+id);
// RecordSet.next();
// int count=RecordSet.getInt(1);
// if(count>0){
// response.sendRedirect("CarTypeEdit.jsp?CanDelete=1&id="+id);
// }else{
// String para = id;
// RecordSet.executeProc("CarType_Delete",para);
// }
int count=0;
RecordSet.executeSql("select count(*) from CarDriverData where cartypeid ="+id);
if(RecordSet.next()){
count=RecordSet.getInt(1);
if(count>0){
response.sendRedirect("/cpt/car/CarTypeEdit.jsp?CanDelete=1&id="+id+"&dialog="+dialog);
return ;
}
}
RecordSet.executeSql("select count(1) from CarInfo where carType="+id);
if(RecordSet.next()){
count=RecordSet.getInt(1);
if(count>0){
response.sendRedirect("/cpt/car/CarTypeEdit.jsp?CanDelete=1&id="+id+"&dialog="+dialog);
return ;
}
}
String para = id;
RecordSet.executeProc("CarType_Delete",para);
CarTypeComInfo.removeCarTypeCache();
if (dialog.equals("1")) {
response.sendRedirect("/cpt/car/CarTypeEdit.jsp?id="+id+"&isclosed=1");
return;
}
}
response.sendRedirect("CarTypeListIframe.jsp");
//if (dialog.equals("1")){
//out.print("<script>parent.closePrtDlgARfsh();</script>");
//} else {
//response.sendRedirect("CarTypeListIframe.jsp");
//}
%>