예제 #1
0
        private void barEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            string    uid     = treeList1.FocusedNode["UID"].ToString();
            PowerLine obj     = Services.BaseService.GetOneByKey <PowerLine>(uid);
            PowerLine objCopy = new PowerLine();

            DataConverter.CopyTo <PowerLine>(obj, objCopy);

            FrmPowerLineDialog dlg = new FrmPowerLineDialog();

            dlg.Object = objCopy;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DataConverter.CopyTo <PowerLine>(objCopy, obj);
            treeList1.FocusedNode.SetValue("PowerName", obj.PowerName);
            treeList1.FocusedNode.SetValue("Remark", obj.Remark);
        }
예제 #2
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            PowerLine obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本
            PowerLine objCopy = new PowerLine();

            DataConverter.CopyTo <PowerLine>(obj, objCopy);

            //执行修改操作
            using (FrmPowerLineDialog dlg = new FrmPowerLineDialog())
            {
                dlg.Object = objCopy;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //用副本更新焦点对象
            DataConverter.CopyTo <PowerLine>(objCopy, obj);
            //刷新表格
            gridControl.RefreshDataSource();
        }
예제 #3
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            PowerLine obj = new PowerLine();

            //执行添加操作
            using (FrmPowerLineDialog dlg = new FrmPowerLineDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
예제 #4
0
        private void barAdd1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string parentid = "";
            if (treeList1.FocusedNode == null)
                return;
            parentid = treeList1.FocusedNode["UID"].ToString();
            PowerLine obj = new PowerLine();
            obj.ParentID = parentid;
            FrmPowerLineDialog dlg = new FrmPowerLineDialog();
            dlg.Object = obj;
            dlg.IsCreate = true;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
예제 #5
0
        private void barAdd1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string parentid = "";

            if (treeList1.FocusedNode == null)
            {
                return;
            }
            parentid = treeList1.FocusedNode["UID"].ToString();
            PowerLine obj = new PowerLine();

            obj.ParentID = parentid;
            FrmPowerLineDialog dlg = new FrmPowerLineDialog();

            dlg.Object   = obj;
            dlg.IsCreate = true;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            dataTable.Rows.Add(DataConverter.ObjectToRow(obj, dataTable.NewRow()));
        }
예제 #6
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            PowerLine obj = new PowerLine();

            //ִ����Ӳ���
            using (FrmPowerLineDialog dlg = new FrmPowerLineDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //���¶�����뵽������
            ObjectList.Add(obj);

            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
예제 #7
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            PowerLine obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

            //���������һ������
            PowerLine objCopy = new PowerLine();
            DataConverter.CopyTo<PowerLine>(obj, objCopy);

            //ִ���޸IJ���
            using (FrmPowerLineDialog dlg = new FrmPowerLineDialog())
            {
                dlg.Object = objCopy;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //�ø������½������
            DataConverter.CopyTo<PowerLine>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
예제 #8
0
        private void barEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
                return;
            string uid = treeList1.FocusedNode["UID"].ToString();
            PowerLine obj = Services.BaseService.GetOneByKey<PowerLine>(uid);
            PowerLine objCopy = new PowerLine();
            DataConverter.CopyTo<PowerLine>(obj, objCopy);

            FrmPowerLineDialog dlg = new FrmPowerLineDialog();
            dlg.Object = objCopy;

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DataConverter.CopyTo<PowerLine>(objCopy, obj);
            treeList1.FocusedNode.SetValue("PowerName", obj.PowerName);
            treeList1.FocusedNode.SetValue("Remark", obj.Remark);
        }