예제 #1
0
        private void frmProgLayerManager_Load(object sender, EventArgs e)
        {
            suid = ConfigurationSettings.AppSettings.Get("SvgID");
            LayerGrade g = new LayerGrade();
            g.ParentID = "SUID";
            g.SvgDataUid = suid;
            list= Services.BaseService.GetList<LayerGrade>("SelectLayerGradeListBySvgDataUid2", g);

            for (int i = 0; i < list.Count;i++ )
            {
                TreeNode node = new TreeNode();
                node.Tag = list[i].SUID;
                node.Text = list[i].Name;
                LayerGrade _g = new LayerGrade();
                _g.ParentID = list[i].SUID;
                _g.SvgDataUid = suid;
                IList<LayerGrade> _list = Services.BaseService.GetList<LayerGrade>("SelectLayerGradeListBySvgDataUid2", _g);
                for (int j = 0; j < _list.Count; j++)
                {
                    TreeNode _node = new TreeNode();
                    _node.Tag = _list[j].SUID;
                    _node.Text = _list[j].Name;
                    node.Nodes.Add(_node);
                }
                treeView1.Nodes.Add(node);

            }
            Psp_ProgLayerList p2 = new Psp_ProgLayerList();
            p2.ProgUID = progid;
            IList<Psp_ProgLayerList> plist = Services.BaseService.GetList<Psp_ProgLayerList>("SelectPsp_ProgLayerListListByProgUID", p2);
            treeView1.AfterCheck -= new System.Windows.Forms.TreeViewEventHandler(this.tree_AfterCheck);
            foreach(TreeNode tnode in treeView1.Nodes){
                if (GetNodeCheck(tnode, plist))
                {
                    tnode.Checked = true;
                    foreach(TreeNode tnode2 in tnode.Nodes){
                        if (GetNodeCheck(tnode2, plist))
                        {
                            tnode2.Checked = true;
                        }
                    }
                }
            }
            treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.tree_AfterCheck);
        }
예제 #2
0
        private void LayerGradeAdd(object sender, EventArgs e)
        {
            string uid = "";
            if (treeList1.FocusedNode != null) {
                uid = treeList1.FocusedNode[treeListColumn2].ToString();
            }
            frmLayerGradeInPut dlg = new frmLayerGradeInPut(strSvgDataUid);
            LayerGrade objnew = new LayerGrade();
            objnew.SUID = Guid.NewGuid().ToString();
            objnew.SvgDataUid = strSvgDataUid;
            //objnew.ParentID = uid;

            if (dlg.ShowDialog() == DialogResult.OK) {
                objnew.Name = dlg.TextInPut;
                objnew.ParentID = dlg.ParentID;
            } else {
                return;
            }
            if (objnew.Name == "") {
                MessageBox.Show("分级名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            foreach (LayerGrade lay in ilist) {
                if (objnew.Name == lay.Name) {
                    MessageBox.Show("分级已经存在。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(objnew, dataTable.NewRow()));
            Services.BaseService.Create<LayerGrade>(objnew);

            Psp_ProgLayerList obj2 = new Psp_ProgLayerList();
            obj2.UID = Guid.NewGuid().ToString();
            obj2.ProgUID = MIS.ProgUID;
            obj2.LayerGradeID = objnew.SUID;
            obj2.col1 = objnew.Name;
            Services.BaseService.Create<Psp_ProgLayerList>(obj2);
            InitData(strSvgDataUid);
        }
예제 #3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Psp_ProgLayerList p1=new Psp_ProgLayerList();
                    p1.ProgUID=progid;
                    Services.BaseService.Update("DeletePsp_ProgLayerListByPID",p1);

                    foreach(TreeNode node in treeView1.Nodes){
                        if (node.Checked == true)
                        {

                            Psp_ProgLayerList obj = new Psp_ProgLayerList();
                            obj.UID = Guid.NewGuid().ToString();
                            obj.ProgUID = progid;
                            obj.LayerGradeID = node.Tag.ToString();
                            obj.col1 = node.Text;
                            Services.BaseService.Create<Psp_ProgLayerList>(obj);
                            foreach (TreeNode node2 in node.Nodes)
                            {
                                if (node2.Checked == true)
                                {
                                    Psp_ProgLayerList obj2 = new Psp_ProgLayerList();
                                    obj2.UID = Guid.NewGuid().ToString();
                                    obj2.ProgUID = progid;
                                    obj2.LayerGradeID = node2.Tag.ToString();
                                    obj2.col1 = node2.Text;
                                    Services.BaseService.Create<Psp_ProgLayerList>(obj2);
                                }
                            }
                        }
                    }

                    this.Close();
        }
예제 #4
0
        public void InitData(string svgDataUid)
        {
            #region MyRegion
               // /* 原有区分关联图层功能代码 _lgm
            ilist2.Clear();
            strSvgDataUid = svgDataUid;
            LayerGrade lg = new LayerGrade();
            lg.SvgDataUid = svgDataUid;
            ilist = Services.BaseService.GetList("SelectLayerGradeListBySvgDataUid", lg);
            //----------------按项目关联年份分级-------------------
            Psp_ProgLayerList p = new Psp_ProgLayerList();
            p.ProgUID = MIS.ProgUID;
            IList<Psp_ProgLayerList> _plist = Services.BaseService.GetList<Psp_ProgLayerList>("SelectPsp_ProgLayerListListByProgUID", p);
            for (int i = 0; i < ilist.Count; i++)
            {
                for (int j = 0; j < _plist.Count; j++)
                {
                    if (((LayerGrade)ilist[i]).SUID == _plist[j].LayerGradeID)
                    {
                        ilist2.Add(ilist[i]);
                        continue;
                    }
                }
            }

            //ilist2.Clear();
            //strSvgDataUid = svgDataUid;
            //LayerGrade lg = new LayerGrade();
            //lg.SvgDataUid = svgDataUid;
            //ilist = Services.BaseService.GetList("SelectLayerGradeListBySvgDataUid", lg);
            ////----------------按项目关联年份分级-------------------
            //Psp_ProgLayerList p = new Psp_ProgLayerList();
            //p.ProgUID = MIS.ProgUID;
            //IList<Psp_ProgLayerList> _plist = Services.BaseService.GetList<Psp_ProgLayerList>("SelectPsp_ProgLayerListListByProgUID", p);
            //for (int i = 0; i < ilist.Count; i++) {

            //    ilist2.Add(ilist[i]);

            //}
            #endregion

            //-----------------------------------------------------
            //ilist = Services.BaseService.GetList<PspType>();
            dataTable = DataConverter.ToDataTable(ilist2, typeof(LayerGrade));

            IList list = this.SymbolDoc.getLayerList();
            foreach (Layer lay in list) {
                if (lay.GetAttribute("layerType") == "电网规划层") {
                    LayerGrade obj = new LayerGrade();
                    obj.SUID = lay.ID;
                    obj.Name = lay.Label;
                    obj.ParentID = lay.GetAttribute("ParentID");
                    dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
                }
            }
            treeList1.DataSource = dataTable;

            Application.DoEvents();
            treeList1.FocusedNode = null;
            treeList1.CollapseAll();
        }