private void btnSave_Click(object sender, EventArgs e) { try { if (txtCodeCompany.Text == "" || txtNameCompany.Text == "" || cboCompanyType.SelectedIndex == 0) { MessageBox.Show("필수항목이 입력되지 않았습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; return; } CompanyVO VO = new CompanyVO(); VO.company_code = txtCodeCompany.Text; VO.company_name = txtNameCompany.Text; VO.company_type = cboCompanyType.SelectedValue.ToString(); VO.company_gtype = txtGtype.Text; VO.user_id = Convert.ToInt32(cboUser.SelectedValue); VO.company_email = txtEmail.Text; VO.company_phone = txtPhone.Text; VO.company_fax = txtFax.Text; VO.company_yn = cboYN.SelectedValue.ToString(); VO.company_comment = txtComment.Text; VO.company_uadmin = txtAdmin.Text; VO.company_udate = txtUdate.Text; VO.company_cnum = txtCnum.Text; VO.company_ceo = txtCEO.Text; VO.company_btype = txtbtype.Text; bool bResult = false; if (mode == EditMode.Input) { bResult = R_service.InsertCompany(VO); if (bResult) { // MessageBox.Show("등록성공"); this.DialogResult = DialogResult.OK; } else if (!bResult) { // MessageBox.Show("등록실패"); this.DialogResult = DialogResult.None; return; } } if (mode == EditMode.Update) { VO.company_order_code = txtOrder_code.Text; VO.company_id = Convert.ToInt32(lblID.Text); bResult = R_service.UpdateCompany(VO); if (bResult) { // MessageBox.Show("수정성공"); this.DialogResult = DialogResult.OK; } else if (!bResult) { // MessageBox.Show("수정실패"); this.DialogResult = DialogResult.None; return; } } } catch (NullReferenceException err) { MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; return; } catch (Exception err) { string str = err.Message; } }