⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 browers.aspx.cs

📁 ASP.NET简洁论坛源代码 这是一个简单的论坛
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using doughty_cn.inputcon;
using System.IO;
using System.Data.OleDb;
using System.Configuration;

namespace doughty_cn
{
	/// <summary>
	/// FileBrowers 的摘要说明。
	/// </summary>
	public partial class FileBrowers : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
		protected System.Web.UI.WebControls.HyperLink HyperLink1;
		protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
		int PageSize,CurrentPage,PageCount;
		public string navigation,Question;
	
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// 来访情况记录
			//Handles MyBase.Load;
			//System.Web.UI.WebControls.Button Button1 = new System.Web.UI.WebControls.Button();
			/*if (!IsPostBack)
			{
				/*System.Web.UI.HtmlControls.HtmlInputHidden btnW = new System.Web.UI.HtmlControls.HtmlInputHidden();
				System.Web.UI.HtmlControls.HtmlInputHidden btnH = new System.Web.UI.HtmlControls.HtmlInputHidden();
				Button1.ID = "Button1";
				btnW.Name = "WidthPixel";
				btnW.ID = "WidthPixel";
				btnH.Name = "HeightPixel";
				btnH.ID = "HeightPixel";
				Me.FindControl("browserpeek").Controls.Add(btnW);
				Me.FindControl("browserpeek").Controls.Add(btnH);
				Me.FindControl("browserpeek").Controls.Add(Button1);
				string scriptString = "";
				scriptString += "document.browserpeek.WidthPixel.value=window.screen.width;";
				scriptString += "document.browserpeek.HeightPixel.value=window.screen.height;";
				this.RegisterOnSubmitStatement("Meng", scriptString);
				this.Page.Attributes.Add("onload", "document.browserpeek.Button1.click();");
			}
			else
			{
				this.MyBody.Attributes.Remove("onload");
				if (this.FindControl("browserpeek").Controls.Contains(Button1))
				{
					this.FindControl("browserpeek").Controls.Remove(Button1);
					Button1.Dispose();
				}

				System.Text.StringBuilder strLabel = new System.Text.StringBuilder();
				HttpBrowserCapabilities bc;
				bc = Request.Browser;
				strLabel.Append("您的浏览器的分辨率为:");   
				strLabel.Append(Request.Form["WidthPixel"]);
				strLabel.Append("×");
				strLabel.Append(Request.Form["HeightPixel"]);
				strLabel.Append("<hr   color='#000099'>");
				strLabel.Append("浏览器基本信息:<br>");
				strLabel.Append("Type   =   " + bc.Type + "<br>");
				strLabel.Append("Name   =   " + bc.Browser + "<br>");
				strLabel.Append("Version   =   " + bc.Version + "<br>");
				strLabel.Append("Major   Version   =   " + bc.MajorVersion + "<br>");
				strLabel.Append("Minor   Version   =   " + bc.MinorVersion + "<br>");
				strLabel.Append("Platform   =   " + bc.Platform + "<br>");
				strLabel.Append("Is   Beta   =   " + bc.Beta + "<br>");
				strLabel.Append("Is   Crawler   =   " + bc.Crawler + "<br>");
				strLabel.Append("Is   AOL   =   " + bc.AOL + "<br>");
				strLabel.Append("Is   Win16   =   " + bc.Win16 + "<br>");
				strLabel.Append("Is   Win32   =   " + bc.Win32 + "<br>");
				strLabel.Append("支持   Frames   =   " + bc.Frames + "<br>");
				strLabel.Append("支持   Tables   =   " + bc.Tables + "<br>");
				strLabel.Append("支持   Cookies   =   " + bc.Cookies + "<br>");
				strLabel.Append("支持   VB   Script   =   " + bc.VBScript + "<br>");
				strLabel.Append("支持   JavaScript   =   " + bc.JavaScript + "<br>");
				strLabel.Append("支持   Java   Applets   =   " + bc.JavaApplets + "<br>");
				strLabel.Append("支持   ActiveX   Controls   =   " + bc.ActiveXControls + "<br>");
				strLabel.Append("CDF   =   " + bc.CDF + "<br>");
				strLabel.Append("W3CDomVersion     =   "   +   bc.W3CDomVersion.ToString() + "<br>");
				strLabel.Append("UserAgent     =   "   +   Request.UserAgent   +   "<br>");
				strLabel.Append("UserLanguages     =   "   +   Request.UserLanguages[0].ToString() + "<br>");
				strLabel.Append("<hr   color='#000099'>");
				strLabel.Append("客户端计算机基本配置:<br>");
				strLabel.Append("UserHostName     =   "   +   Request.UserHostName   +   "<br>");
				strLabel.Append("UserHostAddress     =   "   +   Request.UserHostAddress   +   "<br>");
				Label1.Text   =   strLabel.ToString();
			}*/

			//过客的浏览权限
			if (System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["BorowsArea"])>1)
			{
				if (User.Identity.Name.ToString()=="")
				{
					this.Response.Redirect("Logon.aspx?url="+Server.UrlEncode(this.Request.Url.ToString()));
				}
			}

			//如果用户未登录则显示登录框
			if (User.Identity.Name=="")
			{
                /*if (Request.QueryString["url"] == null)
                {
                    this.Response.Redirect(this.Request.Url.ToString() + "&url=" + Server.UrlEncode(this.Request.Url.ToString()));
                }*/
                Panel2.Visible = false;
			}
			else
			{
				Panel1.Visible=false;
				LblUserName.Text="当前用户:"+User.Identity.Name;
				if (Session["UserGrade"]==null)
					Session["UserGrade"]=DBOperate.GetUserGrade(User.Identity.Name);

				BtnPut.Enabled=false;
				if (System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["Enable"])==1 &&
					(System.Convert.ToDateTime(System.Configuration.ConfigurationSettings.AppSettings["StartTime"])<System.DateTime.Now
					&&System.Convert.ToDateTime(System.Configuration.ConfigurationSettings.AppSettings["EndTime"])>System.DateTime.Now))
					BtnPut.Enabled=true;

                if (Session["UserGrade"].ToString() == "管理员")
                    BtnPut.Enabled = true;

				if (Session["UserGrade"].ToString()=="黑名单")
					BtnPut.Enabled=false;
			}
			
			//弹出页面
			if (Request.QueryString["GG"]==null)
			{
				if (Session["havepop"]==null)
				{
					string pop=System.Configuration.ConfigurationSettings.AppSettings["browerspopup"].ToString();
					if (pop!="")
					{
						//this.Response.Write("<script>window.open('"+pop+"','_blank')</script>");
						this.Response.Write("<script language='javascript'>function ExitWin() {javascript:window.open('"+pop+"', 'content', '');}window.onbeforeunload =ExitWin;</script>");
						Session["havepop"]=1;
					}
				}
			}

			//初始化数据
			if(!IsPostBack)
			{
				BindGrid();
			}
		}

		public void BindGrid()
		{
			try
			{
				int QS;
				if (Request.QueryString["QID"]==null)
					if (Request.QueryString["FID"]==null)
						QS=1;
					else
						QS=System.Convert.ToInt32(Request.QueryString["FID"].ToString());
				else
					QS=System.Convert.ToInt32(Request.QueryString["QID"].ToString());

				//点击次数加1
				DBOperate.ExcSQL("UPDATE Questions SET HiteCounter = HiteCounter + 1 WHERE (Q_ID = "+QS+")");

				DataTable Questions=DBOperate.SelectFormForum("SELECT Q_ID, author, Q_Note, Q_Content, ImageName, HiteCounter, ReleaseTime,ReferTime, BigClass_ID, SmallClass_ID, AnsCounter FROM Questions WHERE (Q_ID = "+QS+")");
				this.DataList_Q.DataSource=Questions;

				//写导航条
				DataRow Q = Questions.Rows[0];
				int BID,SID;
				BID=System.Convert.ToInt32(Q["BigClass_ID"]);
				SID=System.Convert.ToInt32(Q["SmallClass_ID"]);
				navigation="当前位置:<a href='default2.aspx'>"+doughty_cn.inputcon.ConvertString.TitleName(this.Request.Url.ToString())+"</a> → "
					+"<a href='BigcalssList.aspx?BID="+BID+"'>"+Navigation.GetBigClassName(BID)+"</a> → "
					+"<a href='MainList.aspx?BID="+BID+"&SID="+SID+"'>"+Navigation.GetSmallClassName(SID)+"</a> → 帖子内容";
					
				//主题
				Question=Q["Q_Note"].ToString();

				//写标题拦
				this.Response.Write("<title>"+doughty_cn.inputcon.ConvertString.TitleName(this.Request.Url.ToString())+"-"+Question+"</title>");
				PageSize=System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["BrowerList"]);
				CurrentPage = 0;	
				//计算总共有多少记录
				int RecordCount = DBOperate.CalculateARecord(QS);
				lblRecordCount.Text = RecordCount.ToString();
				lblRecordCount2.Text = RecordCount.ToString();
				//计算总共有多少页
				PageCount = (RecordCount+PageSize-1)/PageSize;
				if (PageCount<=0)
					PageCount=1;
				lblPageCount.Text = PageCount.ToString();
				lblPageCount2.Text = PageCount.ToString();

				//获取页面参数
				CurrentPage=1;
				if (Request.QueryString["Page"] != null)
					CurrentPage=Convert.ToInt32(Request.QueryString["Page"]);
				if (PageCount<CurrentPage)
					CurrentPage=PageCount;
				if (CurrentPage<=0)
					CurrentPage=1;
				if (CurrentPage<=1)
					this.DataList_Q.DataBind();

				//设定导入的起终地址
				int StartIndex = (CurrentPage-1)*PageSize;
				this.Datalist_A.DataSource=DBOperate.SelectFormForum("SELECT Ans_ID, Question_ID, Ans_Man, Ans_Content, Ans_Time, ImageName FROM Answers WHERE (Question_ID = "+QS+")",StartIndex,PageSize,"Answers");
				this.Datalist_A.DataBind();

				lnkNext.Enabled = true;
				lnkNext2.Enabled = true;
				lnkPrev.Enabled = true;
				lnkPrev2.Enabled = true;
				if(CurrentPage==(PageCount))
				{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -