public void Insert(object sender, EventArgs e)
 {
     if (((FrmMAIN)this.MdiParent).ActiveMdiChild == this)
     {
         try
         {
             FrmFactoryPopUp frm = new FrmFactoryPopUp();
             frm.FAC_LAST_MDFR = LoginInfo.UserInfo.LI_ID;
             frm.FAC_LAST_MDFY = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             frm.ShowDialog();
             if (frm.DialogResult == DialogResult.OK)
             {
                 GetFactoryInfo();
             }
         }
         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
         {
             //수정 시 여러개의 체크박스를 선택하는것을 막음
             dgvFactoryList.EndEdit();
             string sb  = string.Empty;
             int    cnt = 0;
             //체크가 되었는지 확인
             foreach (DataGridViewRow item in dgvFactoryList.Rows)
             {
                 if (Convert.ToBoolean(item.Cells[0].Value))
                 {
                     sb = item.Cells[3].Value.ToString();
                     cnt++;
                 }
             }
             if (cnt == 1) //하나일 경우 PopUp창 띄움
             {
                 FrmFactoryPopUp frm = new FrmFactoryPopUp();
                 frm.Update           = true;
                 frm.FAC_CODE         = dgvFactoryList.CurrentRow.Cells[3].Value.ToString();
                 frm.FAC_FCLTY        = dgvFactoryList.CurrentRow.Cells[1].Value.ToString();
                 frm.FAC_FCLTY_PARENT = dgvFactoryList.CurrentRow.Cells[5].Value.ToString();
                 frm.FAC_NAME         = dgvFactoryList.CurrentRow.Cells[4].Value.ToString();
                 frm.FAC_TYP          = dgvFactoryList.CurrentRow.Cells[2].Value.ToString();
                 frm.FAC_FREE_YN      = dgvFactoryList.CurrentRow.Cells[7].Value.ToString();;
                 if (dgvFactoryList.CurrentRow.Cells[8].Value == null)
                 {
                     frm.FAC_TYP_SORT = null;
                 }
                 else
                 {
                     frm.FAC_TYP_SORT = Convert.ToInt32(dgvFactoryList.CurrentRow.Cells[8].Value);
                 }
                 frm.FAC_DEMAND_YN = dgvFactoryList.CurrentRow.Cells[9].Value.ToString();
                 frm.FAC_PROCS_YN  = dgvFactoryList.CurrentRow.Cells[10].Value.ToString();
                 frm.FAC_MTRL_YN   = dgvFactoryList.CurrentRow.Cells[11].Value.ToString();
                 frm.FAC_LAST_MDFR = LoginInfo.UserInfo.LI_ID;
                 frm.FAC_LAST_MDFY = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                 frm.FAC_USE_YN    = dgvFactoryList.CurrentRow.Cells[13].Value.ToString();
                 frm.FAC_DESC      = dgvFactoryList.CurrentRow.Cells[6].Value.ToString();
                 frm.COM_CODE      = (dgvFactoryList.CurrentRow.Cells[12].Value == null) ? "" : dgvFactoryList.CurrentRow.Cells[12].Value.ToString();
                 frm.ShowDialog();
                 if (frm.DialogResult == DialogResult.OK)
                 {
                     GetFactoryInfo();
                 }
             }
             else
             {
                 MessageBox.Show("하나의 항목씩만 수정 가능");
                 return;
             }
         }
         catch (Exception err)
         {
             _logging = new LoggingUtility(this.Name, Level.Info, 30);
         }
     }
 }