教程-XAF使用视图
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
XAF使用视图
有表Fee 和表FeeEntry一对多关系。
publicclass TFee : BaseObject
{
privatestring _fBillNo;
private DateTime _fAccountingDate;
private DateTime _fDateBegin;
private DateTime _fDateEnd;
privatestring _fDescription;
private CheckState _fState;
private TLoan _fLoan;
public TFee(Session session)
: base(session)
{
}
[XafDisplayName("单据编号")]
publicstring FBillNo
{
get { return _fBillNo; }
set { _fBillNo = value; }
}
[XafDisplayName("结算日期")]
public DateTime FAccountingDate
{
get { return _fAccountingDate; }
set { _fAccountingDate = value; }
}
[XafDisplayName("业务单号"), LookupEditorMode(LookupEditorMode.Search)] public TLoan FLoan
{
get { return _fLoan; }
set { _fLoan = value; }
}
[XafDisplayName("计算起始日期")]
public DateTime FDateBegin
{
get { return _fDateBegin; }
set { _fDateBegin = value; }
}
[XafDisplayName("计算截止日期")]
public DateTime FDateEnd
{
get { return _fDateEnd; }
set { _fDateEnd = value; }
}
[XafDisplayName("备注"), ModelDefault("RowCount", "12")]
publicstring FDescription
{
get { return _fDescription; }
set { _fDescription = value; }
}
[XafDisplayName("审核状态"), ModelDefault("AllowEdit", "false")]
public CheckState FState
{
get { return _fState; }
set { _fState = value; }
}
[DevExpress.Xpo.Aggregated, Association("TFee-TFeeEntrys")]
[RuleRequiredField("TFeeTFeeEntryRequried", DefaultContexts.Save, "结算项目必须输入!")]
public XPCollection
{
get
{
return GetCollection
}
}
publicoverridevoid AfterConstruction()
{
base.AfterConstruction();
FAccountingDate = System.DateTime.Today;
}
}
[XafDisplayName("结算单分录")]
publicclass TFeeEntry : BaseObject
{
privatedecimal _fAmount;
private TAuxiliaryInformation _fCategory;
public TFeeEntry(Session session)
: base(session)
{
}
[Association("TFee-TFeeEntrys")]
public TFee TFee { get; set; }
[XafDisplayName("结算项目"), DataSourceCriteria("FType = 1")]
[RuleRequiredField("TFeeEntryFCategoryRequried", DefaultContexts.Save, "结算项目必须输入!")]
public TAuxiliaryInformation FCategory
{
get { return _fCategory; }
set { _fCategory = value; }
}
[XafDisplayName("金额")]
publicdecimal FAmount
{
get { return _fAmount; }
set { _fAmount = value; }
}
1.创建视图(SQL2008)
2./****** Object: View [dbo].[ViewFee] Script Date:
06/03/2013 17:30:40 ******/
3.SETANSI_NULLSON
4.GO
5.
6.SETQUOTED_IDENTIFIERON
7.GO
8.
9.CREATEVIEW[dbo].[ViewFee]