123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Data;
- using SysBaseLibs;
- using System.Web.Script.Serialization;
- namespace SysDataLibs.TableClass
- {
- #region Sys_AttachTables
- public class Sys_AttachTables_info : ITableInfo
- {
- #region Sys_AttachTables表 字段信息
- /// <summary>
- /// 为关键字段: N ;
- /// 自动增长: N;
- /// 数据类型: nvarchar;
- /// 数据长度: 300;
- /// 是否允许为空: N;
- /// 默认值: ;
- /// 描述: Actiion;
- /// </summary>
- public const string cActiion = "Actiion";
- /// <summary>
- /// 为关键字段: N ;
- /// 自动增长: N;
- /// 数据类型: smalldatetime;
- /// 数据长度: 4;
- /// 是否允许为空: N;
- /// 默认值: (getdate());
- /// 描述: ActionTime;
- /// </summary>
- public const string cActionTime = "ActionTime";
- /// <summary>
- /// 为关键字段: N ;
- /// 自动增长: N;
- /// 数据类型: int;
- /// 数据长度: 4;
- /// 是否允许为空: N;
- /// 默认值: ((0));
- /// 描述: ActionTimes;
- /// </summary>
- public const string cActionTimes = "ActionTimes";
- /// <summary>
- /// 为关键字段: N ;
- /// 自动增长: N;
- /// 数据类型: nvarchar;
- /// 数据长度: 160;
- /// 是否允许为空: N;
- /// 默认值: ;
- /// 描述: ColumnId;
- /// </summary>
- public const string cColumnId = "ColumnId";
- /// <summary>
- /// 为关键字段: Y --- PrimaryKey;
- /// 自动增长: N;
- /// 数据类型: varchar;
- /// 数据长度: 250;
- /// 是否允许为空: N;
- /// 默认值: ;
- /// 描述: SourceKey;
- /// </summary>
- public const string cSourceKey = "SourceKey";
- /// <summary>
- /// 为关键字段: Y --- PrimaryKey;
- /// 自动增长: N;
- /// 数据类型: nvarchar;
- /// 数据长度: 160;
- /// 是否允许为空: N;
- /// 默认值: ;
- /// 描述: TableId;
- /// </summary>
- public const string cTableId = "TableId";
- /// <summary>
- /// 为关键字段: Y --- PrimaryKey;
- /// 自动增长: N;
- /// 数据类型: varchar;
- /// 数据长度: 30;
- /// 是否允许为空: N;
- /// 默认值: ;
- /// 描述: UserID;
- /// </summary>
- public const string cUserID = "UserID";
- #endregion
- public Sys_AttachTables_info() { }
- public Sys_AttachTables_info(DataRow poRow)
- {
- CreateTableInfo(poRow);
- }
- public void CreateTableInfo(DataRow poRow)
- {
- _Actiion = UtilStr.StrFromObj(poRow[cActiion]);
- _ActionTime = UtilStr.StrFromObj(poRow[cActionTime]);
- _ActionTimes = UtilStr.StrFromObj(poRow[cActionTimes]);
- _ColumnId = UtilStr.StrFromObj(poRow[cColumnId]);
- _SourceKey = UtilStr.StrFromObj(poRow[cSourceKey]);
- _TableId = UtilStr.StrFromObj(poRow[cTableId]);
- _UserID = UtilStr.StrFromObj(poRow[cUserID]);
- }
- public Sys_AttachTables_info(string pcSourceKey, string pcTableId, string pcUserID, DBConnSql poDBConn)
- {
- if (pcSourceKey.Trim().Length > 0 && pcTableId.Trim().Length > 0 && pcUserID.Trim().Length > 0 && poDBConn != null)
- {
- string lcSql = "select * from " + Tn.Sys_AttachTables + " where SourceKey='" + pcSourceKey + "' and TableId='" + pcTableId + "' and UserID='" + pcUserID + "'";
- rsQuery loQuery = poDBConn.OpenQuery(lcSql);
- if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1)
- {
- loQuery.MoveFirst();
- CreateTableInfo(loQuery.CurrentRow);
- }
- }
- }
- private string _Actiion = "";
- public string Actiion
- {
- get { return _Actiion; }
- set { _Actiion = value; }
- }
- private string _ActionTime = "";
- public string ActionTime
- {
- get { return _ActionTime; }
- set { _ActionTime = value; }
- }
- private string _ActionTimes = "";
- public string ActionTimes
- {
- get { return _ActionTimes; }
- set { _ActionTimes = value; }
- }
- private string _ColumnId = "";
- public string ColumnId
- {
- get { return _ColumnId; }
- set { _ColumnId = value; }
- }
- private string _SourceKey = "";
- public string SourceKey
- {
- get { return _SourceKey; }
- set { _SourceKey = value; }
- }
- private string _TableId = "";
- public string TableId
- {
- get { return _TableId; }
- set { _TableId = value; }
- }
- private string _UserID = "";
- public string UserID
- {
- get { return _UserID; }
- set { _UserID = value; }
- }
- [ScriptIgnore]
- public rsXmlNode DataXMLNode
- {
- get
- {
- rsXmlNode loMainNode = new rsXmlNode("Sys_AttachTablesRecord", "");
- rsXmlNode loNode = null;
- loNode = new rsXmlNode(cActiion, Actiion);
- loMainNode.AddChild(loNode);
- loNode = new rsXmlNode(cActionTime, ActionTime);
- loMainNode.AddChild(loNode);
- loNode = new rsXmlNode(cActionTimes, ActionTimes);
- loMainNode.AddChild(loNode);
- loNode = new rsXmlNode(cColumnId, ColumnId);
- loMainNode.AddChild(loNode);
- loNode = new rsXmlNode(cSourceKey, SourceKey);
- loMainNode.AddChild(loNode);
- loNode = new rsXmlNode(cTableId, TableId);
- loMainNode.AddChild(loNode);
- loNode = new rsXmlNode(cUserID, UserID);
- loMainNode.AddChild(loNode);
- return loMainNode;
- }
- }
- public string InsertSql()
- {
- return " insert into " + Tn.Sys_AttachTables + " " +
- " (" + cActiion + "," + cActionTime + "," + cActionTimes + "," + cColumnId + "," + cSourceKey + "," + cTableId + "," + cUserID + ") " +
- " values ('" + _Actiion + "',getdate(),'1','" + _ColumnId + "','" + _SourceKey + "','" + _TableId + "','" + _UserID + "') ";
- }
- public string UpdateSql()
- {
- return " update " + Tn.Sys_AttachTables + " " +
- " set " + cActionTime + "=getdate() ," + cActionTimes + "=" + cActionTimes + "+1 " +
- " where " + cSourceKey + "='" + _SourceKey + "' and " + cTableId + "='" + _TableId + "' and " + cUserID + "='" + _UserID + "'";
- }
- public string DeleteSql()
- {
- return "Delete " + Tn.Sys_AttachTables + " where " + cSourceKey + "='" + _SourceKey + "' and " + cTableId + "='" + _TableId + "' and " + cUserID + "='" + _UserID + "'";
- }
- public bool Update(UserSession poSession)
- {
- string lcSlq = " if( Exists (select * from Sys_AttachTables where SourceKey ='" + _SourceKey + "' and TableId='" + _TableId + "' and UserID ='" + _UserID + "')) \r\n " +
- UpdateSql() + " \r\n " +
- " else \r\n " +
- InsertSql();
- return poSession.DBConn.ExcuteSqlTran(lcSlq);
- }
- }
- #endregion
- #region
- public class Sys_AttachTables_Qry : rsQuery
- {
- public String Actiion
- {
- get { return GetString(Sys_AttachTables_info.cActiion); }
- // set { SetField(Sys_AttachTables_info.cActiion, value); }
- }
- public DateTime ActionTime
- {
- get { return GetDateTime(Sys_AttachTables_info.cActionTime); }
- // set { SetField(Sys_AttachTables_info.cActionTime, value); }
- }
- public Int64 ActionTimes
- {
- get { return GetInt(Sys_AttachTables_info.cActionTimes); }
- // set { SetField(Sys_AttachTables_info.cActionTimes, value); }
- }
- public String ColumnId
- {
- get { return GetString(Sys_AttachTables_info.cColumnId); }
- // set { SetField(Sys_AttachTables_info.cColumnId, value); }
- }
- public String SourceKey
- {
- get { return GetString(Sys_AttachTables_info.cSourceKey); }
- // set { SetField(Sys_AttachTables_info.cSourceKey, value); }
- }
- public String TableId
- {
- get { return GetString(Sys_AttachTables_info.cTableId); }
- // set { SetField(Sys_AttachTables_info.cTableId, value); }
- }
- public String UserID
- {
- get { return GetString(Sys_AttachTables_info.cUserID); }
- // set { SetField(Sys_AttachTables_info.cUserID, value); }
- }
- }
- #endregion
- }
|