File: D:/HostingSpaces/SBogers34/himawarijewels.com/wwwroot/Spire.aspx.cs
using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Connectopen;
using Jaychan.Common;
public partial class Spire : System.Web.UI.Page
{
public string nmt = "",title="",acw="",ac_top="";
public string lan = WebUtils.GetCookie("Ncce_Language");
OleDbConnection MyConn;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Bid == -1) Bid = 101;
PageDataBind();
}
}
public void PageDataBind()
{
int i = 1;
Nav_P1.Text = WebUtils.GetCookie("Ncce_Language")+Bid.ToString();
try
{
GetContent drt = new GetContent();
OleDbDataReader drf = drt.GetnewsTitle("2", Bid);
while (drf.Read()) {
if (i==1) Cid= int.Parse(drf[1].ToString());
nmt += "nmt"+i.ToString()+"=" + drf[0] + "&";
nmtu.Text += "case " + i.ToString() + ":\nlocation.href='Spire.aspx?Bid=" + Bid + "&Cid=" + drf[1] + "';break\n";
i++;
}
drf.Close();
drf = drt.GetClassTitle("1", Bid);
while (drf.Read())
{
navtitle.Text = "<a href='Spire.aspx?Bid=" + Bid + "'>" + drf[0] + "</a>";
navtitle2.Text = "<font class=c14>"+drf[0]+"</font>";
title = drf[0].ToString();
}
drf.Close();
drf = drt.GetClassTitle("2", Cid);
while (drf.Read())
{
navtitle.Text += " > <span>" + drf[0] + "</span>";
navtitle2.Text = "<div style='padding-top:5px;'><font class='c14 b'>"+drf[0]+"</font></div>";
title = drf[0].ToString() + " - " + title + " - ";
}
drf.Close();
navpic.Text = "nav_tit.gif";
drf = drt.GetNavPic(Bid, Cid);
while (drf.Read())
{
navpic.Text = drf[0].ToString();
}
drf.Close();
if (Bid == 105)
{
if (Bid == 105)
{
drf = drt.Getnews_top(1, "samllpic<>\"\"", Bid, Cid);
while (drf.Read())
{
string fbs=drf[2].ToString();
if (fbs.Length > 140) fbs = fbs.Substring(0, 140) + "...";
if (lan==""){
if (fbs.Length > 300) fbs = fbs.Substring(0, 300) + "...";
}
ac_top = "top";
n_top01.Text = "<a href=include/News.aspx?id=" + drf[8] + " rev=\"width: 704px; height: 530px;\" rel=lyteframe><img src=uploadfile/" + drf[5].ToString() + " width=201 height=105 /></a>";
n_top02.Text = "<a href=include/News.aspx?id="+drf[8]+" rev=\"width: 704px; height: 530px;\" rel=lyteframe>"+drf[1]+"</a>";
n_top03.Text = " "+fbs+" [<a href=include/News.aspx?id=" + drf[8] + " rev=\"width: 704px; height: 530px;\" rel=lyteframe>View</a>]";
}
if (ac_top != "top") { productDatalist.PageSize = 12; }
drf.Close();
}
if (Cid == 17777) { productDatalist.RepeatColumns = 4; }
acw = "News";
}
else
{
Connent_Test.Text = title + " No content!";
drf = drt.Getcontent(Bid, Cid, 0, 0, 1);
while (drf.Read())
{
Connent_Test.Text = drf[0].ToString();
}
drf.Close();
}
Page.Title = title + Page.Title;
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write("<script>location.reload();</script>");
}
}
ICollection CreateSource()
{
try
{
MyConn = DB.CreateDB();
MyConn.Open();
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write("<script>location.reload();</script>");
}
DataSet ds = new DataSet();
string sql = "select * from info where c_2=" + Cid + " order by addtime desc";
OleDbDataAdapter MyAdapter = new OleDbDataAdapter(sql, MyConn);
MyAdapter.Fill(ds, 0, 1000, "info");
return ds.Tables["info"].DefaultView;
}
public void ProductListDataBind()
{
productDatalist.DataSource = CreateSource();
productDatalist.DataBind();
}
protected void productDatalist_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
// Label lblProductName = (Label)e.Item.FindControl("lblProductName");
// lblProductName.Text = lblProductName.Text.Length > 8 ? lblProductName.Text.Substring(0, 7) + "…" : lblProductName.Text;
}
}
protected void PageChanged(object sender, DataGridPageChangedEventArgs e)
{
//reset index
productDatalist.CurrentPageIndex = e.NewPageIndex;
ProductListDataBind();
}
public int Bid
{
get
{
if (WebUtils.GetInt("Bid", -1) == -1)
{
if (ViewState["Bid"] == null)
{
ViewState["Bid"] = -1;
}
}
else
{
ViewState["Bid"] = WebUtils.GetInt("Bid", -1);
}
return DataConverter.StrToInt(ViewState["Bid"], -1);
}
set
{
ViewState["Bid"] = value;
}
}
public int Cid
{
get
{
if (WebUtils.GetInt("Cid", -1) == -1)
{
if (ViewState["Cid"] == null)
{
ViewState["Cid"] = -1;
}
}
else
{
ViewState["Cid"] = WebUtils.GetInt("Cid", -1);
}
return DataConverter.StrToInt(ViewState["Cid"], -1);
}
set
{
ViewState["Cid"] = value;
}
}
}