예제 #1
0
 public void LoadData(string id)
 {
     PSP_SubstationUserNum num1 = new PSP_SubstationUserNum();
     num1.userID = Itop.Client.MIS.UserNumber;
     num1.SubStationID = id;
     num1.num = 1;
     list = Services.BaseService.GetList<PSP_SubstationUserNum>("SelectPSP_SubstationUserNumByUser", num1);
     if (list.Count == 0)
     {
         Create1 = true;
         PSP_SubstationPar par1 = new PSP_SubstationPar();
         par1.type = 1;
         IList<PSP_SubstationPar> _list = Services.BaseService.GetList<PSP_SubstationPar>("SelectPSP_SubstationParByType", par1);
         for (int i = 0; i < _list.Count; i++)
         {
             PSP_SubstationUserNum n1 = new PSP_SubstationUserNum();
             n1.Remark = _list[i].InfoName;
             n1.col1 = "是";
             n1.col2 = "是";
             n1.col4 = _list[i].UID;
             list.Add(n1);
         }
     }
     else
     {
         Create1 = false;
     }
     gridControl.DataSource = list;
     num1.num = 2;
     list2 = Services.BaseService.GetList<PSP_SubstationUserNum>("SelectPSP_SubstationUserNumByUser", num1);
     if (list2.Count == 0)
     {
         Create2 = true;
         PSP_SubstationPar par1 = new PSP_SubstationPar();
         par1.type = 2;
         IList<PSP_SubstationPar> _list = Services.BaseService.GetList<PSP_SubstationPar>("SelectPSP_SubstationParByType", par1);
         for (int i = 0; i < _list.Count; i++)
         {
             PSP_SubstationUserNum n2 = new PSP_SubstationUserNum();
             n2.Remark = _list[i].InfoName;
             n2.num = 0;
             n2.col1 = _list[i].col1;
             n2.col4 = _list[i].UID;
             list2.Add(n2);
         }
     }
     else
     {
         Create2 = false;
     }
     gridControl1.DataSource = list2;
 }
예제 #2
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject(int par)
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            PSP_SubstationPar obj = new PSP_SubstationPar();
            obj.type = par;
            //ִ����Ӳ���
            using (FrmPSP_SubstationParDialog dlg = new FrmPSP_SubstationParDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

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

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

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

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

            //�ø������½������
            DataConverter.CopyTo<PSP_SubstationPar>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
예제 #4
0
        /// <summary>
        /// ˢ�±���е�����
        /// </summary>
        /// <returns>ture:�ɹ�  false:ʧ��</returns>
        public bool RefreshData(int par)
        {
            try
            {
                PSP_SubstationPar sub_par = new PSP_SubstationPar();
                sub_par.type = par;
                IList<PSP_SubstationPar> list = Services.BaseService.GetList<PSP_SubstationPar>("SelectPSP_SubstationParByType",sub_par);
                this.gridControl.DataSource = list;
            }
            catch (Exception exc)
            {
                Debug.Fail(exc.Message);
                HandleException.TryCatch(exc);
                return false;
            }

            return true;
        }