·您的位置: 首页 » 资源教程 » 编程开发 » ASP.NET » Websharp使用说明(3)

Websharp使用说明(3)

类别: ASP.NET教程  评论数:0 总得分:0
如果要表示一对多的对象结构,我们可以采用如下的方式(表明了一个入库单的结构,这个入库单包含了入库单头和相关明细):

public class Form : PersistenceCapable

{

private EntityData form;

private FormDetail formDetail;



#region 构造函数

public Form() : this(true)

{}



public Form(bool AutoInit)

{

form=EntityPrototypeManager.GetEmptyEntity("Form");

if(AutoInit)

form.NewRecord("Form");

}



public Form(EntityData entity)

{

form=entity;

}

#endregion



#region 属性

public string FormID

{

get{return form["FormID","Form"].ToString();}

set{form["FormID","Form"]=value;}

}



public DateTime FormTime

{

get{return form.GetDateTime("FormTime","Form");}

set{form["FormTime","Form"]=value;}

}



public FormDetail FormDetail

{

get

{

if(formDetail==null)

{

formDetail=new FormDetail(form);

}

return formDetail;

}

}

#endregion



#region PersistenceCapable 成员



public int ObjectCount

{

get

{

return form.EntityCount;

}

}



public EntityData EntityData

{

get

{

return form;

}

set

{

form=value;

}

}



public bool Next()

{

return form.Next("Form");

}



public void First()

{

form.First("Form");

}



public void AddNew()

{

form.NewRecord("Form");

}



#endregion

}



public class FormDetail : PersistenceCapable

{

private EntityData form;

#region 构造函数

public FormDetail() : this(true)

{}



public FormDetail(bool AutoInit)

{

form=EntityPrototypeManager.GetEmptyEntity("Form");

if(AutoInit)

form.NewRecord("FormDetail");

}



public FormDetail(EntityData entity)

{

form=entity;

}

#endregion



#region 属性

public string FormDetailID

{

get{return form["FormDetailID","FormDetail"].ToString();}

set{form["FormDetailID","FormDetail"]=value;}

}

public string FormID

{

get{return form["FormID","FormDetail"].ToString();}

set{form["FormID","FormDetail"]=value;}

}

public string ProductID

{

get{return form["ProductID","FormDetail"].ToString();}

set{form["ProductID","FormDetail"]=value;}

}

public decimal InCount

{

get{return form.GetDecimal("InCount","FormDetail");}

set{form["InCount","FormDetail"]=value;}

}

#endregion



#region PersistenceCapable 成员

public int ObjectCount

{

get

{

return form.Tables["FormDetail"].Rows.Count;

}

}



public EntityData EntityData

{

get

{

return form;

}

set

{

form=value;

}

}



public bool Next()

{

return form.Next("FormDetail");

}



public void First()

{

form.First("FormDetail");

}



public void AddNew()

{

form.NewRecord("FormDetail");

}



#endregion

}




-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1