package com.mrmis.confirm;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.Action;
import java.sql.*;
import com.mrmis.util.*;
public class ConfirmAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
Connection conn=null;
Statement pstmt=null;
ResultSet rs=null;
DBUtil dbutil=new DBUtil();
String sql="";
ConfirmForm confirmForm=(ConfirmForm)form;
String pre_num=confirmForm.getPre_num();
String password=confirmForm.getPassword();
String kind=confirmForm.getKind();
try
{
conn=dbutil.getConnection();
if(kind.equals("结婚"))
{
sql="select * from PREMARRY where Pre_Num=\'"+pre_num+"\' and password=\'"+password+"\'";
pstmt=conn.createStatement();
rs=pstmt.executeQuery(sql);
if(rs.next())
{
String man_name=rs.getString("Man_Name");
String woman_name=rs.getString("Woman_Name");
String man_birth_date=rs.getString("Man_Birth_Date");
String woman_birth_date=rs.getString("Woman_Birth_Date");
String man_id_card=rs.getString("Man_Id_Card");
String woman_id_card=rs.getString("Woman_Id_Card");
String man_nation_name=rs.getString("Man_Nation_Name");
String woman_nation_name=rs.getString("Woman_Nation_Name");
String man_nationlity_name=rs.getString("Man_Nationlity_Name");
String woman_nationlity_name=rs.getString("Woman_Nationlity_Name");
String man_marital_status=rs.getString("Man_Marital_Status");
String woman_marital_status=rs.getString("Woman_Marital_Status");
String man_culture_name=rs.getString("Man_Culture_Name");
String woman_culture_name=rs.getString("Woman_Culture_Name");
String man_career_name=rs.getString("Man_Career_Name");
String woman_career_name=rs.getString("Woman_Career_Name");
String man_residence=rs.getString("Man_Residence");
String woman_residence=rs.getString("Woman_Residence");
request.setAttribute("man_name", man_name);
request.setAttribute("woman_name", woman_name);
request.setAttribute("man_birth_date", man_birth_date);
request.setAttribute("woman_birth_date", woman_birth_date);
request.setAttribute("man_id_card", man_id_card);
request.setAttribute("woman_id_card", woman_id_card);
request.setAttribute("man_nation_name", man_nation_name);
request.setAttribute("woman_nation_name", woman_nation_name);
request.setAttribute("man_nationlity_name", man_nationlity_name);
request.setAttribute("woman_nationlity_name", woman_nationlity_name);
request.setAttribute("man_marital_status", man_marital_status);
request.setAttribute("woman_marital_status", woman_marital_status);
request.setAttribute("man_culture_name", man_culture_name);
request.setAttribute("woman_culture_name", woman_culture_name);
request.setAttribute("man_career_name",man_career_name);
request.setAttribute("woman_career_name",woman_career_name);
request.setAttribute("man_residence", man_residence);
request.setAttribute("woman_residence", woman_residence);
}
return mapping.findForward("marry");
}
else if(kind.equals("离婚"))
{
sql="select * from PREUNMARRY where Pre_Num=\'"+pre_num+"\' and password=\'"+password+"\'";
pstmt=conn.createStatement();
rs=pstmt.executeQuery(sql);
if(rs.next())
{
String man_name=rs.getString("Man_Name");
String woman_name=rs.getString("Woman_Name");
String man_birth_date=rs.getString("Man_Birth_Date");
String woman_birth_date=rs.getString("Woman_Birth_Date");
String man_id_card=rs.getString("Man_Id_Card");
String woman_id_card=rs.getString("Woman_Id_Card");
String man_nation_name=rs.getString("Man_Nation_Name");
String woman_nation_name=rs.getString("Woman_Nation_Name");
String man_nationlity_name=rs.getString("Man_Nationlity_Name");
String woman_nationlity_name=rs.getString("Woman_Nationlity_Name");
String man_culture_name=rs.getString("Man_Culture_Name");
String woman_culture_name=rs.getString("Woman_Culture_Name");
String man_career_name=rs.getString("Man_Career_Name");
String woman_career_name=rs.getString("Woman_Career_Name");
String man_unmarry_reason=rs.getString("Man_Unmarry_Reason");
String woman_unmarry_reason=rs.getString("Woman_Unmarry_Reason");
String man_residence=rs.getString("Man_Residence");
String woman_residence=rs.getString("Woman_Residence");
String marry_time=rs.getString("Marry_Time");
String marry_cert_code=rs.getString("Marry_Cert_Code");
request.setAttribute("man_name", man_name);
request.setAttribute("woman_name", woman_name);
request.setAttribute("man_birth_date", man_birth_date);
request.setAttribute("woman_birth_date", woman_birth_date);
request.setAttribute("man_id_card", man_id_card);
request.setAttribute("woman_id_card", woman_id_card);
request.setAttribute("man_nation_name", man_nation_name);
request.setAttribute("woman_nation_name", woman_nation_name);
request.setAttribute("man_nationlity_name", man_nationlity_name);
request.setAttribute("woman_nationlity_name", woman_nationlity_name);
request.setAttribute("man_culture_name", man_culture_name);
request.setAttribute("woman_culture_name", woman_culture_name);
request.setAttribute("man_career_name",man_career_name);
request.setAttribute("woman_career_name",woman_career_name);
request.setAttribute("man_unmarry_reason",man_unmarry_reason);
request.setAttribute("woman_unmarry_reason",woman_unmarry_reason);
request.setAttribute("man_residence", man_residence);
request.setAttribute("woman_residence", woman_residence);
request.setAttribute("marry_time", marry_time);
request.setAttribute("marry_cert_code", marry_cert_code);
}
return mapping.findForward("unmarry");
}
else if(kind.equals("撤销"))
{
sql="select * from PREUNDO where Pre_Num=\'"+pre_num+"\' and password=\'"+password+"\'";
pstmt=conn.createStatement();
rs=pstmt.executeQuery(sql);
if(rs.next())
{
String man_name=rs.getString("Man_Name");
String woman_name=rs.getString("Woman_Name");
String man_birth_date=rs.getString("Man_Birth_Date");
String woman_birth_date=rs.getString("Woman_Birth_Date");
String man_id_card=rs.getString("Man_Id_Card");
String woman_id_card=rs.getString("Woman_Id_Card");
String man_nation_name=rs.getString("Man_Nation_Name");
String woman_nation_name=rs.getString("Woman_Nation_Name");
String man_nationlity_name=rs.getString("Man_Nationlity_Name");
String woman_nationlity_name=rs.getString("Woman_Nationlity