private void SetDataBind_gridView1() { M_WsSysAuthMainDB.WsSysAuthMainDB wSvc = null; string reCode = ""; string reMsg = ""; M_WsSysAuthMainDB.DataSysAuthMainDB[] getData = null; try { wSvc = new M_WsSysAuthMainDB.WsSysAuthMainDB(); wSvc.Url = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/SysAuth/WsSysAuthMainDB.svc"; wSvc.Timeout = 1000; reCode = wSvc.sSysAuthMainDB(cmbUse.SelectedValue.ToString(), out getData, out reMsg); if (reCode == "Y") { if (getData != null && getData.Length > 0) { dataGridView1.Rows.Clear(); for (int i = 0; i < getData.Length; i++) { dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value = getData[i].AUTH_CD.ToString(); dataGridView1.Rows[i].Cells["dgv1_AUTH_NM"].Value = getData[i].AUTH_NM.ToString(); dataGridView1.Rows[i].Cells["dgv1_MYBLOCK_FLAG"].Value = getData[i].MYBLOCK_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_MYCON_FLAG"].Value = getData[i].MYCON_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_MYCOM_FLAG"].Value = getData[i].MYCOM_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_MYTEAM_FLAG"].Value = getData[i].MYTEAM_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value = getData[i].USING_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_AUTH_LEVEL"].Value = getData[i].AUTH_LEVEL.ToString(); dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value = getData[i].MEMO.ToString(); } SetRowNumber(dataGridView1); } } } catch (Exception ex) { //logs.SaveLog("[error] (page)::FrmSysCodeGrp.cs (Function)::SetDataBind_gridView1 (Detail)::pScodeGrp=[" + pScodeGrp + "]", "Error"); logs.SaveLog("[error] (page)::FrmSysAuthMainDB.cs (Function)::SetDataBind_gridView1 (Detail)::reMsg=[" + reMsg + "]", "Error"); logs.SaveLog("[error] (page)::FrmSysAuthMainDB.cs (Function)::SetDataBind_gridView1 (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }
//추가버튼 클릭 private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { string colNm = dataGridView2.Columns[e.ColumnIndex].Name; if (colNm == "dgv2_BTNADD") { string reVal = ChkDgv2Param(); if (reVal != "") { MessageBox.Show(wRM.GetString("wCheck") + " :: " + reVal); } else { string sauthCd_val = dataGridView2.Rows[0].Cells["dgv2_AUTH_CD"].Value.ToString(); string sauthNm_val = dataGridView2.Rows[0].Cells["dgv2_AUTH_NM"].Value.ToString(); string myblockFlag_val = dataGridView2.Rows[0].Cells["dgv2_MYBLOCK_FLAG"].Value.ToString(); string myconFlag_val = dataGridView2.Rows[0].Cells["dgv2_MYCON_FLAG"].Value.ToString(); string mycomFlag_val = dataGridView2.Rows[0].Cells["dgv2_MYCOM_FLAG"].Value.ToString(); string myteamFlag_val = dataGridView2.Rows[0].Cells["dgv2_MYTEAM_FLAG"].Value.ToString(); string usingFlag_val = "1"; string sauthLevel_val = dataGridView2.Rows[0].Cells["dgv2_AUTH_LEVEL"].Value.ToString(); string memo_val = ""; if (dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value != null) { memo_val = dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value.ToString(); } string pInputId = AppInfo.SsLabNo; M_WsSysAuthMainDB.WsSysAuthMainDB wSvc = null; string reCode = ""; string reMsg = ""; string reData = ""; try { wSvc = new M_WsSysAuthMainDB.WsSysAuthMainDB(); wSvc.Url = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/SysAuth/WsSysAuthMainDB.svc"; wSvc.Timeout = 1000; reCode = wSvc.exSysAuthMainDB(sauthCd_val, out reMsg, out reData); //중복 확인 if (reCode == "Y" && reData != "0") { MessageBox.Show(msgRM.GetString("msgDuplicated")); } else { reCode = ""; reCode = wSvc.aSysAuthMainDB(sauthCd_val, sauthNm_val, myblockFlag_val, myconFlag_val, mycomFlag_val, myteamFlag_val, usingFlag_val, sauthLevel_val, memo_val, pInputId, out reMsg, out reData); int reCnt = 0; if (reCode == "Y" && reData != "") { reCnt = Convert.ToInt16(reData); } if (reCnt > 0) { MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wSuccess")); } else { MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wFail")); } } SetDataBind_gridView1(); SetDataBind_gridView2(); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmSysAuthMainDB.cs (Function)::dataGridView2_CellClick (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } } } }
//수정 private void btnSave_Click(object sender, EventArgs e) { M_WsSysAuthMainDB.WsSysAuthMainDB wSvc = null; string reCode = ""; string reMsg = ""; string reData = "0"; try { wSvc = new M_WsSysAuthMainDB.WsSysAuthMainDB(); wSvc.Url = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/SysAuth/WsSysAuthMainDB.svc"; wSvc.Timeout = 1000; int reCnt = 0; for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value != null) { if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value.ToString() == "1") { reCnt++; } } } if (reCnt < 1) { MessageBox.Show(msgRM.GetString("msgNotSelected")); return; } reCnt = 0; for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value != null) { if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value != null) { if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value.ToString() == "1") { string sauthCd_val = dataGridView1.Rows[i].Cells["dgv1_AUTH_CD"].Value.ToString(); string sauthNm_val = dataGridView1.Rows[i].Cells["dgv1_AUTH_NM"].Value.ToString(); string myblockFlag_val = dataGridView1.Rows[i].Cells["dgv1_MYBLOCK_FLAG"].Value.ToString(); string myconFlag_val = dataGridView1.Rows[i].Cells["dgv1_MYCON_FLAG"].Value.ToString(); string mycomFlag_val = dataGridView1.Rows[i].Cells["dgv1_MYCOM_FLAG"].Value.ToString(); string myteamFlag_val = dataGridView1.Rows[i].Cells["dgv1_MYTEAM_FLAG"].Value.ToString(); string usingFlag_val = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString(); string sauthLevel_val = dataGridView1.Rows[i].Cells["dgv1_AUTH_LEVEL"].Value.ToString(); string memo_val = dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value.ToString(); reCode = wSvc.mSysAuthMainDB(sauthCd_val, sauthNm_val, myblockFlag_val, myconFlag_val, mycomFlag_val, myteamFlag_val, usingFlag_val, memo_val, out reMsg, out reData); } if (reCode == "Y" && reData != "0") { reCnt += Convert.ToInt16(reData); } } } } if (reCnt > 0) { MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wSuccess") + " : " + reCnt.ToString()); } else { MessageBox.Show(wRM.GetString("wSave") + " " + wRM.GetString("wFail")); } SetDataBind_gridView1(); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmSysAuthMainDB.cs (Function)::btnSave_Click (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }