using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL; using System.Data; using CY.Infrastructure.Common; using CY.Infrastructure.Query; using CY.BLL.Sys; using CY.Model; using CY.BLL.Info; namespace CY.WebForm.Pages.Templet.Default { //吴辉 //企业网站首页 public partial class CompanyIndex : TempletBasePage { public string MP_Address, MP_People, MP_LandlineNumber, MP_Fax, MP_QQNumber, MP_EmailNumber, MP_CompanyWebsite; Info_ContentBLL bll_Info_ContentBLL = null; Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; Info_SortBLL bll_Info_SortBLL = null; EC_MemberBasicBLL _EC_MemberBasicBLL = null; OA_CorporateClientsBLL _OA_CorporateClientsBLL = null; Info_CompanyAdBLL _Info_CompanyAdBLL = null; //初始化 public CompanyIndex() { bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); bll_Info_ContentBLL = new Info_ContentBLL(); bll_Info_SortBLL = new Info_SortBLL(); _EC_MemberBasicBLL = new EC_MemberBasicBLL(); _OA_CorporateClientsBLL = new OA_CorporateClientsBLL(); _Info_CompanyAdBLL = new Info_CompanyAdBLL(); } protected void Page_Load(object sender, EventArgs e) { this.Title += "-" + CurrentWeb().Name; if (!IsPostBack) { InitialData(); BindList(); this.ulHelpHtml.InnerHtml = InitialSelectNewsData(); this.TemplateList.InnerHtml = InitialSelectNewsDataInfo(); //this.TemplateList.InnerHtml = this.TemplateList.InnerHtml + InitialSelectNewsDataInfo(); } } //加载查询条件 protected string InitialSelectNewsData() { DataTable ds = bll_Info_SortBLL.SelectList("11111111-1111-1111-1111-111111111111".ToGuid2()); string SortTypeHtml = ""; if (ds != null && ds.Rows.Count > 0) { GetDataByLevelNews(ref SortTypeHtml, ds, bll_Sys_DictionaryBLL.GetKeyIdByKeyid(3, "网站资讯类型"), 1); } return SortTypeHtml; } //遍历数据 public void GetDataByLevelNews(ref string SortTypeHtml, DataTable data, int? parentId, int level) { DataRow[] result = data.Select(string.Format("ParentId={0}", parentId)); int i = -1; while (++i < result.Count()) { if (level == 1) { if (result.Count() > 0) { SortTypeHtml += "
" + result[i]["Title"].ToString2() + "
more
"; } } } } protected string InitialSelectNewsDataInfo() { string SortTypeHtml = ""; List m_Info_ContentList = bll_Info_ContentBLL.SelectListBySortId(CurrentWeb().MemberId, 12) as List; foreach (var item in m_Info_ContentList) { SortTypeHtml += "
  • " + item.Title.ToString2().JSubString(32, "..") + "
  • "; } return SortTypeHtml; } private void BindList() { Pagination pa = new Pagination(); pa.PageSize = 10; pa.PageIndex =1; this.Repeater1.DataSource = _Info_CompanyAdBLL.SelectModelListByType(pa, "商家成功案列", CurrentWeb().MemberId.ToGuid2()); this.Repeater1.DataBind(); Pagination pa1 = new Pagination(); pa1.PageSize = 5; pa1.PageIndex = 1; this.Repeater2.DataSource = _Info_CompanyAdBLL.SelectModelListByType(pa1, "首页滚动图片", CurrentWeb().MemberId.ToGuid2()); this.Repeater2.DataBind(); } protected void InitialData() { // EC_MemberExtend model = _EC_MemberBasicBLL.GetMemberExtendByMemberId(Request["BussinessID"].ToGuid2()); EC_MemberExtend model = _EC_MemberBasicBLL.GetMemberExtendByMemberId(CurrentWeb().MemberId); if (model != null) { string Address = model.DetailedAddress; if (Address.IndexOf(CurrentWeb().County) < 0) { Address = CurrentWeb().County + Address; } if (Address.IndexOf(CurrentWeb().City) < 0) { Address = CurrentWeb().City + Address; } MP_Address = Address; MP_CompanyWebsite = "www.cyin.cn"; MP_EmailNumber = model.Email; MP_Fax = model.Fax; MP_LandlineNumber = model.PhoneNum; MP_People = model.BusinessContacts; MP_QQNumber = model.QQ; } } } }