Exemplo n.º 1
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            glebeType obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本
            //glebeType objCopy = new glebeType();
            //DataConverter.CopyTo<glebeType>(obj, objCopy);

            //执行修改操作
            using (FrmglebeTypeDialog dlg = new FrmglebeTypeDialog())
            {
                dlg.Object = obj;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.ObligateField1));
            //用副本更新焦点对象
            //DataConverter.CopyTo<glebeType>(objCopy, obj);
            //刷新表格
            Services.BaseService.Update <glebeType>(obj);
            gridControl.RefreshDataSource();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            glebeType obj = new glebeType();

            //执行添加操作
            using (FrmglebeTypeDialog dlg = new FrmglebeTypeDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.ObligateField1));
            //将新对象加入到链表中
            ObjectList.Add(obj);

            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Exemplo n.º 3
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            glebeType obj = new glebeType();

            //ִ����Ӳ���
            using (FrmglebeTypeDialog dlg = new FrmglebeTypeDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.ObligateField1));
            //���¶�����뵽������
            ObjectList.Add(obj);

            //ˢ�±�񣬲��������ж�λ���¶����ϡ�
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Exemplo n.º 4
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            glebeType obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

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

            //ִ���޸IJ���
            using (FrmglebeTypeDialog dlg = new FrmglebeTypeDialog())
            {
                dlg.Object = obj;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            obj.ObjColor = Color.FromArgb(Convert.ToInt32(obj.ObligateField1));
            //�ø������½������
            //DataConverter.CopyTo<glebeType>(objCopy, obj);
            //ˢ�±��
            Services.BaseService.Update<glebeType>(obj);
            gridControl.RefreshDataSource();
        }