Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int su = Convert.ToInt32(txtReadyTime.Text);

            if (su > 36)
            {
                txtReadyTime.Text = "";
                MessageBox.Show("36시간 보다 클 수 없습니다");
                return;
            }
            try
            {
                BorVO vo = new BorVO();
                if (cboP_Name.SelectedIndex == 0 || cboM_name.SelectedIndex == 0 ||
                    cboRoute.SelectedIndex == 0)
                {
                    MessageBox.Show("선택하지 않은 값이 있습니다");
                    this.DialogResult = DialogResult.None;
                    return;
                }
                else
                {
                    vo.bor_comment   = txtComment.Text;
                    vo.bor_readytime = Convert.ToInt32(txtReadyTime.Text);
                    vo.bor_tacktime  = Convert.ToInt32(txtTactTime.Text);
                    vo.m_id          = Convert.ToInt32(cboM_name.SelectedValue);
                    vo.bom_id        = Convert.ToInt32(cboP_Name.SelectedValue);
                    vo.bor_route     = cboRoute.SelectedValue.ToString();
                    vo.bor_yn        = cboYN.SelectedValue.ToString();
                    bool bResult = false;
                    if (mode == EditMode.Input)
                    {
                        bResult = R_survice.InsertBOR(vo);
                        if (bResult)
                        {
                            //      MessageBox.Show("등록성공");
                            this.DialogResult = DialogResult.OK;
                            return;
                        }
                        else if (!bResult)
                        {
                            //  MessageBox.Show("등록실패");
                            this.DialogResult = DialogResult.None;
                            return;
                        }
                    }
                    else if (mode == EditMode.Update)
                    {
                        vo.bor_id = Convert.ToInt32(lblID.Text);
                        bResult   = R_survice.UpdateBOR(vo);
                        if (bResult)
                        {
                            //  MessageBox.Show("수정성공");
                            this.DialogResult = DialogResult.OK;

                            return;
                        }
                        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;
            }
        }