using System; using System.Collections.Generic; using System.Text; using System.Data; using SysBaseLibs; using System.Web.Script.Serialization; namespace SysDataLibs.TableClass { #region Habitat public class Habitat_info : ITableInfo { #region Habitat表 字段信息 /// /// 为关键字段: Y --- PrimaryKey; /// 自动增长: N; /// 数据类型: varchar; /// 数据长度: 4; /// 是否允许为空: N; /// 默认值: ; /// 描述: 编号; /// public const string cHabitatID = "HabitatID"; /// /// 为关键字段: N ; /// 自动增长: N; /// 数据类型: int; /// 数据长度: 4; /// 是否允许为空: N; /// 默认值: (0); /// 描述: 是否锁定; /// public const string cIsLock = "IsLock"; /// /// 为关键字段: N ; /// 自动增长: N; /// 数据类型: varchar; /// 数据长度: 100; /// 是否允许为空: Y; /// 默认值: ; /// 描述: 名称; /// public const string cNames = "Names"; /// /// 为关键字段: N ; /// 自动增长: N; /// 数据类型: int; /// 数据长度: 4; /// 是否允许为空: N; /// 默认值: (0); /// 描述: 排序编号; /// public const string cSort = "Sort"; /// /// 为关键字段: N ; /// 自动增长: N; /// 数据类型: int; /// 数据长度: 4; /// 是否允许为空: N; /// 默认值: (1); /// 描述: 国别; /// public const string cType = "Type"; #endregion public Habitat_info(){} public Habitat_info(DataRow poRow) { CreateTableInfo(poRow); } public void CreateTableInfo(DataRow poRow) { _HabitatID=UtilStr.StrFromObj(poRow[cHabitatID]); _IsLock=UtilStr.StrFromObj(poRow[cIsLock]); _Names=UtilStr.StrFromObj(poRow[cNames]); _Sort=UtilStr.StrFromObj(poRow[cSort]); _Type=UtilStr.StrFromObj(poRow[cType]); } public Habitat_info( string pcHabitatID, DBConnSql poDBConn) { if ( pcHabitatID.Trim().Length > 0 && poDBConn != null) { string lcSql = "select * from " + Tn.Habitat + " where HabitatID='"+pcHabitatID+"'"; rsQuery loQuery = poDBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1) { loQuery.MoveFirst(); CreateTableInfo(loQuery.CurrentRow); } } } private string _HabitatID=""; public string HabitatID { get { return _HabitatID; } set { _HabitatID = value; } } private string _IsLock=""; public string IsLock { get { return _IsLock; } set { _IsLock = value; } } private string _Names=""; public string Names { get { return _Names; } set { _Names = value; } } private string _Sort=""; public string Sort { get { return _Sort; } set { _Sort = value; } } private string _Type=""; public string Type { get { return _Type; } set { _Type = value; } } [ScriptIgnore] public rsXmlNode DataXMLNode { get { rsXmlNode loMainNode = new rsXmlNode("HabitatRecord", ""); rsXmlNode loNode =null; loNode = new rsXmlNode(cHabitatID, HabitatID); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cIsLock, IsLock); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cNames, Names); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cSort, Sort); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cType, Type); loMainNode.AddChild(loNode); return loMainNode ; } } public string InsertSql() { return " insert into "+Tn.Habitat+" "+ " ("+cHabitatID+","+cIsLock+","+cNames+","+cSort+","+cType+") "+ " values ('"+_HabitatID+"',"+_IsLock+",'"+_Names+"',"+_Sort+","+_Type+") " ; } public string UpdateSql() { return " update "+Tn.Habitat+" "+ " set "+cIsLock+"="+_IsLock+","+cNames+"='"+_Names+"',"+cSort+"="+_Sort+","+cType+"="+_Type+" "+ " where "+cHabitatID+"='"+_HabitatID+"'" ; } public string DeleteSql() { return "Delete "+Tn.Habitat+" where "+cHabitatID+"='"+_HabitatID+"'" ; } } #endregion #region public class Habitat_Qry : rsQuery { public String HabitatID { get { return GetString(Habitat_info.cHabitatID); } // set { SetField(Habitat_info.cHabitatID, value); } } public Int64 IsLock { get { return GetInt(Habitat_info.cIsLock); } // set { SetField(Habitat_info.cIsLock, value); } } public String Names { get { return GetString(Habitat_info.cNames); } // set { SetField(Habitat_info.cNames, value); } } public Int64 Sort { get { return GetInt(Habitat_info.cSort); } // set { SetField(Habitat_info.cSort, value); } } public Int64 Type { get { return GetInt(Habitat_info.cType); } // set { SetField(Habitat_info.cType, value); } } } #endregion }