<%@page import="project.ConnectionProvider"%>
<%@page import="java.sql.*"%>

<%
    String id = request.getParameter("id");
    String first_name = request.getParameter("first_name");
    String middle_name = request.getParameter("middle_name");
    String last_name = request.getParameter("last_name");
    String DOB = request.getParameter("DOB");
    String gender = request.getParameter("gender");
    String address = request.getParameter("address");
    String city = request.getParameter("city");
    String state = request.getParameter("state");
    String country = request.getParameter("country");
    String email = request.getParameter("email");
    String personal_email = request.getParameter("personal_email");
    String phone_number = request.getParameter("phone_number");
    String bank_name = request.getParameter("bank_name");
    String bank_account_number = request.getParameter("bank_account_number");
    String bank_account_type = request.getParameter("bank_account_type");
    String IFSC_code = request.getParameter("IFSC_code");
    String PAN_card = request.getParameter("PAN_card");
    String emp_type = request.getParameter("emp_type");
    String designation = request.getParameter("designation");
    String department = request.getParameter("department");
    String line_manager = request.getParameter("line_manager");
    String qualification = request.getParameter("qualification");
    String experience = request.getParameter("experience");
    String role = request.getParameter("role");
    String status = request.getParameter("status");

    try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/CLINIHR", "root", "Clinica123");
        Statement st = con.createStatement();
        st.executeUpdate("update users set first_name='" + first_name + "', middle_name='" + middle_name + "', last_name='" + last_name + "', DOB='" + DOB + "', gender='" + gender + "', address='" + address + "', city='" + city + "', state='" + state + "', country='" + country + "', email='" + email + "', personal_email='" + personal_email + "', phone_number='" + phone_number + "', bank_name='" + bank_name + "', bank_account_number='" + bank_account_number + "', bank_account_type='" + bank_account_type + "', IFSC_code='" + IFSC_code + "', PAN_card='" + PAN_card + "', emp_type='" + emp_type + "', designation='" + designation + "', department='" + department + "', line_manager='" + line_manager + "', qualification='" + qualification + "', experience='" + experience + "', status='" + status + "', role='" + role + "' where id='" + id + "'");
        //if(status.equals("Resigned")){
        //st.executeUpdate("delete from users where id='"+id+"'");       
        //}
        response.sendRedirect("allEmployeesEditEmployeesDetails.jsp?msg=done");
    } catch (Exception e) {
        out.println(e);
        response.sendRedirect("allEmployeesEditEmployeesDetails.jsp?msg=wrong");
    }
%>