private void HaccpGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            dgvTemp.ReadOnly = true;
            dgvTemp.BeginEdit(false);
            dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly = true;

            if (dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null)
            {
                dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "";
            }
            if (dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Equals(oldEditTemp))
            {
                dgvTemp.BeginInvoke(new MethodInvoker(() =>
                {
                    fn_insert_list("where STAFF_CD = '" + txt_staff_cd.Text + "'  and INPUT_DATE >= '" + txt_lower_date.Text + "' and INPUT_DATE <= '" + txt_upper_date.Text + "' "
                                   + ((txt_docs_srch.Text == null || txt_docs_srch.Text.ToString().Equals("")) ? "" : "and FNAME like '%" + txt_docs_srch.Text.ToString() + "%'  "));
                }));
                return;
            }
            if (e.ColumnIndex == 0)
            {
                if (!System.Text.RegularExpressions.Regex.IsMatch(dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), "[0-9]{4}-[0-9]{2}-[0-9]{2}") || dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString().Length != 10)
                {
                    MessageBox.Show("날짜입력양식이 형식과 맞지 않습니다.\n올바른 양식 : YYYY-MM-DD");
                    dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = pathTemp;
                    dgvTemp.BeginInvoke(new MethodInvoker(() =>
                    {
                        fn_insert_list("where STAFF_CD = '" + txt_staff_cd.Text + "'  and INPUT_DATE >= '" + txt_lower_date.Text + "' and INPUT_DATE <= '" + txt_upper_date.Text + "' "
                                       + ((txt_docs_srch.Text == null || txt_docs_srch.Text.ToString().Equals("")) ? "" : "and FNAME like '%" + txt_docs_srch.Text.ToString() + "%'  "));
                    }));
                    return;
                }
            }



            try
            {
                wnDm wDm = new wnDm();

                int rst = -1;

                switch (e.ColumnIndex)
                {
                case 0:
                    rst = wDm.Update_Haccp_Docs("INPUT_DATE", dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), pathTemp, txt_staff_cd.Text);
                    break;

                case 2:
                    rst = wDm.Update_Haccp_Docs("COMMENT", dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), pathTemp, txt_staff_cd.Text);
                    break;

                case 3:
                    rst = wDm.Update_Haccp_Docs("FNAME", dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), pathTemp, txt_staff_cd.Text);
                    break;

                case 4:
                    rst = wDm.Update_Haccp_Docs("DOCPATH", dgvTemp.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), pathTemp, txt_staff_cd.Text);
                    break;
                }
                if (rst == 0)
                {
                    MessageBox.Show("성공적으로 수정하였습니다!");
                    dgvTemp.BeginInvoke(new MethodInvoker(() =>
                    {
                        fn_insert_list("where STAFF_CD = '" + txt_staff_cd.Text + "'  and INPUT_DATE >= '" + txt_lower_date.Text + "' and INPUT_DATE <= '" + txt_upper_date.Text + "' "
                                       + ((txt_docs_srch.Text == null || txt_docs_srch.Text.ToString().Equals("")) ? "" : "and FNAME like '%" + txt_docs_srch.Text.ToString() + "%'  "));
                    }));

                    return;
                }
                else if (rst == 1)
                {
                    MessageBox.Show("수정에 실패하였습니다.");
                    dgvTemp.BeginInvoke(new MethodInvoker(() =>
                    {
                        fn_insert_list("where STAFF_CD = '" + txt_staff_cd.Text + "'  and INPUT_DATE >= '" + txt_lower_date.Text + "' and INPUT_DATE <= '" + txt_upper_date.Text + "' "
                                       + ((txt_docs_srch.Text == null || txt_docs_srch.Text.ToString().Equals("")) ? "" : "and FNAME like '%" + txt_docs_srch.Text.ToString() + "%'  "));
                    }));
                }
                else if (rst == 9)
                {
                    MessageBox.Show("데이터베이스 오류발생");
                    dgvTemp.BeginInvoke(new MethodInvoker(() =>
                    {
                        fn_insert_list("where STAFF_CD = '" + txt_staff_cd.Text + "'  and INPUT_DATE >= '" + txt_lower_date.Text + "' and INPUT_DATE <= '" + txt_upper_date.Text + "' "
                                       + ((txt_docs_srch.Text == null || txt_docs_srch.Text.ToString().Equals("")) ? "" : "and FNAME like '%" + txt_docs_srch.Text.ToString() + "%'  "));
                    }));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("시스템오류발생");
                dgvTemp.BeginInvoke(new MethodInvoker(() =>
                {
                    fn_insert_list("where STAFF_CD = '" + txt_staff_cd.Text + "'  and INPUT_DATE >= '" + txt_lower_date.Text + "' and INPUT_DATE <= '" + txt_upper_date.Text + "' "
                                   + ((txt_docs_srch.Text == null || txt_docs_srch.Text.ToString().Equals("")) ? "" : "and FNAME like '%" + txt_docs_srch.Text.ToString() + "%'  "));
                }));
            }
        }