public void Insert(object sender, EventArgs e)
 {
     if (((FrmMAIN)this.MdiParent).ActiveMdiChild == this)
     {
         try
         {
             FrmFacilityChoice form = new FrmFacilityChoice();
             form.ShowDialog();
             if (form.FacilityAndGroup) //true : 설비군 팝업창 입력
             {
                 FrmFacilityGroupPopUp frm = new FrmFacilityGroupPopUp();
                 frm.FACG_LAST_MDFR = LoginInfo.UserInfo.LI_ID;
                 frm.FACG_LAST_MDFY = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                 frm.ShowDialog();
                 if (frm.DialogResult == DialogResult.OK)
                 {
                     GetFacilityGroupList();
                 }
             }
             else //false : 설비 팝업창 입력
             {
                 FrmFacilityPopUp frm = new FrmFacilityPopUp();
                 frm.FCLTS_LAST_MDFR = LoginInfo.UserInfo.LI_ID;
                 frm.FCLTS_LAST_MDFY = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                 frm.ShowDialog();
                 if (frm.DialogResult == DialogResult.OK)
                 {
                     GetFacilityList();
                 }
             }
         }
         catch (Exception err)
         {
             _logging = new LoggingUtility(this.Name, Level.Info, 30);
         }
     }
 }
        public void Update(object sender, EventArgs e)
        {
            if (((FrmMAIN)this.MdiParent).ActiveMdiChild == this)
            {
                try
                {
                    dgvFacilityGroupList.EndEdit();
                    dgvFacilityList.EndEdit();

                    FrmFacilityChoice form = new FrmFacilityChoice();
                    form.ShowDialog();
                    if (form.FacilityAndGroup) //설비군 수정
                    {
                        string sb  = string.Empty;
                        int    cnt = 0;
                        foreach (DataGridViewRow item in dgvFacilityGroupList.Rows)
                        {
                            if (Convert.ToBoolean(item.Cells[0].Value))
                            {
                                sb = item.Cells[1].Value.ToString(); //PK = 설비군코드
                                cnt++;
                            }
                        }
                        if (cnt == 1) //하나일 경우 PopUp창 띄움
                        {
                            FrmFacilityGroupPopUp frm = new FrmFacilityGroupPopUp();
                            frm.Update         = true;
                            frm.FACG_CODE      = dgvFacilityGroupList.CurrentRow.Cells[1].Value.ToString();
                            frm.FACG_NAME      = dgvFacilityGroupList.CurrentRow.Cells[2].Value.ToString();
                            frm.FACG_USE_YN    = dgvFacilityGroupList.CurrentRow.Cells[3].Value.ToString();
                            frm.FACG_LAST_MDFR = LoginInfo.UserInfo.LI_ID;
                            frm.FACG_LAST_MDFY = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                            frm.FACG_DESC      = dgvFacilityGroupList.CurrentRow.Cells[6].Value.ToString();
                            frm.ShowDialog();
                            if (frm.DialogResult == DialogResult.OK)
                            {
                                GetFacilityGroupList();
                            }
                        }
                        else
                        {
                            MessageBox.Show("하나의 항복씩만 수정 가능");
                            return;
                        }
                    }
                    else //설비 수정
                    {
                        string sb  = string.Empty;
                        int    cnt = 0;
                        foreach (DataGridViewRow item in dgvFacilityList.Rows)
                        {
                            if (Convert.ToBoolean(item.Cells[0].Value))
                            {
                                sb = item.Cells[2].Value.ToString(); //PK = 설비코드
                                cnt++;
                            }
                        }
                        if (cnt == 1)
                        {
                            FrmFacilityPopUp frm = new FrmFacilityPopUp();
                            frm.Update           = true;
                            frm.FACG_CODE        = dgvFacilityList.CurrentRow.Cells[1].Value.ToString();
                            frm.FCLTS_CODE       = dgvFacilityList.CurrentRow.Cells[2].Value.ToString();
                            frm.FCLTS_NAME       = dgvFacilityList.CurrentRow.Cells[3].Value.ToString();
                            frm.FCLTS_WRHS_EXHST = dgvFacilityList.CurrentRow.Cells[4].Value.ToString();
                            frm.FCLTS_WRHS_GOOD  = dgvFacilityList.CurrentRow.Cells[5].Value.ToString();
                            frm.FCLTS_WRHS_BAD   = dgvFacilityList.CurrentRow.Cells[6].Value.ToString();
                            frm.FCLTS_USE_YN     = dgvFacilityList.CurrentRow.Cells[7].Value.ToString();
                            frm.FCLTS_EXTRL_YN   = dgvFacilityList.CurrentRow.Cells[8].Value.ToString();
                            frm.FCLTS_LAST_MDFR  = dgvFacilityList.CurrentRow.Cells[9].Value.ToString();
                            frm.FCLTS_LAST_MDFY  = dgvFacilityList.CurrentRow.Cells[10].Value.ToString();
                            frm.FCLTS_NOTE       = dgvFacilityList.CurrentRow.Cells[11].Value.ToString();
                            frm.FCLTS_REMARK     = dgvFacilityList.CurrentRow.Cells[12].Value.ToString();
                            frm.ShowDialog();
                            if (frm.DialogResult == DialogResult.OK)
                            {
                                GetFacilityList();
                            }
                        }
                        else
                        {
                            MessageBox.Show("하나의 항복씩만 수정 가능");
                            return;
                        }
                    }
                }
                catch (Exception err)
                {
                    _logging = new LoggingUtility(this.Name, Level.Info, 30);
                }
            }
        }