feedback_look.aspx.cs

来自「企业网站前台后台源程序,用于大中小型企业网站后台程序开发」· CS 代码 · 共 270 行

CS
270
字号
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
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 BLL;
using Socut.Data;

namespace Websystem
{
	/// <summary>
	/// feedback_look 的摘要说明。
	/// </summary>
	public class feedback_look : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DataGrid MyDataGrid;
		protected System.Web.UI.WebControls.Label lblPageCount;
		protected System.Web.UI.WebControls.Label lblCurrentIndex;
		protected System.Web.UI.WebControls.LinkButton btnFirst1;
		protected System.Web.UI.WebControls.LinkButton btnPrev1;
		protected System.Web.UI.WebControls.LinkButton btnNext1;
		protected System.Web.UI.WebControls.LinkButton btnLast1;
		protected System.Web.UI.WebControls.Label message;
		protected System.Web.UI.WebControls.Label Subject;
		protected System.Web.UI.WebControls.Label Company;
		protected System.Web.UI.WebControls.Label Name;
		protected System.Web.UI.WebControls.Label mail;
		protected System.Web.UI.WebControls.Label Tel;
		protected System.Web.UI.WebControls.Label Fax;
		protected System.Web.UI.WebControls.Label Country;
		protected System.Web.UI.WebControls.Label Address;
		protected System.Web.UI.WebControls.Label Zip;
		protected System.Web.UI.WebControls.Label content;
		protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
		protected user us=new user();
		protected System.Web.UI.WebControls.Label inputtime;
		protected System.Web.UI.WebControls.Label Label1;
		protected messages mes=new messages();
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.Label Label2;

