function PageInit()
{ InitDocument();
QueryDataForm = GetDsNode("Page.Form.Query");
Co.QueryForm.SetDataForm(QueryDataForm);
//回填部门名称
var ds = GetDs("Page");
if(ds.GetParam("Mark")=="set")
{ Co.Dept.SetValue(ds.GetParam("Dept")); }
}
下面是一个DataEnum类,有些问题,请LIVE41指点,谢谢!!!请问你一般用QQ或者是MSN么?想交个朋友,多多的的请教下!谢谢!!1 using System; using System.Xml;
namespace Exceed.Data { /// <summary> /// DataEnum 的摘要说明。 /// </summary> public class DataEnum:DataList { #region 构造函数
/// <summary> /// 空的DataEnum构造函数 /// </summary> public DataEnum():base() { this.Type="Enum"; //this是代表当前我调用该方法的页面么?Type参数是说明该类是枚举类型的,是么?为什么Enum要用“”呢? this.Init(); //init方法是用来初始化的么?具体有什么用呢? }
/// <summary> /// 根据XML字符串构造DataEnum /// </summary> /// <param name="xmlsrc"></param> public DataEnum(string xmlsrc):base(xmlsrc) //有构造一个带参数的类,有什么用么?根据你的经验,请解释下?谢谢!!! { this.Type="Enum"; }
/// <summary> /// 根据XmlElement构造DataEnum /// </summary> /// <param name="ele"></param> public DataEnum(XmlElement ele):base(ele) { this.Type="Enum"; }
/// <summary> /// 根据DataEnum构造新的DataEnum /// </summary> /// <param name="ele"></param> public DataEnum(DataEnum dataEnum):base(dataEnum.ToString()) //dataEnum.ToString()是把枚举值转换为字符型的么? { this.Type="Enum"; }
/// <summary> /// 根据XmlDocument和XmlElement构造DataEnum /// </summary> /// <param name="doc"></param> /// <param name="ele"></param> internal DataEnum(XmlDocument doc,XmlElement ele):base(doc,ele) { this.Type="Enum"; } #endregion
#region 共有方法 /// <summary> /// 添加子节点 /// </summary> /// <param name="text"></param> /// <param name="value"></param> /// <returns></returns> public DataItem AddItem(string text,string value) //能把下面的这些方法都解释清楚点么?有些引用的方法不清楚,谢谢!!! { XmlElement node=this.XmlDoc.CreateElement("Item"); this.XmlEle.AppendChild(node); node.SetAttribute("Text",text); node.SetAttribute("Value",value); return new DataItem(this.XmlDoc,node); }
/// <summary> /// 新建子节点 /// </summary> /// <returns></returns> public new DataItem NewItem() { XmlElement node = this.XmlDoc.CreateElement("Item"); this.XmlEle.AppendChild(node); return new DataItem(this.XmlDoc,node); }
/// <summary> /// 根据text获得子节点的值 /// </summary> /// <param name="text"></param> /// <returns></returns> public string GetValue(string text) { XmlElement node=null; node = (XmlElement)this.XmlEle.SelectSingleNode("Item[@Text='"+text+"']"); if(node==null)return null; return DataStore.FilterNull(node.GetAttribute("Value")); }
/// <summary> /// 根据设置子节点的值 /// </summary> public void SetValue(){}
/// <summary> /// 根据value获得子节点的text /// </summary> /// <param name="value"></param> /// <returns></returns> public string GetText(string value) { XmlElement node=null; node = (XmlElement)this.XmlEle.SelectSingleNode("Item[@Value='"+value+"']"); if(node==null)return null; return DataStore.FilterNull(node.GetAttribute("Text")); }
/// <summary> /// 根据index获得SubEnum /// </summary> /// <param name="index"></param> /// <returns></returns> public string GetSubEnum(int index) { XmlElement node; node = (XmlElement)this.XmlEle.ChildNodes[index]; if(node==null)return null; string se=null; if(node!=null)se = node.GetAttribute("SubEnum"); if(se.Trim()=="")return null; return se; }
/// <summary> /// 根据枚举值value获得SubEnum /// </summary> /// <param name="name"></param> /// <returns></returns> public string GetSubEnum(string value) { XmlElement node; node = (XmlElement)this.XmlEle.SelectSingleNode("Item[@Value='"+value+"']"); if(node==null)return null; string se=null; if(node!=null)se = node.GetAttribute("SubEnum"); if(se.Trim()=="")return null; return se; }
/// <summary> /// 根据dataItem获得SubEnum /// </summary> /// <param name="dataItem"></param> /// <returns></returns> public string GetSubEnum(DataItem dataItem) { XmlElement node; node = dataItem.XmlEle; if(node==null)return null; string se=null; if(node!=null)se = node.GetAttribute("SubEnum"); if(se.Trim()=="") return null; return se; } /// <summary> /// 获取数据属性列 /// </summary> /// <returns></returns> public new string GetFields() { return null; } /// <summary> /// 设置数据属性列 /// </summary> public void SetFields(){}
/// <summary> /// 根据name克隆DataEnum对象 /// </summary> /// <param name="name"></param> /// <returns></returns> public new DataEnum Clone(bool includeChild) { XmlNode node=this.CloneNode(includeChild); return new DataEnum(this.XmlDoc,(XmlElement)node); } /// <summary> /// 根据name克隆DataEnum对象 /// </summary> /// <param name="name"></param> /// <returns></returns> public new DataEnum Clone(string name) { XmlNode node=this.CloneNode(name); return new DataEnum(this.XmlDoc,(XmlElement)node); } #endregion } }