1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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 += "<div class='indexBox fl' style=' height:192px; padding-right:" + (i == 3 ? "0px" : "15px") + "'><div class='box_1' style=' height:190px;'><div class='t_1'><h5>" + result[i]["Title"].ToString2() + "</h5><a target='_bank' href='/Pages/front/NewsList.aspx?i=" + CurrentWeb().bid + "&sortid=" + result[i]["Keyid"].ToInt32().Value + "' class='more'>more</a></div><div class='TemplateList'><ul>";
                        List<Info_Content> m_Info_ContentList = bll_Info_ContentBLL.SelectListByWhere(result[i]["Keyid"].ToInt32(), 6, true) as List<Info_Content>;
                        foreach (var item in m_Info_ContentList)
                        {
                            SortTypeHtml += "<li><a href='/Pages/Templet/Default/CompanyNewsDetail.aspx?i=" + CurrentWeb().bid + "&Keyid=" + item.Keyid + "'>" + item.Title.ToString2().JSubString(30, "..") + "</a></li>";
                        }
                        SortTypeHtml += "</ul></div></div></div>";
                    }
                }
            }
        }
 
        protected string InitialSelectNewsDataInfo()
        {
            string SortTypeHtml = "";
            List<Info_Content> m_Info_ContentList = bll_Info_ContentBLL.SelectListBySortId(CurrentWeb().MemberId, 12) as List<Info_Content>;
            foreach (var item in m_Info_ContentList)
            {
                SortTypeHtml += "<li><a href='/Pages/Templet/Default/CompanyNewsDetail.aspx?i=" + CurrentWeb().bid + "&Keyid=" + item.Keyid + "'>" + item.Title.ToString2().JSubString(32, "..") + "</a></li>";
            }
            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;
            }
        }
    }
}