Esempio n. 1
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            PowerStuffList obj = new PowerStuffList();

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

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

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

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

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

            //�ø������½������
            DataConverter.CopyTo<PowerStuffList>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }