private void SetDataBind_gridView1() { string searchTxt_val = ""; if (!string.IsNullOrEmpty(txtSearch.Text)) { searchTxt_val = txtSearch.Text; } Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; Mem_WsSysCompanyTeam.DataTeam[] getData = null; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.svc"; wSvc.Timeout = 1000; reCode = wSvc.sTeam(AppInfo.SsSiteCd, cmbCom.SelectedValue.ToString(), "1", searchTxt_val, 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_CHK"].Value = "0"; dataGridView1.Rows[i].Cells["dgv1_TEAM_CD"].Value = getData[i].TEAM_CD.ToString(); dataGridView1.Rows[i].Cells["dgv1_TEAM_NM"].Value = getData[i].TEAM_NM.ToString(); dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value = getData[i].USING_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value = getData[i].SORT_NO.ToString(); dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value = getData[i].MEMO.ToString(); } SetRowNumber(dataGridView1); } else { dataGridView1.Rows.Clear(); //MessageBox.Show("데이터가 없습니다"); } } } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmSysCode.cs (Function)::SetDataBind_gridView1 (Detail)::reMsg=[" + reMsg + "]", "Error"); logs.SaveLog("[error] (page)::FrmSysCode.cs (Function)::SetDataBind_gridView1 (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }
private void set_Grideview2Combo2(int rnum, string column_name) { Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; Mem_WsSysCompanyTeam.DataCotypeCmb2[] getData = null; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.svc"; wSvc.Timeout = 1000; reCode = wSvc.cotype_Cmb2(out getData, out reMsg); if (reCode == "Y") { if (getData != null && getData.Length > 0) { Class.Common.ComboBoxItemSet setCmb = null; setCmb = new Class.Common.ComboBoxItemSet(); setCmb.AddColumn(); for (int i = 0; i < getData.Length; i++) { setCmb.AddRow(getData[i].SCODE_NM.ToString(), getData[i].SCODE.ToString()); } DataGridViewComboBoxCell cotype_Combo1 = new DataGridViewComboBoxCell(); cotype_Combo1.DisplayMember = "TEXT"; cotype_Combo1.ValueMember = "VALUE"; cotype_Combo1.DataSource = setCmb.GetDataTable(); dataGridView2.Rows[rnum].Cells[column_name] = cotype_Combo1; } } } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmCompany.cs (Function)::set_Grideview1Combo2 (Detail):: " + "\r\n" + ex.ToString()); } }
//업체 콤보 박스 private void SetDataBind_CompanyCmb() { Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; Mem_WsSysCompanyTeam.DataCompanyCmb[] getData = null; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.svc"; wSvc.Timeout = 1000; reCode = wSvc.companyCmb(AppInfo.SsSiteCd, out getData, out reMsg); if (reCode == "Y") { if (getData != null && getData.Length > 0) { Class.Common.ComboBoxItemSet setCmb = null; setCmb = new Class.Common.ComboBoxItemSet(); setCmb.AddColumn(); for (int i = 0; i < getData.Length; i++) { setCmb.AddRow(getData[i].CO_NM.ToString(), getData[i].CO_CD.ToString()); } setCmb.Bind(cmbCom); } } } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmSite.cs (Function)::SetDataBind_CmbMember (Detail):: " + "\r\n" + ex.ToString()); } }
//INSERT WITH PROCEDURE 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 pSiteCd = AppInfo.SsSiteCd; string pCoCd = cmbCom.SelectedValue.ToString(); string pTeamNm = dataGridView2.Rows[0].Cells["dgv2_TEAM_NM"].Value.ToString(); string pSortNo = "10"; if (dataGridView2.Rows[0].Cells["dgv2_SORT_NO"].Value != null) { pSortNo = dataGridView2.Rows[0].Cells["dgv2_SORT_NO"].Value.ToString(); } string pMemo = ""; if (dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value != null) { pMemo = dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value.ToString(); } string pInputId = AppInfo.SsLabNo; Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; string reData = ""; int reCnt = 0; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.svc"; wSvc.Timeout = 1000; string[] param = new string[6]; param[0] = pSiteCd; param[1] = pCoCd; param[2] = pTeamNm; param[3] = pMemo; param[4] = pSortNo; param[5] = pInputId; //INSERT WITH PROCEDURE reCode = wSvc.aTeamPro(AppInfo.SsDbNm, param, out reData, out reMsg); 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_grideView2(); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmTeam.cs (Function)::dataGridView2_CellClick (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } } } }
//수정 private void btnSave_Click(object sender, EventArgs e) { Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; string reData = "0"; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.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(wRM.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 pTeamCd = dataGridView1.Rows[i].Cells["dgv1_TEAM_CD"].Value.ToString(); string pTeamNm = dataGridView1.Rows[i].Cells["dgv1_TEAM_NM"].Value.ToString(); string pUsingFlag = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString(); string pSortNo = "10"; if (dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value != null) { pSortNo = dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value.ToString(); } string pMemo = ""; if (dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value != null) { pMemo = dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value.ToString(); } string pInputId = AppInfo.SsLabNo; string pSiteCd = AppInfo.SsSiteCd; reCode = wSvc.mTeamMemco(pSiteCd, pTeamCd, pTeamNm, pUsingFlag, pSortNo, pMemo, out reMsg, out reData); if (reCode == "Y" && reData != "0") { 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(); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmTeam.cs (Function)::btnSave_Click (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 pCoNm = dataGridView2.Rows[0].Cells["dgv2_CO_NM"].Value.ToString(); string pBizNo = ""; if (dataGridView2.Rows[0].Cells["dgv2_BIZ_NO"].Value != null) { pBizNo = dataGridView2.Rows[0].Cells["dgv2_BIZ_NO"].Value.ToString(); } string pConstCcd = dataGridView2.Rows[0].Cells["dgv2_CONST_CCD"].Value.ToString(); string pCoTypeScd = dataGridView2.Rows[0].Cells["dgv2_CO_TYPE_SCD"].Value.ToString(); string pStartDate = DateTime.Now.ToString("yyyyMMdd"); string pEndDate = DateTime.Now.AddYears(1).ToString("yyyyMMdd"); string pOwnerNm = ""; if (dataGridView2.Rows[0].Cells["dgv2_OWNER_NM"].Value != null) { pOwnerNm = dataGridView2.Rows[0].Cells["dgv2_OWNER_NM"].Value.ToString(); } string pTel = ""; if (dataGridView2.Rows[0].Cells["dgv2_TEL"].Value != null) { pTel = dataGridView2.Rows[0].Cells["dgv2_TEL"].Value.ToString(); } string pAddr = ""; if (dataGridView2.Rows[0].Cells["dgv2_ADDR"].Value != null) { pAddr = dataGridView2.Rows[0].Cells["dgv2_ADDR"].Value.ToString(); } string pSortNo = "1"; if (dataGridView2.Rows[0].Cells["dgv2_SORT_NO"].Value != null) { pSortNo = dataGridView2.Rows[0].Cells["dgv2_SORT_NO"].Value.ToString(); } string pMemo = ""; if (dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value != null) { pMemo = dataGridView2.Rows[0].Cells["dgv2_MEMO"].Value.ToString(); } string pInputId = AppInfo.SsLabNo; Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; string reData = ""; int reCnt = 0; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.svc"; wSvc.Timeout = 1000; string[] param = new string[13]; param[0] = AppInfo.SsSiteCd; param[1] = pCoNm; param[2] = pBizNo; param[3] = pConstCcd; param[4] = pCoTypeScd; param[5] = pOwnerNm; param[6] = pTel; param[7] = pAddr; param[8] = pStartDate; param[9] = pEndDate; param[10] = pMemo; param[11] = pSortNo; param[12] = pInputId; //INSERT WITH PROCEDURE reCode = wSvc.aCompanyPro(AppInfo.SsDbNm, param, out reData, out reMsg); 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_grideView2(); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmCompany.cs (Function)::dataGridView2_CellClick (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } } } }
//수정 private void btnSave_Click(object sender, EventArgs e) { Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; string reData = "0"; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.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 pCoCd = dataGridView1.Rows[i].Cells["dgv1_CO_CD"].Value.ToString(); string pCoNm = dataGridView1.Rows[i].Cells["dgv1_CO_NM"].Value.ToString(); string pUsingFlag = dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value.ToString(); string pHeadcoCd = ""; if (dataGridView1.Rows[i].Cells["dgv1_HEADCO_CD"].Value != null) { pHeadcoCd = dataGridView1.Rows[i].Cells["dgv1_HEADCO_CD"].Value.ToString(); } string pConstCcd = dataGridView1.Rows[i].Cells["dgv1_CONST_CCD"].Value.ToString(); string pCoTypeScd = dataGridView1.Rows[i].Cells["dgv1_CO_TYPE_SCD"].Value.ToString(); string pSiteCd = dataGridView1.Rows[i].Cells["dgv1_SITE_CD"].Value.ToString(); string pStartDate = Convert.ToDateTime(dataGridView1.Rows[i].Cells["dgv1_START_DATE"].Value).ToString("yyyyMMdd"); string pEndDate = Convert.ToDateTime(dataGridView1.Rows[i].Cells["dgv1_END_DATE"].Value).ToString("yyyyMMdd"); string pBizNo = ""; if (dataGridView1.Rows[i].Cells["dgv1_BIZ_NO"].Value != null) { pBizNo = dataGridView1.Rows[i].Cells["dgv1_BIZ_NO"].Value.ToString(); } string pOwnerNm = ""; if (dataGridView1.Rows[i].Cells["dgv1_OWNER_NM"].Value != null) { pOwnerNm = dataGridView1.Rows[i].Cells["dgv1_OWNER_NM"].Value.ToString(); } string pTel = ""; if (dataGridView1.Rows[i].Cells["dgv1_TEL"].Value != null) { pTel = dataGridView1.Rows[i].Cells["dgv1_TEL"].Value.ToString(); } string pAddr = ""; if (dataGridView1.Rows[i].Cells["dgv1_ADDR"].Value != null) { pAddr = dataGridView1.Rows[i].Cells["dgv1_ADDR"].Value.ToString(); } string pUsingCnt = dataGridView1.Rows[i].Cells["dgv1_USING_CNT"].Value.ToString(); string pSortNo = "10"; if (dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value != null) { pSortNo = dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value.ToString(); } string pMemo = ""; if (dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value != null) { pMemo = dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value.ToString(); } string pInputId = AppInfo.SsLabNo; int updatefail = 0; //MAIN DB UPDATE reCode = wSvc.mCompanyMain(pCoCd, pCoNm, pBizNo, pConstCcd, pCoTypeScd, pOwnerNm, pTel, pAddr, out reMsg, out reData); //MAIN DB LOG UPDATE reCode = wSvc.mConpanyMainLog(pCoCd, pCoNm, pBizNo, pConstCcd, pCoTypeScd, pOwnerNm, pTel, pAddr, pUsingCnt, pInputId, out reMsg, out reData); //MEMCO DB UPDATE reCode = wSvc.mCompanyMemco(pSiteCd, pCoCd, pCoNm, pHeadcoCd, pConstCcd, pCoTypeScd, pSortNo, out reMsg, out reData); //MEMCO DB COMPANY SITE UPDATE reCode = wSvc.mCompanyMemcoSite(pSiteCd, pCoCd, pStartDate, pEndDate, pUsingFlag, pSortNo, pMemo, out reMsg, out reData); if (reCode == "Y" && reData == "0") { //MEMCO DB COMPANY SITE INSERT reCode = wSvc.aCompanyMemcoSite(pSiteCd, pCoCd, pStartDate, pEndDate, pUsingFlag, pSortNo, pMemo, pInputId, out reMsg, out reData); //MEMCO DB COMPANY SITE LOG INSERT reCode = wSvc.mCompanySiteLog(pCoCd, pSiteCd, pCoNm, pConstCcd, pCoTypeScd, pStartDate, pEndDate, pUsingFlag, pSortNo, pMemo, pInputId, out reMsg, out reData); updatefail++; } //MEMCO DB COMPANY SITE LOG INSERT if (updatefail == 0) { reCode = wSvc.mCompanySiteLog(pCoCd, pSiteCd, pCoNm, pConstCcd, pCoTypeScd, pStartDate, pEndDate, pUsingFlag, pSortNo, pMemo, pInputId, out reMsg, out reData); } if (reCode == "Y" && reData != "0") { 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(); } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmCompany.cs (Function)::btnSave_Click (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }
private void SetDataBind_gridView1() { string searchTxt_val = ""; if (!string.IsNullOrEmpty(txtSearch.Text)) { searchTxt_val = txtSearch.Text; } Mem_WsSysCompanyTeam.WsSysCompanyTeam wSvc = null; string reCode = ""; string reMsg = ""; Mem_WsSysCompanyTeam.DataCompany[] getData = null; try { wSvc = new Mem_WsSysCompanyTeam.WsSysCompanyTeam(); wSvc.Url = "http://" + AppInfo.SsWsvcServer1 + "/WebSvc/Sys/CompanyTeam/WsSysCompanyTeam.svc"; wSvc.Timeout = 1000; reCode = wSvc.sCompany(AppInfo.SsSiteCd, cmbUse.SelectedValue.ToString(), searchTxt_val, 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_CHK"].Value = "0"; dataGridView1.Rows[i].Cells["dgv1_CO_CD"].Value = getData[i].CO_CD.ToString(); dataGridView1.Rows[i].Cells["dgv1_CO_NM"].Value = getData[i].CO_NM.ToString(); dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value = getData[i].USING_FLAG.ToString(); dataGridView1.Rows[i].Cells["dgv1_HEADCO_CD"].Value = getData[i].HEADCO_CD.ToString(); set_Grideview1Combo1(i, "dgv1_CONST_CCD"); dataGridView1.Rows[i].Cells["dgv1_CONST_CCD"].Value = getData[i].CONST_CCD.ToString(); set_Grideview1Combo2(i, "dgv1_CO_TYPE_SCD"); dataGridView1.Rows[i].Cells["dgv1_CO_TYPE_SCD"].Value = getData[i].CO_TYPE_SCD.ToString(); dataGridView1.Rows[i].Cells["dgv1_SITE_CD"].Value = getData[i].SITE_CD.ToString(); string startDt = getData[i].START_DATE.ToString(); DateTime start_dt = Convert.ToDateTime(startDt.Substring(0, 4) + "-" + startDt.Substring(4, 2) + "-" + startDt.Substring(6)); dataGridView1.Rows[i].Cells["dgv1_START_DATE"].Value = start_dt; string endDt = getData[i].END_DATE.ToString(); DateTime end_dt = Convert.ToDateTime(startDt.Substring(0, 4) + "-" + startDt.Substring(4, 2) + "-" + startDt.Substring(6)); dataGridView1.Rows[i].Cells["dgv1_END_DATE"].Value = end_dt; dataGridView1.Rows[i].Cells["dgv1_BIZ_NO"].Value = getData[i].BIZ_NO.ToString(); dataGridView1.Rows[i].Cells["dgv1_OWNER_NM"].Value = getData[i].OWNER_NM.ToString(); dataGridView1.Rows[i].Cells["dgv1_TEL"].Value = getData[i].TEL.ToString(); dataGridView1.Rows[i].Cells["dgv1_ADDR"].Value = getData[i].ADDR.ToString(); dataGridView1.Rows[i].Cells["dgv1_USING_CNT"].Value = getData[i].USING_CNT.ToString(); dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value = getData[i].SORT_NO.ToString(); dataGridView1.Rows[i].Cells["dgv1_MEMO"].Value = getData[i].MEMO.ToString(); } SetRowNumber(dataGridView1); } else { dataGridView1.Rows.Clear(); //MessageBox.Show("데이터가 없습니다"); } } } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmSysCode.cs (Function)::SetDataBind_gridView1 (Detail)::reMsg=[" + reMsg + "]", "Error"); logs.SaveLog("[error] (page)::FrmSysCode.cs (Function)::SetDataBind_gridView1 (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }