Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ResourceService R_Service = new ResourceService();
                MachineGradeVO  VO        = new MachineGradeVO();
                try
                {
                    VO.mgrade_name    = txtMgrade_name.Text;
                    VO.mgrade_code    = txtMgrade_code.Text;
                    VO.mgrade_yn      = cboYN.SelectedValue.ToString();
                    VO.mgrade_udate   = txtMgrade_udate.Text;
                    VO.mgrade_uadmin  = txtMgrade_uadmin.Text;
                    VO.mgrade_comment = txtMgrade_comment.Text;

                    if (mode == EditMode.Input)
                    {
                        bool bResult = R_Service.InsertMachineGr(VO);
                        if (bResult)
                        {
                            MessageBox.Show("등록성공");
                            this.DialogResult = DialogResult.OK;
                        }
                        else if (!bResult)
                        {
                            MessageBox.Show("등록실패");
                            this.DialogResult = DialogResult.None;
                            return;
                        }
                    }
                    else if (mode == EditMode.Update)
                    {
                        VO.mgrade_id = Convert.ToInt32(lblID.Text);
                        bool bResult = R_Service.UpdateMachineGr(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;
                    return;
                }
            }
            catch (NullReferenceException err)
            {
                MessageBox.Show("입력되지 않은값이 있습니다, 다시 확인해주세요", "입력확인", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                return;
            }
            catch (Exception err)
            {
                string str = err.Message;
            }
        }