XAF中如何实现Action创建一个可以编辑外连接对象的detail
2013-05-31 11:36
507 查看
在系统中有时候我们希望实现这样的创建操作,通过主数据创建一个关联表的对象,比如,通过库存表创建一个出入库单的对象并弹出一个窗体编辑给对象,在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;
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
- 如何实现 客户端仅用一个IP地址,就可以连接到不同的服务器上
- Java中如何实现一个类在内存里只能创建一个实例对象
- java web开发中,jsp使用了frameset框架,如何实现整个页面跳转,并且同一个表单中可以提交两个action
- 简单工厂(Factory)-提供一个创建对象实例的功能,而无须关心其具体实现。被创建实例的类型可以是接口、抽象类,也可以是具体的类。
- 手把手教你如何创建一个连接到Binder上的服务(图文)(一)
- 如何定义一个只能在堆(栈)上创建对象的类
- 【OC复合题】之定义一个学生类,需要有姓名,年龄,考试成绩三个成员属性,创建5个对象,属性可以任意值。(Objective-C)
- winform如何实现一个窗体显示后,其他的窗体处于不可编辑状态
- 下拉列表框只能选择,我想选择后还可以允许用户对选择的内容进行修改,如何实现可编辑的下拉列表框?
- Github网站加载不完全,响应超时,如何解决 Github是一个代码托管平台和开发者社区,开发者可以在Github上创建自己的开源项目并与其他开发者协作编码。毫不夸张地说,高效利用Github是一
- 如何创建一个可以seek的progress bar?
- 介绍一个款可以在javascript对象上实现观察者模式的类库-Watch.js
- 深入解读Quartz的原理(创建Scheduler对象容器,并配置JobDetail和Trigger对象;配置强大时间调度策略,可以研究专门的CronTrigger )
- 如何创建一个类只能在堆(栈)上建立对象
- 编写类A,该类创建的对象包含一个方法f输出英文字母表,再编写一个A类的子类B,要求必须继承A类的方法f(不允许重写),子类创建的对象不仅可以调用方法f输出英文字线表,而且调用子类新增的方法g输出希腊字
- Python----一个对象的属性可以是另外一个类型创建的对象
- Java抽象类不可创建对象,但可以调用静态方法将建一个对象
- iOS 如何创建一个线程,要求可以一直工作,不会执行一次就结束
- 在同一个schema不可以创建同名称的对象(索引、表、约束等) 但在不同一个schema下可以创建同名称的对象