		private void Page_Load(object sender, System.EventArgs e)
		{
			btnFirst1.Text = "First";
			btnPrev1.Text = "Prev";
			btnNext1.Text = "Next";
			btnLast1.Text = "Last";
			BindGrid();
			msg();
			CData myData=new CData();
			DataSet ds=new DataSet();
			string user_IP="";	
			if(Request.ServerVariables["HTTP_VIA"]!=null)
			{ 
				user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); 
			}
			else
			{ 
				user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); 
			} 
			string [] u_ip=user_IP.Split(new char[]{'.'});
			bool look=false;
			int i=1;
			string sql = "select * from IpLock order by id desc";
			ds = myData.GetDataSet(sql, 0, 0, "ip");
			if(ds.Tables[0].Rows.Count>0)
				foreach(DataRow dr in ds.Tables[0].Rows)
				{
					for(int j=1;j<=Convert.ToInt32(dr["ipsame"]);j++)
					{
						if(Convert.ToInt32(u_ip[j])==Convert.ToInt32(dr["ip"+i.ToString()]))
							i++;

					}
					if(Convert.ToInt32(dr["ipsame"])==i)
					{
						look=true;//当条件成立表示IP类似,跳出循环,锁定IP,表示国内不可见

						break;
					}
				}
		
			
			load_new(look);
			load_hot(look);
		}
		//加载最新产品
		private void load_new(bool look)
		{
			CData myData=new CData();
			DataSet ds=new DataSet();
			string str="<table width=100%  border=0 cellspacing=0 cellpadding=0>";
			string  sql="";
			if(look)
				sql = "SELECT  id,MERCHANDISE FROM BU_MERCHANDISE where  ISOPEN=0  ORDER BY ID desc";
			else
				sql = "SELECT  id,MERCHANDISE FROM BU_MERCHANDISE   ORDER BY ID desc";
			ds=myData.GetDataSet(sql,0,8,"cc");
			if(ds.Tables[0].Rows.Count>0)
				foreach(DataRow dr in ds.Tables[0].Rows)
				{
					str+="<tr><td height=23 bgcolor=#D3D3D3 align=left class=wenzi1>&nbsp;&nbsp;&nbsp;&nbsp;::&nbsp;&nbsp;&nbsp;&nbsp;<span class=linkc><a href=productmore.aspx?id="+dr[0].ToString()+">>"+dr[1].ToString()+"</a></span></td> </tr><tr><td height=1></td></tr>";

				}
			str+="</table>";
			this.Label2.Text=str;

		}
		//加载最热产品
		private void load_hot(bool look)
		{
			CData myData=new CData();
			DataSet ds=new DataSet();
			string str="<table width=100%  border=0 cellspacing=0 cellpadding=0>";
			string  sql="";
			if(look)
				sql = "SELECT  id,MERCHANDISE FROM BU_MERCHANDISE where ISOPEN=0 ORDER BY BROWSEDEGREE desc";
			else
				sql = "SELECT  id,MERCHANDISE FROM BU_MERCHANDISE ORDER BY BROWSEDEGREE desc";
			ds=myData.GetDataSet(sql,0,8,"cc");
			if(ds.Tables[0].Rows.Count>0)
				foreach(DataRow dr in ds.Tables[0].Rows)
				{
					str+="<tr><td height=23 bgcolor=#D3D3D3 align=left class=wenzi1>&nbsp;&nbsp;&nbsp;&nbsp;::&nbsp;&nbsp;&nbsp;&nbsp;<span class=linkc><a href=productmore.aspx?id="+dr[0].ToString()+">>"+dr[1].ToString()+"</a></span></td> </tr><tr><td height=1></td></tr>";

				}
			str+="</table>";
			this.Label3.Text=str;


		}
		protected void BindGrid()
		{
			DataSet ds=new DataSet();
			CData myData=new CData();
			string sql = "";
			sql = "select * from MESSAGE order by id desc";
			ds = myData.GetDataSet(sql, 0, 0, "Document");
			this.MyDataGrid.DataSource = ds.Tables["Document"].DefaultView;
			MyDataGrid.DataBind();
			ShowStats();

		}
		public void MyDataGrid_Page(object sender, DataGridPageChangedEventArgs e)
		{
			int startIndex ;
			startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize;
			MyDataGrid.CurrentPageIndex = e.NewPageIndex;
			BindGrid();
			ShowStats();
		}


		private void ShowStats()
		{
			//		lblCurrentIndex.Text = "第 " + (MyDataGrid.CurrentPageIndex + 1).ToString() + " 页";
			lblPageCount.Text = "Page: " +(MyDataGrid.CurrentPageIndex + 1).ToString()+" / "+MyDataGrid.PageCount.ToString() + " ";
		}


		private void MyDataGrid_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}
		public void PagerButtonClick(object sender, EventArgs e)
		{
			string arg = ((LinkButton)sender).CommandArgument.ToString();
			switch(arg)
			{
				case "next":
					if (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1))
					{
						MyDataGrid.CurrentPageIndex += 1;
					}
					break;
				case "prev":
					if (MyDataGrid.CurrentPageIndex > 0)
					{
						MyDataGrid.CurrentPageIndex -= 1;
					}
					break;
				case "last":
					MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1);
					break;
				default:
					MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg);
					break;
			}
			BindGrid();
			ShowStats();
		}
		private void msg()
		{int id=0;
			DataSet ds=new DataSet();
			CData myData=new CData();
			string sql = "";
			try
			{
				id=Convert.ToInt32( Request.QueryString["id"].ToString().Trim());
			}
			catch
			{

			}

			sql = "select * from MESSAGE where id="+id;
			ds = myData.GetDataSet(sql, 0, 0, "MESSAGE");
			if(ds.Tables["MESSAGE"].Rows.Count>0)
			{

				this.Subject.Text=ds.Tables["MESSAGE"].Rows[0]["title"].ToString();
				this.Company.Text=ds.Tables["MESSAGE"].Rows[0]["Company"].ToString();
				this.Name.Text=ds.Tables["MESSAGE"].Rows[0]["user_name"].ToString();
				this.mail.Text=ds.Tables["MESSAGE"].Rows[0]["user_EMAIL"].ToString();
				this.Tel.Text=ds.Tables["MESSAGE"].Rows[0]["USER_TEL"].ToString();
				this.Fax.Text=ds.Tables["MESSAGE"].Rows[0]["Fax"].ToString();
				this.Country.Text=ds.Tables["MESSAGE"].Rows[0]["Country"].ToString();
				this.Address.Text=ds.Tables["MESSAGE"].Rows[0]["Address"].ToString();
				this.Zip.Text=ds.Tables["MESSAGE"].Rows[0]["Zip"].ToString();
				this.content.Text=ds.Tables["MESSAGE"].Rows[0]["content"].ToString();
				this.inputtime.Text=ds.Tables["MESSAGE"].Rows[0]["inputtime"].ToString();
			

			}
			sql = "select * from MESSAGE_again where MESSAGE_id="+id;
			ds = myData.GetDataSet(sql, 0, 0, "MESSAGE_again");
			if(ds.Tables["MESSAGE_again"].Rows.Count>0)
			{string aa="<tr><TD align=\"left\" colspan=\"2\" style=\"border-left-width: 1px; border-right-width: 1px; border-top-style: dotted; border-top-width: 1px; border-bottom-width: 1px\"><b>administrator feedback</b>:<p>";
			
					aa+=ds.Tables["MESSAGE_again"].Rows[0]["MESSAGE_content"].ToString();
				
				
				aa+="</TD> </tr>";

			
				
			
this.Label1.Text=aa;
			}

		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

⌨️ 快捷键说明

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