コード例 #1
0
ファイル: frmLayerGrade.cs プロジェクト: github188/myitoppsp
        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);
        }
コード例 #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);
        }
コード例 #3
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);
            InitData(strSvgDataUid);
        }
コード例 #4
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);
        }