Exemple #1
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);
        }
Exemple #2
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);

            //执行修改操作
            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();
        }
        /// <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();
        }
        /// <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);
        }