private void SetDataBind_treeView1() { treeView1.Nodes.Clear(); M_WsCodeTMainDB.WsCodeTMainDB wSvc = null; string reCode = ""; string reMsg = ""; M_WsCodeTMainDB.DataSysCode[] getData1 = null; M_WsCodeTMainDB.DataCodeTAuth[] getData2 = null; try { wSvc = new M_WsCodeTMainDB.WsCodeTMainDB(); wSvc.Url = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc"; wSvc.Timeout = 1000; ImageList myimageList = new ImageList(); myimageList.Images.Add(Image.FromFile(@"Image\treeicon1.png")); treeView1.ImageList = myimageList; treeView1.ImageIndex = 0; reCode = wSvc.sSysCode(out getData1, out reMsg); if (reCode == "Y") { if (getData1 != null && getData1.Length > 0) { for (int j = 0; j < getData1.Length; j++) { string sCode_val = getData1[j].SCODE.ToString(); string sCodeNm_val = getData1[j].SCODE_NM.ToString(); TreeNode root = new TreeNode(); root.Tag = "1-" + sCode_val; root.Text = sCodeNm_val; reCode = wSvc.sCodeAuthTTreeView(sCode_val, AppInfo.SsSiteCd, out getData2, out reMsg); if (reCode == "Y") { if (getData2 != null && getData2.Length > 0) { for (int k = 0; k < getData2.Length; k++) { string tcode_val = getData2[k].TCODE.ToString(); string tcodeNm_val = getData2[k].TCODE_NM.ToString(); TreeNode node2 = new TreeNode(); node2.Tag = "2-" + tcode_val; node2.Text = tcodeNm_val; root.Nodes.Add(node2); } } } treeView1.Nodes.Add(root); if (treeView1.Nodes.Count > 0) { treeView1.SelectedNode = treeView1.GetNodeAt(0, 0); } } treeView1.ExpandAll(); } } } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmCodeTAuthSite.cs (Function)::SetDataBind_treeView1 (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }