예제 #1
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            BurdenLineForecast obj = new BurdenLineForecast();

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

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

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

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

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

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