예제 #1
0
        private void SetDataBind_treeView1()
        {
            treeView1.Nodes.Clear();

            M_WsMenuMainDB.WsMenuMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsMenuMainDB.DataMenuTop[] getData1 = null;
            M_WsMenuMainDB.DataMenuSub[] getData2 = null;
            try
            {
                wSvc         = new M_WsMenuMainDB.WsMenuMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/Menu/WsMenuMainDB.svc";
                wSvc.Timeout = 1000;

                ImageList myimageList = new ImageList();
                myimageList.Images.Add(Image.FromFile(@"Image\treeicon1.png"));

                treeView1.ImageList  = myimageList;
                treeView1.ImageIndex = 0;

                reCode = wSvc.sMenuTopTreeView(out getData1, out reMsg);
                if (reCode == "Y")
                {
                    if (getData1 != null && getData1.Length > 0)
                    {
                        for (int i = 0; i < getData1.Length; i++)
                        {
                            string tmenuCd_val = getData1[i].TOP_MENU_CD.ToString();
                            string tmenuNm_val = getData1[i].TOP_MENU_NM.ToString();

                            TreeNode root = new TreeNode();
                            root.Tag  = "1-" + tmenuCd_val + "-0";
                            root.Text = tmenuNm_val;

                            reCode = wSvc.sMenuSubTreeView(tmenuCd_val, out getData2, out reMsg);
                            if (reCode == "Y")
                            {
                                if (getData2 != null && getData2.Length > 0)
                                {
                                    for (int j = 0; j < getData2.Length; j++)
                                    {
                                        string smenuCd_val = getData2[j].SUB_MENU_CD.ToString();
                                        string smenuNm_val = getData2[j].SUB_MENU_NM.ToString();

                                        TreeNode node2 = new TreeNode();
                                        node2.Tag  = "2-" + tmenuCd_val + "-" + smenuCd_val;
                                        node2.Text = smenuNm_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)::FrmMenuMainDB.cs  (Function)::SetDataBind_treeView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }
예제 #2
0
        private void SetDataBind_gridView1(string code_grp, string tmenuCd, string smenuCd)
        {
            SetDataBind_grideView2();

            M_WsMenuMainDB.WsMenuMainDB wSvc = null;
            string reCode = "";
            string reMsg  = "";

            M_WsMenuMainDB.DataMenuSub[] getData2 = null;
            M_WsMenuMainDB.DataMenu[]    getData3 = null;

            try
            {
                wSvc         = new M_WsMenuMainDB.WsMenuMainDB();
                wSvc.Url     = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/Menu/WsMenuMainDB.svc";
                wSvc.Timeout = 1000;

                if (code_grp == "1")
                {
                    dataGridView1.Columns["dgv1_APP_FLAG"].Visible    = false;
                    dataGridView1.Columns["dgv1_MENU_CD"].Visible     = false;
                    dataGridView2.Columns["dgv2_MENU_CD"].Visible     = false;
                    dataGridView1.Columns["dgv1_MENU_PATH"].Visible   = false;
                    dataGridView1.Columns["dgv1_FILE_FOLDER"].Visible = false;
                    dataGridView2.Columns["dgv2_MENU_PATH"].Visible   = false;
                    dataGridView2.Columns["dgv2_FILE_FOLDER"].Visible = false;

                    dataGridView1.Columns["dgv1_TOP_MENU_CD"].ReadOnly = true;
                    dataGridView1.Columns["dgv1_SUB_MENU_CD"].ReadOnly = true;
                    dataGridView1.Columns["dgv1_NM"].ReadOnly          = true;

                    reCode = wSvc.sMenuSubTreeView(tmenuCd, out getData2, out reMsg);
                    if (reCode == "Y")
                    {
                        if (getData2 != null && getData2.Length > 0)
                        {
                            dataGridView1.Rows.Clear();
                            for (int i = 0; i < getData2.Length; i++)
                            {
                                dataGridView1.Rows.Add();
                                dataGridView1.Rows[i].Cells["dgv1_SUB_MENU_CD"].Value = getData2[i].SUB_MENU_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_TOP_MENU_CD"].Value = getData2[i].TOP_MENU_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_NM"].Value          = getData2[i].SUB_MENU_NM.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value  = getData2[i].USING_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value     = getData2[i].SORT_NO.ToString();
                            }

                            SetRowNumber(dataGridView1);
                        }
                        else
                        {
                            dataGridView1.Rows.Clear();
                            //MessageBox.Show("데이터가 없습니다");
                        }
                    }
                }
                else if (code_grp == "2")
                {
                    dataGridView1.Columns["dgv1_APP_FLAG"].Visible    = false;
                    dataGridView1.Columns["dgv1_MENU_CD"].Visible     = true;
                    dataGridView2.Columns["dgv2_MENU_CD"].Visible     = true;
                    dataGridView1.Columns["dgv1_MENU_PATH"].Visible   = true;
                    dataGridView1.Columns["dgv1_FILE_FOLDER"].Visible = true;
                    dataGridView2.Columns["dgv2_MENU_PATH"].Visible   = true;
                    dataGridView2.Columns["dgv2_FILE_FOLDER"].Visible = true;

                    dataGridView1.Columns["dgv1_TOP_MENU_CD"].ReadOnly = true;
                    dataGridView1.Columns["dgv1_SUB_MENU_CD"].ReadOnly = true;
                    dataGridView1.Columns["dgv1_MENU_CD"].ReadOnly     = true;
                    dataGridView2.Columns["dgv2_MENU_CD"].ReadOnly     = false;
                    dataGridView1.Columns["dgv1_NM"].ReadOnly          = true;


                    reCode = wSvc.sMenuTreeView(tmenuCd, smenuCd, out getData3, out reMsg);
                    if (reCode == "Y")
                    {
                        if (getData3 != null && getData3.Length > 0)
                        {
                            dataGridView1.Rows.Clear();

                            for (int i = 0; i < getData3.Length; i++)
                            {
                                dataGridView1.Rows.Add();
                                dataGridView1.Rows[i].Cells["dgv1_MENU_CD"].Value     = getData3[i].MENU_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_TOP_MENU_CD"].Value = getData3[i].TOP_MENU_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_SUB_MENU_CD"].Value = getData3[i].SUB_MENU_CD.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_NM"].Value          = getData3[i].MENU_NM.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_USING_FLAG"].Value  = getData3[i].USING_FLAG.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_SORT_NO"].Value     = getData3[i].SORT_NO.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_MENU_PATH"].Value   = getData3[i].MENU_PATH.ToString();
                                dataGridView1.Rows[i].Cells["dgv1_FILE_FOLDER"].Value = getData3[i].FILE_FOLDER.ToString();
                            }

                            SetRowNumber(dataGridView1);
                        }
                        else
                        {
                            dataGridView1.Rows.Clear();
                            //MessageBox.Show("데이터가 없습니다");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logs.SaveLog("[error]  (page)::FrmMenuMainDB.cs  (Function)::SetDataBind_gridView1  (Detail)::code_grp=[" + code_grp + "], tmenuCd=[" + tmenuCd + "], smenuCd=[" + smenuCd + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmMenuMainDB.cs  (Function)::SetDataBind_gridView1  (Detail)::reMsg=[" + reMsg + "]", "Error");
                logs.SaveLog("[error]  (page)::FrmMenuMainDB.cs  (Function)::SetDataBind_gridView1  (Detail):: " + "\r\n" + ex.ToString(), "Error");
            }
            finally
            {
                if (wSvc != null)
                {
                    wSvc.Dispose();
                }
            }
        }