//인서트정보 중복체크 private void checkOverlap() { SqlConnection sqlcon = new SqlConnection(strconn); try { sqlcon.Open(); string cmdText = "select * from RESUME where ID = @id"; SqlCommand cmd = new SqlCommand(cmdText, sqlcon); cmd.CommandText = cmdText; cmd.Parameters.AddWithValue("@id", IMemberMainForm.getID()); DataSet ds = new DataSet(); SqlDataAdapter adpt = new SqlDataAdapter(cmd); adpt.Fill(ds); SqlDataReader DR = cmd.ExecuteReader(); if (DR.HasRows) { while (DR.Read()) { if (DR["ID"].ToString() == IMemberMainForm.getID()) { checkOver = true; } } } DR.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message); MessageBox.Show(ee.StackTrace); } }
//이력서 수정 private void Resume_Update() { SqlConnection sqlconn = new SqlConnection(strconn); try { sqlconn.Open(); string UpdateText = "update RESUME set RE_SUBJECT = @re_subject, LICENSE=@license, EXP =@exp, CONTENT =@content, LOCATION =@location where ID = @id"; SqlCommand cmd = new SqlCommand(UpdateText, sqlconn); cmd.Parameters.AddWithValue("@id", IMemberMainForm.getID()); cmd.Parameters.AddWithValue("@re_subject", IMenu3.getSbj()); cmd.Parameters.AddWithValue("@license", IMenu3.getLic()); cmd.Parameters.AddWithValue("@exp", IMenu3.getEx()); cmd.Parameters.AddWithValue("@content", IMenu3.getCon()); cmd.Parameters.AddWithValue("@location", IMenu3.getLoca()); cmd.BeginExecuteNonQuery(); sqlconn.Close(); Log.printLog("이력서 수정 완료"); }catch (Exception ee) { Log.printLog("이력서 수정 실패"); MessageBox.Show(ee.Message); MessageBox.Show(ee.StackTrace); } finally { sqlconn.Close(); } }
//이력서 insert sql private void Resume_Insert() { SqlConnection sqlconn = new SqlConnection(strconn); try { sqlconn.Open(); string InsertText = "Insert Into RESUME (RE_NUM,ID,NAME,ADDR,EMAIL,PHONE,RE_SUBJECT,LICENSE,EXP,CONTENT,LOCATION) VALUES(NEXT VALUE FOR RE_NUMBER,@id,@name,@addr,@email,@phone,@re_subject,@license,@exp,@content,@location)"; SqlCommand cmd = new SqlCommand(InsertText, sqlconn); //cmd.Parameters.AddWithValue("@re_num", count); cmd.Parameters.AddWithValue("@id", IMemberMainForm.getID()); cmd.Parameters.AddWithValue("@name", IMemberMainForm.getName()); cmd.Parameters.AddWithValue("@addr", IMemberMainForm.getAddr()); cmd.Parameters.AddWithValue("@email", IMemberMainForm.getEmail()); cmd.Parameters.AddWithValue("@phone", IMemberMainForm.getPhone()); cmd.Parameters.AddWithValue("@re_subject", IMenu3.getSbj()); cmd.Parameters.AddWithValue("@license", IMenu3.getLic()); cmd.Parameters.AddWithValue("@exp", IMenu3.getEx()); cmd.Parameters.AddWithValue("@content", IMenu3.getCon()); cmd.Parameters.AddWithValue("@location", IMenu3.getLoca()); checkOverlap(); if (checkOver == true) { MessageBox.Show("중복 지원할 수 없습니다"); } else { cmd.ExecuteNonQuery(); //cmd.CommandText = "Update RESUME set RE_NUM = (select RE_NUM from RESUME where RE_NUM = @re_num1)+1 where RE_NUM = @re_num2"; //cmd.Parameters.AddWithValue("@re_num1", IMenu3.getRenum()); //cmd.Parameters.AddWithValue("@re_num2", IMenu3.getRenum()); //cmd.ExecuteNonQuery(); MessageBox.Show("등록되었습니다."); Log.printLog("이력서 저장 완료"); } sqlconn.Close(); } catch (Exception ee) { Log.printLog("이력서 저장 실패"); MessageBox.Show(ee.Message); MessageBox.Show(ee.StackTrace); } finally { sqlconn.Close(); } }
//등록버튼 private void Insert_Resume_Click(object sender, EventArgs e) { if (IMemberMainForm.getID() == "admin") { MessageBox.Show("관리자 입니다"); } else { Ir.resume_Subject = Subject_text.Text; Ir.resume_Location = Location_text.Text; Ir.resume_Exp = Exp_text.Text; Ir.resume_License = License_text.Text; Ir.resume_Content = Introduce_text.Text; Resume_Insert(); } }
private void show_My_review() { try { conn.ConnectionString = DBConnection.strconn; conn = new SqlConnection(conn.ConnectionString); conn.Open(); Console.WriteLine("showDB 호출"); // 테스트 SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "select rev_Num,rev_comName,rev_subject, content,r_date,rev_STAR_PT from review where rev_id = @r_id"; cmd.Parameters.AddWithValue("@r_id", IMemberMainForm.getID()); SqlDataReader DR = cmd.ExecuteReader(); if (DR.HasRows) { while (DR.Read()) { listView1.Items.Add(new ListViewItem(new string[] { DR["rev_Num"].ToString(), DR["rev_comName"].ToString(), DR["rev_subject"].ToString(), DR["content"].ToString(), DR["r_date"].ToString(), DR["rev_STAR_PT"].ToString() })); } } DR.Close(); } catch (Exception e) { Console.WriteLine("showDB Error"); // 에러메세지 Console.WriteLine(e.StackTrace); Console.WriteLine(e.Message); Console.WriteLine(e.Source); } finally { conn.Close(); } }
private void btn_update_Click(object sender, EventArgs e) { if (table == "COM_CUSTOMER") // 기업회원 { if (text_currentPW.Text.Equals(MainForm.getPW())) // 현재 비밀번호 맞을 때 { if (text_changePW.Text.Equals(text_check.Text)) // 바꿀비밀번호랑 비밀번호 체크랑 맞을 때 { SqlConnection sqlcon = new SqlConnection(DBConnection.strconn); try { sqlcon.Open(); SqlCommand cmd = new SqlCommand("update COM_CUSTOMER set PW = @pw where ID = @id", sqlcon); cmd.Parameters.AddWithValue("@pw", text_changePW.Text); cmd.Parameters.AddWithValue("@id", MainForm.getID()); cmd.ExecuteNonQuery(); MessageBox.Show("변경이 완료되었습니다.\r\n다시 로그인 해 주세요"); Log.printLog("기업회원 비밀번호 변경 완료"); } catch (Exception) { Log.printLog("기업회원 비밀번호 변경 에러"); MessageBox.Show("에러"); } finally { if (sqlcon != null) { sqlcon.Close(); } Application.Exit(); } } else { MessageBox.Show("바꿀 비밀번호 확인이 맞지 않습니다. 다시 입력 해 주세요"); } } else { MessageBox.Show("비밀번호가 틀립니다. 다시 입력 해 주세요"); } } else // 개인회원 { if (text_currentPW.Text.Equals(IMemberMainForm.getPW())) // 현재 비밀번호 맞을 때 { if (text_changePW.Text.Equals(text_check.Text)) // 바꿀비밀번호와 비밀번호 체크가 맞을 때 { SqlConnection sqlcon = new SqlConnection(DBConnection.strconn); try { sqlcon.Open(); SqlCommand cmd = new SqlCommand("update CUSTOMER set PW = @pw where ID = @id", sqlcon); cmd.Parameters.AddWithValue("@pw", text_changePW.Text); cmd.Parameters.AddWithValue("@id", IMemberMainForm.getID()); cmd.ExecuteNonQuery(); MessageBox.Show("변경이 완료되었습니다.\r\n다시 로그인 해 주세요"); Log.printLog("개인회원 비밀번호 변경 완료"); } catch (Exception) { MessageBox.Show("변경에 실패했습니다."); Log.printLog("개인회원 비밀번호 변경 에러"); } finally { if (sqlcon != null) { sqlcon.Close(); } Application.Exit(); } } else { MessageBox.Show("바꿀 비밀번호 확인이 맞지 않습니다. 다시 입력 해 주세요"); } } else { MessageBox.Show("비밀번호가 틀립니다. 다시 입력 해 주세요"); } } }