Exemple #1
0
        /// <summary>
        /// 修改焦点对象
        /// </summary>
        public void UpdateObject()
        {
            //获取焦点对象
            Layout obj = FocusedObject;

            if (obj == null)
            {
                return;
            }

            //创建对象的一个副本
            Layout objCopy = new Layout();

            DataConverter.CopyTo <Layout>(obj, objCopy);

            //执行修改操作
            using (FrmLayoutDialog dlg = new FrmLayoutDialog())
            {
                dlg.Object = objCopy;                   //绑定副本
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //用副本更新焦点对象
            DataConverter.CopyTo <Layout>(objCopy, obj);
            //刷新表格
            gridControl.RefreshDataSource();
        }
Exemple #2
0
        /// <summary>
        /// 添加对象
        /// </summary>
        public void AddObject()
        {
            //检查对象链表是否已经加载
            if (ObjectList == null)
            {
                return;
            }
            //新建对象
            Layout obj = new Layout();

            obj.UID     = Guid.NewGuid().ToString() + "|" + vp.ProjectUID;
            obj.Creater = vp.ProjectUID;// Itop.Client.MIS.UserNumber;
            //obj.CreaterName = Itop.Client.MIS.UserName;
            try
            {
                obj.CreateDate = (DateTime)Services.BaseService.GetObject("SelectSysData", null);
            }
            catch { }
            //执行添加操作
            using (FrmLayoutDialog dlg = new FrmLayoutDialog())
            {
                dlg.IsCreate = true;                    //设置新建标志
                dlg.Object   = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //将新对象加入到链表中
            ObjectList.Add(obj);
            //////LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>(obj.UID);
            //////if (lt1 == null)
            //////{
            //////    lt1 = new LayoutType();
            //////    lt1.UID = obj.UID;
            //////    LayoutType lt2 = Services.BaseService.GetOneByKey<LayoutType>("LayoutModule");
            //////    lt1.ExcelData = lt2.ExcelData;
            //////    Services.BaseService.Create<LayoutType>(lt1);
            //////}



            //刷新表格,并将焦点行定位到新对象上。
            gridControl.RefreshDataSource();
            GridHelper.FocuseRow(this.gridView, obj);
        }
Exemple #3
0
        /// <summary>
        /// �޸Ľ������
        /// </summary>
        public void UpdateObject()
        {
            //��ȡ�������
            Layout obj = FocusedObject;
            if (obj == null)
            {
                return;
            }

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

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

            //�ø������½������
            DataConverter.CopyTo<Layout>(objCopy, obj);
            //ˢ�±��
            gridControl.RefreshDataSource();
        }
Exemple #4
0
        /// <summary>
        /// ��Ӷ���
        /// </summary>
        public void AddObject()
        {
            //�����������Ƿ��Ѿ�����
            if (ObjectList == null)
            {
                return;
            }
            //�½�����
            Layout obj = new Layout();
            obj.UID = Guid.NewGuid().ToString() + "|" + vp.ProjectUID;
            obj.Creater = vp.ProjectUID;// Itop.Client.MIS.UserNumber;
            //obj.CreaterName = Itop.Client.MIS.UserName;
            try
            {
                obj.CreateDate = (DateTime)Services.BaseService.GetObject("SelectSysData", null);
            }
            catch { }
            //ִ����Ӳ���
            using (FrmLayoutDialog dlg = new FrmLayoutDialog())
            {
                dlg.IsCreate = true;    //�����½���־
                dlg.Object = obj;
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            //���¶�����뵽������
            ObjectList.Add(obj);
            //////LayoutType lt1 = Services.BaseService.GetOneByKey<LayoutType>(obj.UID);
            //////if (lt1 == null)
            //////{
            //////    lt1 = new LayoutType();
            //////    lt1.UID = obj.UID;
            //////    LayoutType lt2 = Services.BaseService.GetOneByKey<LayoutType>("LayoutModule");
            //////    lt1.ExcelData = lt2.ExcelData;
            //////    Services.BaseService.Create<LayoutType>(lt1);
            //////}

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