信息系统开发平台OpenExpressApp-内置支持的属性编辑方式

目前支持属性编辑方式有: 基础类型(字符串、日期、枚举)、特定类型(下拉列表、memo弹出框、附件)

OpenExpressApp support some property editors: base data type(string, datatime, enum) and some given type(dropdown lookup、memo、attachment)

类图如下:

下面分别对其他几种编辑方式进行简要说明,以便大家对这几种类型的使用有所了解。

1 基础类型

1.1 枚举

1.1.1 运行界面

1.1.2 类库编写

  1.1.2.1 定义枚举类型

    public enum BudgetType
    {
        [EnumAttr(
"不确定")]
        Unknown 
= 0,
        [EnumAttr(
"招标控制价源数据")]
        TenderPriceSource 
= 1,
        [EnumAttr(
"投标报价源数据")]
        TenderOfferSource 
= 2,
        [EnumAttr(
"调整预算源数据")]
        BudgetAdjustmentSource 
= 3,
        [EnumAttr(
"竣工结算源数据")]
        FinalAccountSource 
= 4,
        [EnumAttr(
"投标报价修正数据")]
        TenderOfferModified 
= 5,
        [EnumAttr(
"调整预算修正数据")]
        BudgetAdjustmentModified 
= 6,
        [EnumAttr(
"竣工结算修正数据")]
        FinalAccountModified 
= 7,
    }

  1.1.2.2 类库引用枚举类型

        private static PropertyInfo<BudgetType> BudgetTypeProperty =
          RegisterProperty(
new PropertyInfo<BudgetType>("BudgetType"));
        [Column][EntityProperty]
        [ShowInListAttribute, ShowInDetail, Label(
"预算书类型")]
        
public BudgetType BudgetType
        {
            
get { return GetProperty(BudgetTypeProperty); }
            
set { SetProperty(BudgetTypeProperty, value); }
        }

1.2 日期

1.2.1 运行界面

1.2.2 类库编写

        private static PropertyInfo<DateTime> SignDateProperty =
          RegisterProperty(
new PropertyInfo<DateTime>("SignDate"));
        [Column]
        [EntityProperty]
        [Required, ShowInListAttribute, ShowInDetail, Label(
"签约日期")]
        
public DateTime SignDate
        {
            
get { return GetProperty(SignDateProperty); }
            
set { SetProperty(SignDateProperty, value); }
        }

2 下拉列表(列表和树形)

2.1 运行界面
                    

2.2 类库编写

 在对象属性上添加Lookup属性,系统自动会生成下拉编辑类型,如果下拉对象类型实现了ITreeNode接口,则会自动生成下拉树,否则下拉普通列表

        //项目合同科目
        private static PropertyInfo<Guid> projectContractSubjectIdProperty =
            RegisterProperty(
new PropertyInfo<Guid>("ProjectContractSubjectId"));
        [Column][EntityProperty][ShowInDetail]
        [Lookup(
"ProjectContractSubject", DataSourceProperty = "Project.ProjectContractSubjects")]
        [QueryItemValueType(QueryItemValueType.Id), NavigateQueryItem]
        
public Guid ProjectContractSubjectId
        {
            
get { return GetProperty(projectContractSubjectIdProperty); }
            
set { SetProperty(projectContractSubjectIdProperty, value); }
        }

3 memo弹出框

3.1 运行界面

3.2 类库编写

在对象属性上添加Editor属性,指定编辑器为EditorNames.Memo类型

        private static PropertyInfo<string> DescriptionProperty =
          RegisterProperty(
new PropertyInfo<string>("Description"));
        [Column]
        [EntityProperty]
        [Required, ShowInList, Label(
"备注")]
        [OpenExpressApp.MetaAttribute.EditorAttribute(EditorNames.Memo)]
        
public string Description
        {
            
get { return GetProperty(DescriptionProperty); }
            
set { SetProperty(DescriptionProperty, value); }
        }

4 附件

4.1 运行界面

4.2 类库编写

在对象属性上添加Editor属性,指定编辑方式为EditorNames.FileData

        //FileAttachment
        private static PropertyInfo<Guid?> FileIdProperty =
            RegisterProperty(
new PropertyInfo<Guid?>("FileId"));
        [Column][EntityProperty]
        [Editor(EditorNames.FileData)]
        [Lookup(
"FileAttachment"), ShowInList]
        
public Guid? FileId
        {
            
get { return GetProperty(FileIdProperty); }
            
private set { SetProperty(FileIdProperty, value); }
        }

        
private static PropertyInfo<FileAttachment> FileAttachmentProperty =
                RegisterProperty(
new PropertyInfo<FileAttachment>("FileAttachment"));
        
public FileAttachment FileAttachment
        {
            
get
            {
                
return GetProperty(FileAttachmentProperty);
            }
            
set
            {
                SetProperty(FileAttachmentProperty, value);
            }
        }

更多内容: 开源信息系统开发平台之OpenExpressApp框架.pdf

posted on 2009-10-16 10:05  周 金根  阅读(2867)  评论(6编辑  收藏  举报

导航