private void btnAdd_Click(object sender, EventArgs e) { try { if (lblID1.Text != "") { FacilitieInfoPop frm = new FacilitieInfoPop (FacilitieInfoPop.EditMode.Input, dataGridView1.CurrentRow.Cells[1].Value.ToString(), lblID1.Text); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); SetBottomStatusLabel("신규 설비 등록 성공"); } } else if (lblID1.Text == "") { MessageBox.Show("설비군을 선택해주세요"); } SetBottomStatusLabel("선택된 설비군이 없습니다"); } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (lblID2.Text == "") { SetBottomStatusLabel("선택된 설비가 없습니다"); MessageBox.Show("변경할 설비를 선택해주세요"); return; } else { if (dataGridView2.Rows.Count > 0) { DataGridViewRow rows = dataGridView2.CurrentRow; MachineVO VO = new MachineVO(); VO.m_id = Convert.ToInt32(rows.Cells[0].Value.ToString()); VO.mgrade_code = rows.Cells[2].Value.ToString(); VO.mgrade_id = Convert.ToInt32(rows.Cells[1].Value); VO.m_code = rows.Cells[3].Value.ToString(); VO.m_name = rows.Cells[4].Value.ToString(); VO.m_use_sector = rows.Cells[5].Value.ToString(); VO.m_ok_sector = rows.Cells[6].Value.ToString(); if (rows.Cells[7].Value == null) { VO.m_ng_sector = ""; } else { VO.m_ng_sector = rows.Cells[7].Value.ToString(); } VO.m_yn = rows.Cells[11].Value.ToString(); VO.m_os_yn = rows.Cells[8].Value.ToString(); VO.m_uadmin = rows.Cells[12].Value.ToString(); VO.m_udate = string.Format("{0:yyyy-MM-dd HH:mm:ss}", today); if (rows.Cells[9].Value == null) { VO.m_check = ""; } else { VO.m_check = rows.Cells[9].Value.ToString(); } VO.m_comment = rows.Cells[10].Value.ToString(); FacilitieInfoPop frm = new FacilitieInfoPop(FacilitieInfoPop.EditMode.Update, VO); if (frm.ShowDialog() == DialogResult.OK) { LoadData(); SetBottomStatusLabel("설비 정보 수정 성공"); MessageBox.Show("설비 정보 수정 성공"); } } } } catch (Exception err) { LoggingUtility.GetLoggingUtility(err.Message, Level.Error); } }