/// <summary> /// 实例化单个返回给客户的展商信息 /// </summary> /// <param name="dr">展场信息datarow</param> /// <param name="table">展位的表格</param> /// <returns>展商的信息</returns> private ExhibitorToCustomerEntity GetExhibitorToCustomerEntity(DataRow dr, DataTable table) { ExhibitorToCustomerEntity item = null; if (dr != null) { item = new ExhibitorToCustomerEntity(); if (dr["ExhibitorID"] != null && dr["ExhibitorID"].ToString() != "") { item.ExhibitorID = int.Parse(dr["ExhibitorID"].ToString()); } if (dr["ExhibitionID"] != null && dr["ExhibitionID"].ToString() != "") { item.ExhibitionID = int.Parse(dr["ExhibitionID"].ToString()); } if (dr["ExhibitorName"] != null) { item.ExhibitorName = dr["ExhibitorName"].ToString(); } if (dr["ExhibitorPinYin"] != null) { item.ExhibitorPinYin = dr["ExhibitorPinYin"].ToString(); } if (dr["IsHadBookList"] != null && dr["IsHadBookList"].ToString() != "") { if ((dr["IsHadBookList"].ToString() == "1") || (dr["IsHadBookList"].ToString().ToLower() == "true")) { item.IsHadBookList = true; } else { item.IsHadBookList = false; } } DataRow[] drs = table.Select("ExhibitorID = " + item.ExhibitorID.ToString()); if (drs != null) { if (drs.Length > 0) { item.ExhibitorLocationList = new List <ExhibitorToCustomerLocationEntity>(); foreach (DataRow drl in drs) { ExhibitorToCustomerLocationEntity locationItem = this.GetExhibitorToCustomerLocationEntity(drl); if (locationItem != null) { item.ExhibitorLocationList.Add(locationItem); } } } } } return(item); }
/// <summary> /// 根据表格返回值,查询所有展商 /// </summary> /// <param name="table">展商表格</param> /// <returns>展商List集合</returns> public List <ExhibitorToCustomerEntity> GetExhibitorEntityList(DataTable table, DataTable tableLocation) { List <ExhibitorToCustomerEntity> list = null; if (table != null) { //去重展商 DataTable tableExhibitor = table.DefaultView.ToTable(true, "ExhibitorID", "ExhibitionID", "ExhibitorName", "ExhibitorPinYin", "IsHadBookList"); if (tableExhibitor != null) { list = new List <ExhibitorToCustomerEntity>(); foreach (DataRow dr in tableExhibitor.Rows) { ExhibitorToCustomerEntity item = this.GetExhibitorToCustomerEntity(dr, tableLocation); if (item != null) { list.Add(item); } } } } return(list); }
/// <summary> /// 以展场id为主键,查询所有展商 /// </summary> /// <param name="exhibitionID">展场id</param> /// <returns>展商List集合</returns> public List <ExhibitorToCustomerEntity> GetExhibitorEntityList(int exhibitionID) { List <ExhibitorToCustomerEntity> list = null; DataSet ds = this.GetExhibitorDataSet(exhibitionID); if (ds != null && ds.Tables.Count == 2) { if (ds.Tables[0].Rows.Count > 0) { list = new List <ExhibitorToCustomerEntity>(); foreach (DataRow dr in ds.Tables[0].Rows) { ExhibitorToCustomerEntity item = this.GetExhibitorToCustomerEntity(dr, ds.Tables[1]); if (item != null) { list.Add(item); } } } } return(list); }