protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.Travel b_Travel = new BLL.Travel(); Entity.Travel e_Travel = b_Travel.Select_Travel(g_Travel_ID); if (e_Travel != null) { g_Travel_TypeID = e_Travel.Travel_TypeID; SetHyperLinkTitle(HyperLink_Title); SetHyperLinkTravel(HyperLink_Travel, HyperLink_Travel_TypeID); SetHyperLinkTravelType(HyperLink_Travel_TypeID_1, HyperLink_Travel_TypeID_2); Travel_Name.InnerText = e_Travel.Travel_Name; HyperLink o_HyperLink = new HyperLink(); o_HyperLink.ImageUrl = g_Travel_Images + "/" + e_Travel.Travel_PreView2; o_HyperLink.NavigateUrl = g_Travel_Images + "/" + e_Travel.Travel_PreView2; o_HyperLink.ToolTip = "景点图片"; o_HyperLink.Target = "_blank"; Travel_PreView2.Controls.Add(o_HyperLink); Travel_Code.InnerText = e_Travel.Travel_Code; Travel_Price.InnerText = e_Travel.Travel_Price; Travel_StartAddr.InnerText = e_Travel.Travel_StartAddr; Travel_EndAddr.InnerText = e_Travel.Travel_EndAddr; Travel_Points.InnerText = e_Travel.Travel_Points.ToString(); if (g_LanguageID == 1) Travel_Date.InnerText = e_Travel.Travel_StartDate.ToString("yyyy年MM月dd日") + " - " + e_Travel.Travel_EndDate.ToString("yyyy年MM月dd日"); else Travel_Date.InnerText = e_Travel.Travel_StartDate.ToString("yyyy-MM-dd") + " - " + e_Travel.Travel_EndDate.ToString("yyyy-MM-dd"); Travel_Views.InnerText = e_Travel.Travel_Views; Travel_Route.InnerHtml = e_Travel.Travel_Route; int i = 0; foreach (string Travel_Images in e_Travel.Travel_PreViews) { o_HyperLink = new HyperLink(); o_HyperLink.ImageUrl = g_Travel_Images + "/" + Travel_Images; o_HyperLink.NavigateUrl = g_Travel_Images + "/" + Travel_Images; o_HyperLink.ToolTip = "景点图片"; o_HyperLink.Target = "_blank"; Travel_PreViews.Controls.Add(o_HyperLink); i++; if (i % 4 == 0) { HtmlGenericControl o_HtmlGenericControl = new HtmlGenericControl("div"); o_HtmlGenericControl.Attributes.Add("height", "15px"); o_HtmlGenericControl.InnerHtml = " "; Travel_PreViews.Controls.Add(o_HtmlGenericControl); } } } } }
private void GetTravel() { BLL.Travel b_Travel = new BLL.Travel(); Entity.Travel[] e_Travel = b_Travel.Select_Travel(Convert.ToInt32(Travel_LanguageID.SelectedValue), Convert.ToInt32(Travel_TypeID.SelectedValue), Search_Content.Text, Convert.ToInt32(Search_Method.SelectedValue), g_PageSize, g_Page); if (e_Travel != null) { int i = 1; foreach (Entity.Travel o_Travel in e_Travel) { HtmlTableRow o_HtmlTableRow = new HtmlTableRow(); HtmlTableCell o_HtmlTableCell; HtmlAnchor o_HtmlAnchor; HtmlGenericControl o_HtmlGenericControl; o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = ((g_Page - 1) * g_PageSize + i).ToString(); o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = g_Language[o_Travel.Travel_LanguageID]; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = g_Travel[o_Travel.Travel_TypeID][0]; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_Name; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_Code; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_Price; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_StartAddr; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_EndAddr; o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_Points.ToString(); o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_StartDate.ToShortDateString() + "至" + o_Travel.Travel_EndDate.ToShortDateString(); o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlTableCell.InnerText = o_Travel.Travel_AddTime.ToString(); o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableCell = new HtmlTableCell(); o_HtmlAnchor = new HtmlAnchor(); o_HtmlAnchor.HRef = "#"; o_HtmlAnchor.Attributes.Add("onclick", "ActionSubmit(2, " + o_Travel.Travel_ID.ToString() + ");return false;"); o_HtmlAnchor.Attributes.Add("class", "AdminToolsLink2"); o_HtmlAnchor.InnerText = "修改"; o_HtmlTableCell.Controls.Add(o_HtmlAnchor); o_HtmlGenericControl = new HtmlGenericControl(); o_HtmlGenericControl.InnerHtml = " "; o_HtmlTableCell.Controls.Add(o_HtmlGenericControl); o_HtmlAnchor = new HtmlAnchor(); o_HtmlAnchor.HRef = "#"; o_HtmlAnchor.Attributes.Add("onclick", "ActionSubmit(3, " + o_Travel.Travel_ID.ToString() + ");return false;"); o_HtmlAnchor.Attributes.Add("class", "AdminToolsLink2"); o_HtmlAnchor.InnerText = "删除"; o_HtmlTableCell.Controls.Add(o_HtmlAnchor); o_HtmlTableRow.Controls.Add(o_HtmlTableCell); o_HtmlTableRow.Align = "center"; o_HtmlTableRow.Style.Add(HtmlTextWriterStyle.Height, "30px"); g_MainTable.Rows.Add(o_HtmlTableRow); i++; } Current_Page.Text = g_Page.ToString(); Total_Page.Text = b_Travel.g_TotalPage.ToString(); Total_Count.Text = b_Travel.g_TotalCount.ToString(); if (g_Page > 1) { Previous_Page.Visible = true; Previous_Page.CommandArgument = (g_Page - 1).ToString(); } else { Previous_Page.Visible = false; } if (g_Page < b_Travel.g_TotalPage) { Next_Page.Visible = true; Next_Page.CommandArgument = (g_Page + 1).ToString(); } else { Next_Page.Visible = false; } Current_Page.Visible = true; Splite_Page.Visible = true; Total_Page.Visible = true; } else { Current_Page.Visible = false; Splite_Page.Visible = false; Total_Page.Visible = false; Total_Count.Text = "0"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetHyperLinkTitle(HyperLink_Title); SetHyperLinkTravel(HyperLink_Travel, HyperLink_Travel_TypeID); SetHyperLinkTravelType(HyperLink_Travel_TypeID_1, HyperLink_Travel_TypeID_2); BLL.Travel b_Travel = new BLL.Travel(); Entity.Travel[] e_Travel = b_Travel.Select_Travel(g_LanguageID, g_Travel_TypeID, "", 0, 7, g_Page); if (e_Travel != null) { int i = 1; foreach (Entity.Travel o_Travel in e_Travel) { HtmlGenericControl o_Div = new HtmlGenericControl("div"); if (i % 2 == 1) o_Div.Attributes.Add("class", "inside_content_news"); else o_Div.Attributes.Add("class", "inside_content_news inside_content_newsb"); HyperLink o_HyperLink = new HyperLink(); o_HyperLink.CssClass = "inside_content_newsa"; o_HyperLink.ImageUrl = g_Travel_Images + "/" + o_Travel.Travel_PreView1; o_HyperLink.NavigateUrl = "Travel_Detail.aspx?Travel_ID=" + o_Travel.Travel_ID.ToString(); o_Div.Controls.Add(o_HyperLink); HtmlGenericControl o_Span = new HtmlGenericControl("span"); o_Span.Attributes.Add("class", "inside_content_span"); HtmlGenericControl o_Strong; HtmlAnchor o_Anchor; HtmlGenericControl o_H3 = new HtmlGenericControl("h3"); o_Strong = new HtmlGenericControl("strong"); o_Strong.InnerText = o_Travel.Travel_Name; o_H3.Controls.Add(o_Strong); o_Span.Controls.Add(o_H3); HtmlGenericControl o_Span_Date = new HtmlGenericControl("span"); o_Span_Date.Attributes.Add("class", "inside_content_span1"); o_Span_Date.InnerHtml = "<strong>出团日期:</strong>" + o_Travel.Travel_StartDate.ToString("yyyy-MM-dd") + "至" + o_Travel.Travel_EndDate.ToString("yyyy-MM-dd"); o_Span.Controls.Add(o_Span_Date); HtmlGenericControl o_Br = new HtmlGenericControl(); o_Br.InnerHtml = "<br/>"; o_Span.Controls.Add(o_Br); HtmlGenericControl o_Span_Views = new HtmlGenericControl("span"); o_Span_Views.Attributes.Add("class", "inside_content_span1"); o_Strong = new HtmlGenericControl("strong"); o_Strong.InnerText = "主要景点:"; o_Anchor = new HtmlAnchor(); o_Anchor.HRef = "Travel_Detail.aspx?Travel_ID=" + o_Travel.Travel_ID.ToString(); if (o_Travel.Travel_Views.Length > 102) o_Anchor.InnerText = o_Travel.Travel_Views.Substring(0, 102); else o_Anchor.InnerText = o_Travel.Travel_Views; o_Anchor.Style.Add(HtmlTextWriterStyle.Color, "#f7860f"); o_Span_Views.Controls.Add(o_Strong); o_Span_Views.Controls.Add(o_Anchor); o_Span.Controls.Add(o_Span_Views); o_Div.Controls.Add(o_Span); Travel_Lists.Controls.Add(o_Div); i++; } } } }