59 lines
2.2 KiB
Plaintext
59 lines
2.2 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
|
|
<%@include file="/include/db/db_connect.jsp"%>
|
|
<%@include file="/include/function/function.jsp"%>
|
|
<%request.setCharacterEncoding("utf-8");%>
|
|
<%
|
|
|
|
String c_project_no = r_call(request.getParameter("c_project_no"));
|
|
String c_type = r_call(request.getParameter("c_type"));
|
|
String c_id = r_call(request.getParameter("c_id"));
|
|
c_id = c_id.replaceAll(" ","");
|
|
c_id = c_id.replaceAll("\r","\n");
|
|
|
|
String[] a_id = c_id.split("\n");
|
|
int alr = 0;
|
|
int alr2 = 0;
|
|
for( int i = 0; i < a_id.length; i++ ){
|
|
a_id[i] = a_id[i].replaceAll(" ","");
|
|
if(!a_id[i].equals("")){
|
|
String sql3 = "select a.c_no from tbl_member a inner join tbl_pnm_for_bcb b on b.c_member_no = a.c_no ";
|
|
sql3 = sql3 + " where b.c_project_no = "+ c_project_no +" and a.c_use = 0 and b.c_use = 0 and b.c_team_no = 0 and a.c_id = '" + a_id[i] + "' and b.c_type= " + c_type;
|
|
ResultSet rs3 = stmt.executeQuery(sql3);
|
|
if (rs3.next()) {
|
|
alr = alr + 1;
|
|
}else{
|
|
String sql4 = "select c_no from tbl_member where c_use = 0 and c_id = '" + a_id[i] + "' ";
|
|
ResultSet rs4 = stmt.executeQuery(sql4);
|
|
if (rs4.next()) {
|
|
}else{
|
|
Random r = new Random();
|
|
int k1 = r.nextInt(10000);
|
|
String sql_ok = "";
|
|
sql_ok = "insert into tbl_member (c_id, c_rand,c_use) values(";
|
|
sql_ok = sql_ok + "'" + a_id[i] + "',1111,0)";
|
|
stmt2.execute(sql_ok);
|
|
}
|
|
rs4.close();
|
|
sql4 = "select c_no from tbl_member where c_use = 0 and c_id = '" + a_id[i] + "' ";
|
|
rs4 = stmt.executeQuery(sql4);
|
|
if (rs4.next()) {
|
|
String sql_ok = "";
|
|
sql_ok = "insert into tbl_pnm_for_bcb (c_type,c_project_no,c_member_no,c_team_no,c_use,c_date) values(";
|
|
sql_ok = sql_ok + "" + c_type + "," + c_project_no + ","+ rs4.getInt("c_no") +",0,0,now())";
|
|
stmt2.execute(sql_ok);
|
|
alr2 = alr2 + 1;
|
|
}
|
|
rs4.close();
|
|
}
|
|
rs3.close();
|
|
}
|
|
}
|
|
|
|
%>
|
|
<script>
|
|
alert("<%=alr2%> People has been registered.<%if(alr>0){%>\n<%=alr%>People is the number of people who have already been registered.<%}%>");
|
|
parent.location.href="list.jsp?c_project_no=<%=c_project_no%>"
|
|
</script>
|
|
<%
|
|
%>
|
|
<%@include file="/include/db/db_close.jsp"%> |