/// <summary> /// 등록 버튼 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Insert(object sender, EventArgs e) { if (((FrmMAIN)this.MdiParent).ActiveMdiChild == this) { try { FrmBOMPopUp frm = new FrmBOMPopUp(); if (frm.ShowDialog() == DialogResult.OK) { DataGridViewBinding(); } } catch (Exception err) { this.Log.WriteError($"[[RECV {this.Name}]]:{err.Message}"); } } }
/// <summary> /// 업데이트 버튼 이벤트 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void Update(object sender, EventArgs e) { if (((FrmMAIN)this.MdiParent).ActiveMdiChild == this) { try { dgvBOM.EndEdit(); int cnt = 0; int code = 0; //체크가 되었는지 확인 foreach (DataGridViewRow item in dgvBOM.Rows) { if (Convert.ToBoolean(item.Cells[1].Value)) { //MessageBox.Show(item.Cells[2].ToString()); code = Convert.ToInt32(item.Cells[2].Value); cnt++; } } if (cnt < 1) { MessageBox.Show("수정할 항목을 선택해주세요."); return; } if (cnt != 1) { MessageBox.Show("하나의 항목씩만 수정 가능 합니다."); return; } else if (cnt == 1) { FrmBOMPopUp frm = new FrmBOMPopUp(code); if (frm.ShowDialog() == DialogResult.OK) { Reset(null, null); } } } catch (Exception err) { this.Log.WriteError($"[[RECV {this.Name}]]:{err.Message}"); } } }