예제 #1
0
        private void Haccp_Input(DataGridView ccpChkGrid)
        {
            try
            {
                for (int i = 0; i < ccpChkGrid.Rows.Count; i++)
                {
                    if (ccpChkGrid.Rows[i].Cells["YES"].Value.ToString().Equals("False") && ccpChkGrid.Rows[i].Cells["NO"].Value.ToString().Equals("False"))
                    {
                        MessageBox.Show("모든 체크항목에 체크해주십시오.");
                        return;
                    }
                }



                wnDm wDm   = new wnDm();
                int  rsNum = 1;
                if (lbl_input_gubun.Text.Equals(""))
                {
                    rsNum = wDm.Insert_Haccp_Input(txt_chk_date.Text, txt_comment.Text, ccpChkGrid);
                }
                else
                {
                    rsNum = wDm.Update_Haccp_Input(
                        txt_chk_date.Text
                        , txt_input_cd.Text
                        , txt_comment.Text
                        , ccpChkGrid);
                }

                if (rsNum == 0)
                {
                    if (lbl_input_gubun.Text.Equals(""))
                    {
                        resetSetting();
                        input_list(dataCcpGrid, "where A.INPUT_DATE >= '" + start_date.Text.ToString() + "' and  A.INPUT_DATE <= '" + end_date.Text.ToString() + "'");
                        MessageBox.Show("성공적으로 등록하였습니다.");
                    }
                    else
                    {
                        resetSetting();
                        //input_list(tdInputGrid, "where convert(varchar(10), A.INTIME, 120) = convert(varchar(10), getDate(), 120) ");
                        input_list(dataCcpGrid, "where A.INPUT_DATE >= '" + start_date.Text.ToString() + "' and  A.INPUT_DATE <= '" + end_date.Text.ToString() + "'");
                        MessageBox.Show("성공적으로 수정하였습니다.");
                    }
                }
                else if (rsNum == 1)
                {
                    MessageBox.Show("저장에 실패하였습니다");
                }
                else if (rsNum == 2)
                {
                    MessageBox.Show("SQL COMMAND 에러");
                }
                else if (rsNum == 3)
                {
                    MessageBox.Show("기존 코드가 있으니 \n 다른 코드로 입력 바랍니다.");
                }
                else
                {
                    MessageBox.Show("Exception 에러");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("시스템 에러: " + e.Message.ToString());
                Popup.pop오류리포트 msg = new Popup.pop오류리포트(e.Message + " - " + e.ToString());
                msg.ShowDialog();
            }
        }