XAF中如何实现Action创建一个可以编辑外连接对象的detail
来源:互联网 发布:1和3网络用语 编辑:程序博客网 时间:2024/06/05 20:46
在系统中有时候我们希望实现这样的创建操作,通过主数据创建一个关联表的对象,比如,通过库存表创建一个出入库单的对象并弹出一个窗体编辑给对象,在xaf中可以使用如下的代码实现:
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.SystemModule;
namespace Tes.Module.INVE.Controllers
{
public partial class InveActionContriller : ViewController
{
private DetailView createdDetailView;
//private InveActionContriller newController;
public InveActionContriller()
{
InitializeComponent();
RegisterActions(components);
//this.TargetViewType = ViewType.ListView;
//this.TargetViewNesting = Nesting.Nested;
//this.TargetObjectType = typeof(Dy_Inventory);
}
private void actionCreateAdm_Execute(object sender, SimpleActionExecuteEventArgs e)
{
//Find an existing object.
//Contact obj = os.FindObject<Contact>(CriteriaOperator.Parse("FirstName=?", "My Contact"));
//Or create a new object.
Contact obj = View.ObjectSpace.CreateObject<Contact>();
obj.Dy_Materials = (Dy_Inventory)e.CurrentObject;
//Save the changes if necessary.
View.ObjectSpace.CommitChanges();
IObjectSpace os = Application.CreateObjectSpace();
e.ShowViewParameters.CreatedView = Application.CreateDetailView(os, os.GetObject(obj));
//os = os.GetObject(obj);
os.SetModified(os.GetObject(obj));
//Specify various display settings.
e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
e.ShowViewParameters.Context = TemplateContext.NestedFrame;
e.ShowViewParameters.CreateAllControllers = true;
//Provide standard dialog window functionality.
DialogController dc = Application.CreateController<DialogController>();
e.ShowViewParameters.Controllers.Add(dc);
View.ObjectSpace.Refresh();
}
}
}
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.SystemModule;
namespace Tes.Module.INVE.Controllers
{
public partial class InveActionContriller : ViewController
{
private DetailView createdDetailView;
//private InveActionContriller newController;
public InveActionContriller()
{
InitializeComponent();
RegisterActions(components);
//this.TargetViewType = ViewType.ListView;
//this.TargetViewNesting = Nesting.Nested;
//this.TargetObjectType = typeof(Dy_Inventory);
}
private void actionCreateAdm_Execute(object sender, SimpleActionExecuteEventArgs e)
{
//Find an existing object.
//Contact obj = os.FindObject<Contact>(CriteriaOperator.Parse("FirstName=?", "My Contact"));
//Or create a new object.
Contact obj = View.ObjectSpace.CreateObject<Contact>();
obj.Dy_Materials = (Dy_Inventory)e.CurrentObject;
//Save the changes if necessary.
View.ObjectSpace.CommitChanges();
IObjectSpace os = Application.CreateObjectSpace();
e.ShowViewParameters.CreatedView = Application.CreateDetailView(os, os.GetObject(obj));
//os = os.GetObject(obj);
os.SetModified(os.GetObject(obj));
//Specify various display settings.
e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
e.ShowViewParameters.Context = TemplateContext.NestedFrame;
e.ShowViewParameters.CreateAllControllers = true;
//Provide standard dialog window functionality.
DialogController dc = Application.CreateController<DialogController>();
e.ShowViewParameters.Controllers.Add(dc);
View.ObjectSpace.Refresh();
}
}
}
- XAF中如何实现Action创建一个可以编辑外连接对象的detail
- XAF之制作时间编辑Action
- XAF如何通过ControlView自动打开新建的对象实例
- ADF:如何在一个adf table中标示一个view object有从属的detail信息
- IOS---在documents中创建可以编辑的plist文件
- 微信小程序实现一个可以编辑单元格的表格
- Java中如何实现一个类在内存里只能创建一个实例对象
- QT中如何让QTreeWidget某一列可以编辑,如何实现某一列控件的自定义化
- QT中如何让QTreeWidget某一列可以编辑,如何实现某一列控件的自定义化
- 在用ATL创建组件时,如何在一个接口的实现中创建另一个已经实现了的接口的对象?
- 如何实现 客户端仅用一个IP地址,就可以连接到不同的服务器上
- 如何创建一个有效的连接字符串
- Flex中如何创建一个可以自动换行并调整布局的ToolBar容器
- 实现可以编辑的表格
- 如何创建一个对象
- 一个FORM中如何实现多个ACTION
- 在一个FORM中如何实现多个ACTION动作
- XAF学习二:在XAF中打开自定义的WinForm
- 用代码扩展和自定义应用程序模型
- 利用XAF中的FeatureCenter例子的,直接打开DetailView
- 开源IT资产管理系统-->OCS Inventory NG服务端
- 15个最好的免费开源电子商务平台
- How to show a Detail View via code
- XAF中如何实现Action创建一个可以编辑外连接对象的detail
- 为程序员量身定制的12个目标(CSDN)
- xaf实现自定义只读参数
- 十款经典响应式网页设计案例欣赏[转CSDN]
- C#实现WMI读取远程计算机信息【原】
- The Mystery of the Duqu Framework
- 64位操作系统下IIS报“试图加载格式不正确的程序”错误
- Web地图服务、WMS 请求方式、网络地图服务(WMS)的三大操作
- 机房收费系统完美设计——参数传递+组合查询