public void btnSave_Click(object sender, EventArgs e) { M_WsCodeTMainDB.WsCodeTMainDB wSvc = null; string reCode = ""; string reMsg = ""; string reData = ""; try { wSvc = new M_WsCodeTMainDB.WsCodeTMainDB(); wSvc.Url = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.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_CHK"].Value != null) { if (dataGridView1.Rows[i].Cells["dgv1_CHK"].Value.ToString() == "1") { string tcode_val = dataGridView1.Rows[i].Cells["dgv1_TCODE"].Value.ToString(); string defaultValue_val = ""; if (dataGridView1.Rows[i].Cells["dgv1_DEFAULT_VALUE"].Value != null) { defaultValue_val = dataGridView1.Rows[i].Cells["dgv1_DEFAULT_VALUE"].Value.ToString(); } string usingFlag_val = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString(); string sortNo_val = ""; if (dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value != null) { sortNo_val = dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value.ToString(); } string memo_val = ""; if (dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value != null) { memo_val = dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value.ToString(); } reCode = wSvc.mCodeTSite(AppInfo.SsDbNm, AppInfo.SsSiteCd, tcode_val, defaultValue_val, usingFlag_val, sortNo_val, memo_val, out reMsg, out reData); if (reCode == "Y") { reCode = wSvc.aCodeTSiteLog(AppInfo.SsDbNm, AppInfo.SsSiteCd, tcode_val, _ccode, "0", "0", defaultValue_val, usingFlag_val, sortNo_val, memo_val, AppInfo.SsLabNo, out reMsg, out reData); if (reCode == "N") { MessageBox.Show(wRM.GetString("wLog ") + wRM.GetString("wSave") + wRM.GetString("wFail")); } } if (reCode == "Y" && reData != "") { 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(_ccode); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmCodeTSite.cs (Function)::btnSave_Click (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }