Пример #1
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            PowerEachList obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

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

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

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

            //用副本更新焦点对象
            DataConverter.CopyTo <PowerEachList>(objCopy, obj);
            //刷新表格
            gridControl.RefreshDataSource();
        }
Пример #2
0
        public void AddObjecta(string type)
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            PowerEachList obj = new PowerEachList();

            obj.Types = type;

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

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

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Пример #3
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            PowerEachList obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

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

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

            //�ø������½������
            DataConverter.CopyTo<PowerEachList>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
Пример #4
0
        public void AddObjecta(string type,bool bl)
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            PowerEachList obj = new PowerEachList();
            obj.Types = type;

            //ִ����Ӳ���
            using (FrmPowerEachListDialog2 dlg = new FrmPowerEachListDialog2())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                dlg.IsPower = true;
                dlg.IsJSXM = isjsxm;
                dlg.bl = bl;
                dlg.IsBTN = isbtn;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

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

               // ObjectList.Insert(0, obj);

            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }