private void checkPost() { while (true) { if (String.IsNullOrEmpty(Menu1.getSbj()) || String.IsNullOrWhiteSpace(Menu1.getSbj()) || String.IsNullOrEmpty(Menu1.getField()) || String.IsNullOrWhiteSpace(Menu1.getField()) || String.IsNullOrEmpty(Menu1.getPay()) || String.IsNullOrWhiteSpace(Menu1.getPay()) || String.IsNullOrEmpty(Menu1.getPlace()) || String.IsNullOrWhiteSpace(Menu1.getPlace())) { MessageBox.Show("텍스트 박스에 문자를 삽입하여 주세요"); break; } /* * if (Menu1.getStart().Date == Menu1.getFinish().Date || Menu1.getStart().Date == Menu1.getDead().Date) * { * MessageBox.Show("날짜를 입력하세요"); * break; * }*/ else { insertData(); break; } } }
private void insertData() { SqlConnection sqlconn = new SqlConnection(strConn); try { //쿼리문에서 COUNT랑 A_COUNT를 0으로 시작해야 조회및 지원수 자동증가가능 sqlconn.Open(); string cmdText = "Insert Into RECRUIT (W_NUM,ID,NAME,SUBJECT,COM_NAME,FIELD, PAY, W_PLACE," + "W_DATE, PERIOD, W_CONTENT, COUNT, A_COUNT) VALUES(NEXT VALUE FOR W_NUMBER,@id,@name,@sbj,@com_name,@field,@pay,@w_place,@time,@dead,@w_content,0,0)"; SqlCommand cmd = new SqlCommand(cmdText, sqlconn); int intPay = Convert.ToInt32(Menu1.getPay()); cmd.Parameters.AddWithValue("@id", MainForm.getID()); cmd.Parameters.AddWithValue("@name", MainForm.getName()); cmd.Parameters.AddWithValue("@sbj", Menu1.getSbj()); cmd.Parameters.AddWithValue("@com_name", MainForm.getCom_name()); cmd.Parameters.AddWithValue("@field", Menu1.getField()); cmd.Parameters.AddWithValue("@pay", (intPay * 10000)); //cmd.Parameters.AddWithValue("@start", Menu1.getStart()); //cmd.Parameters.AddWithValue("@finish", Menu1.getFinish()); cmd.Parameters.AddWithValue("@w_place", Menu1.getPlace()); cmd.Parameters.AddWithValue("@time", DateTime.Now); cmd.Parameters.AddWithValue("@dead", Menu1.getDead()); cmd.Parameters.AddWithValue("@w_content", Menu1.getContent()); cmd.ExecuteNonQuery(); onYesExit(); } catch (Exception ee) { Log.printLog("공고 등록 오류"); MessageBox.Show(ee.Message); MessageBox.Show(ee.StackTrace); } finally { sqlconn.Close(); } }