using System; using System.Collections.Generic; using System.Text; using System.Data; using SysBaseLibs; using System.Web.Script.Serialization; namespace SysDataLibs.TableClass { #region SellerHasStall public class SellerHasStall_info : ITableInfo { #region SellerHasStall表 字段信息 /// /// 为关键字段: Y --- PrimaryKey; /// 自动增长: N; /// 数据类型: int; /// 数据长度: 4; /// 是否允许为空: N; /// 默认值: ; /// 描述: 经营户编号; /// public const string cSellerID = "SellerID"; /// /// 为关键字段: Y --- PrimaryKey; /// 自动增长: N; /// 数据类型: int; /// 数据长度: 4; /// 是否允许为空: N; /// 默认值: ; /// 描述: 摊位编号; /// public const string cStallID = "StallID"; #endregion public SellerHasStall_info() { } public SellerHasStall_info(DataRow poRow) { CreateTableInfo(poRow); } public void CreateTableInfo(DataRow poRow) { _SellerID = UtilStr.StrFromObj(poRow[cSellerID]); _StallID = UtilStr.StrFromObj(poRow[cStallID]); } public SellerHasStall_info(string pcSellerID, string pcStallID, DBConnSql poDBConn) { if (pcSellerID.Trim().Length > 0 && pcStallID.Trim().Length > 0 && poDBConn != null) { string lcSql = "select * from " + Tn.SellerHasStall + " where SellerID='" + pcSellerID + "' and StallID='" + pcStallID + "'"; rsQuery loQuery = poDBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1) { loQuery.MoveFirst(); CreateTableInfo(loQuery.CurrentRow); } } } private string _SellerID = ""; public string SellerID { get { return _SellerID; } set { _SellerID = value; } } private string _StallID = ""; public string StallID { get { return _StallID; } set { _StallID = value; } } [ScriptIgnore] public rsXmlNode DataXMLNode { get { rsXmlNode loMainNode = new rsXmlNode("SellerHasStallRecord", ""); rsXmlNode loNode = null; loNode = new rsXmlNode(cSellerID, SellerID); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cStallID, StallID); loMainNode.AddChild(loNode); return loMainNode; } } public string InsertSql() { return " insert into " + Tn.SellerHasStall + " " + " (" + cSellerID + "," + cStallID + ") " + " values (" + _SellerID + "," + _StallID + ") "; } public string UpdateSql() { return ""; } public string DeleteSql() { return "Delete " + Tn.SellerHasStall + " where " + cSellerID + "=" + _SellerID + " and " + cStallID + "=" + _StallID + ""; } public static string GetStallInfobySellerId(string pcSellerId, DBConnSql poDBConn) { string lcRetVal = ""; string lcSql = " select * from SellerHasStall where SellerID =" + pcSellerId + ""; rsQuery loQuery = poDBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0) { loQuery.MoveFirst(); for (int i = 0; i < loQuery.RecCount; i++) { lcRetVal += (lcRetVal == "" ? "" : ",") + loQuery.GetString("StallID"); loQuery.MoveNext(); } } return lcRetVal; } public static bool UpdateStallBySellerId(string pcSellerId, string pcStallList, DBConnSql poConn) { bool lbRetVal = false; string lcSql = " Delete SellerHasStall where SellerID=" + pcSellerId + " \r\n "; if (pcStallList.Trim().Length > 0) { Array loArr = UtilStr.StrToArrayEx(pcStallList, ","); if (loArr != null && loArr.Length > 0) { foreach (string lcStallId in loArr) { string Stallid = UtilStr.FormatStr(lcStallId); if (lcStallId.Trim().Length > 0) lcSql += " insert into SellerHasStall (SellerID,StallID) values (" + pcSellerId + "," + Stallid + ") \r\n "; } } } if (poConn != null) { lbRetVal = poConn.ExcuteSqlTran(lcSql); } return lbRetVal; } } #endregion #region public class SellerHasStall_Qry : rsQuery { public Int64 SellerID { get { return GetInt(SellerHasStall_info.cSellerID); } // set { SetField(SellerHasStall_info.cSellerID, value); } } public Int64 StallID { get { return GetInt(SellerHasStall_info.cStallID); } // set { SetField(SellerHasStall_info.cStallID, value); } } } #endregion }