Пример #1
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            PSP_PowerSubstationInfo obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

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

            //ִ���޸IJ���
            using (FrmPSP_PowerSubstationInfoDialog dlg = new FrmPSP_PowerSubstationInfoDialog())
            {
                dlg.IsSelect = isselect;
                dlg.Type = types1;
                dlg.Flag = flags1;
                dlg.Type2 = types2 + "|" + Itop.Client.MIS.ProgUID.Substring(0, 20);
                dlg.Text = this.text;
                dlg.ctrlPSP_PowerSubstationInfo = this;

                dlg.Object = objCopy;   //�󶨸���
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //�ø������½������
            DataConverter.CopyTo<PSP_PowerSubstationInfo>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
Пример #2
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            PSP_PowerSubstationInfo obj = new PSP_PowerSubstationInfo();

            obj.Flag = flags1;
            obj.CreateDate = DateTime.Now;

            //ִ����Ӳ���
            using (FrmPSP_PowerSubstationInfoDialog dlg = new FrmPSP_PowerSubstationInfoDialog())
            {
                //dlg.Text = "";
                dlg.Type = types1;
                dlg.Flag = flags1 ;
                dlg.Type2 = types2 + "|" + Itop.Client.MIS.ProgUID.Substring(0, 20);
                dlg.ctrlPSP_PowerSubstationInfo = this;
                dlg.Text = this.text;
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                dlg.rowTitle.Properties.Caption = this.colTitle.Caption;
                dlg.rowPowerName.Properties.Caption = this.colPowerName.Caption;
                if (dlg.ShowDialog() != DialogResult.OK)
                {

                    return;
                }
            }

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

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