Пример #1
0
 public void SetLayerAttribute()
 {
     foreach (Layer layer in SymbolDoc.getLayerList())
     {
         layer.SetAttribute("IsSelect", "false");
     }
     for (int i = 0; i < treeList1.Selection.Count; i++)
     {
         foreach (Layer lay in SymbolDoc.getLayerList())
         {
             if (((lay.GetAttribute("ParentID") == treeList1.Selection[i].GetValue(treeListColumn2).ToString()) || lay.GetAttribute("id") == treeList1.Selection[i].GetValue(treeListColumn2).ToString()) && (lay.GetAttribute("layerType") == "电网规划层"))
             {
                 lay.SetAttribute("IsSelect", "true");
             }
             else
             {
                 if (lay.GetAttribute("layerType") == "电网规划层")
                 {
                     lay.Visible = false;
                 }
             }
         }
     }
 }
Пример #2
0
        private void LayerGradeChange(object sender, EventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            string             uid = treeList1.FocusedNode[treeListColumn2].ToString();
            LayerGrade         obj = Services.BaseService.GetOneByKey <LayerGrade>(uid);
            frmLayerGradeInPut dlg = new frmLayerGradeInPut(strSvgDataUid);

            dlg.TextInPut = treeList1.FocusedNode[treeListColumn1].ToString();
            //LayerGrade objParent = Services.BaseService.GetOneByKey<LayerGrade>((string)treeList1.FocusedNode[treeListColumn4]);
            dlg.ParentID = treeList1.FocusedNode[treeListColumn4].ToString();
            if (obj != null)
            {
                dlg.textBoxEnabled = true;
            }
            else
            {
                dlg.textBoxEnabled = false;
            }

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (dlg.TextInPut == "")
                {
                    MessageBox.Show("分级名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                SVG_LAYER lar = new SVG_LAYER();
                lar.svgID = strSvgDataUid;
                lar.SUID  = uid;
                lar       = (SVG_LAYER)Services.BaseService.GetObject("SelectSVG_LAYERByKey", lar);
                if (lar != null)
                {
                    lar.YearID = dlg.ParentID;
                    Services.BaseService.Update <SVG_LAYER>(lar);
                }
                if (obj != null)
                {
                    obj.Name     = dlg.TextInPut;
                    obj.ParentID = dlg.ParentID;

                    foreach (LayerGrade lay in ilist)
                    {
                        if (obj.Name == lay.Name && obj.Name != treeList1.FocusedNode[treeListColumn1].ToString())
                        {
                            MessageBox.Show("分级已经存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    if (obj.ParentID == obj.SUID)
                    {
                        MessageBox.Show("不能将分级设置成自己的子级!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    treeList1.FocusedNode.SetValue("Name", obj.Name);
                    treeList1.FocusedNode.SetValue("ParentID", obj.ParentID);
                    Services.BaseService.Update("UpdateLayerGrade", obj);
                }
                else
                {
                    Layer lay = SymbolDoc.GetLayerByID(uid);
                    treeList1.FocusedNode.SetValue("Name", dlg.TextInPut);
                    treeList1.FocusedNode.SetValue("ParentID", dlg.ParentID);
                    //lay.Label = dlg.TextInPut;
                    lay.SetAttribute("ParentID", dlg.ParentID);
                }
            }
            else
            {
                return;
            }
            InitData(strSvgDataUid);
        }