public class ProjeSahipDao { //AssignProjectServlet Controller olarak kullanılacak class public ProjeSahip insertProjeSahip(ProjeSahip projeSahip)throws Exception{
Connection conn=null; PreparedStatement pstmt=null;
String sqlStr="INSERT INTO ZZZ_PROJESAHIP(PS_ID,P_ID,STAJUSERNAME,ADMINUSERNAME,SDURDEG,DURUM,PBAS,PBIT,D_ID,PBITIS)"; sqlStr+="VALUES (?,?,?,?,?,?,?,?,?,?)";
try {
Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection( "jdbc:oracle:thin:@10....:1...:KO...", "stajer", "stajer");
pstmt = conn.prepareStatement(sqlStr);
pstmt.setInt(1, projeSahip.getPsId()); pstmt.setString(2, projeSahip.getPId()); pstmt.setString(3, projeSahip.getStajUserName()); pstmt.setObject(4, projeSahip.getAdminUserNameLogged()); pstmt.setString(5, projeSahip.getSDurDeg()); pstmt.setString(6, projeSahip.getDurum()); pstmt.setString(7, projeSahip.getPBas()); pstmt.setString(8, projeSahip.getPBit()); pstmt.setString(9, projeSahip.getDId()); pstmt.setString(10, projeSahip.getPBitis());
pstmt.executeUpdate();
} catch (Exception e) { throw e; } finally{ try {pstmt.close();} catch (Exception e) {} try {conn.close();} catch (Exception e) {} }
return projeSahip;
} //ChangeAssignmentInfoServlet Controller olarak kullanılacak class public ProjeSahip updateProjeSahipChangeAssignInfo(ProjeSahip projeSahip)throws Exception{
Connection conn=null; PreparedStatement pstmt=null;
try { //PS_ID radiobutondan HIDDEN olarak alinacaktir. String sqlStr="UPDATE ZZZ_PROJESAHIP SET STAJUSERNAME=?,PBIT=? WHERE PS_ID=?";
Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection( "jdbc:oracle:thin:@10....:1...:KO...", "stajer", "stajer");
pstmt = conn.prepareStatement(sqlStr);
pstmt.setString(1, projeSahip.getStajUserName()); pstmt.setString(2, projeSahip.getPBit()); pstmt.setInt(3, projeSahip.getPsId());
pstmt.executeUpdate();
} catch (Exception e) { throw e; } finally{ try {pstmt.close();} catch (Exception e) {} try {conn.close();} catch (Exception e) {} } return projeSahip; }
|