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 System.Data.SqlClient;

namespace free.bbs
{
	/// <summary>
	/// Summary description for hyziliaochakan.
	/// </summary>
	public class hyziliaochakan : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label shijian;
		protected System.Web.UI.WebControls.Label time;
		DateTime now=DateTime.Now;
		protected System.Data.SqlClient.SqlConnection myconn;
		protected System.Web.UI.WebControls.Image touxiang;
		protected System.Web.UI.WebControls.Literal name;
		protected System.Web.UI.WebControls.Literal xingbie;
		protected System.Web.UI.WebControls.Literal shengri;
		protected System.Web.UI.WebControls.Literal jiguan;
		protected System.Web.UI.WebControls.Literal touxian;
		protected System.Web.UI.WebControls.Literal dengji;
		protected System.Web.UI.WebControls.Image fatie;
		protected System.Web.UI.WebControls.Image wenzhang;
		protected System.Web.UI.WebControls.Image jifen;
		protected System.Web.UI.WebControls.Image jinqian;
		protected System.Web.UI.WebControls.Image meili;
		protected System.Web.UI.WebControls.Literal zhuce;
		protected System.Web.UI.WebControls.Literal denglu;
		protected System.Web.UI.WebControls.Image qianming_pic;
		protected System.Web.UI.WebControls.Literal qq;
		protected System.Web.UI.WebControls.Literal icq;
		protected System.Web.UI.WebControls.Literal zhiye;
		protected System.Web.UI.WebControls.Literal tell;
		protected System.Web.UI.WebControls.Literal email1;
		protected System.Web.UI.WebControls.Literal Literal1;
		protected System.Data.SqlClient.SqlCommand mycomm;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			try
			{
				if(Request.Cookies["free_huiyuan"].Value=="dengchu")
					Response.Redirect("error.aspx");
			}
			catch
			{
				Response.Redirect("error.aspx");
			}
			shijian.Text=now.ToString("yyyy-MM-dd");
			time.Text=now.ToString("hh:mm");
			string userid=Request.Params["UserId"];
			myconn=new SqlConnection(Session["str_connection"].ToString());
			myconn.Open();	
			string parth="SELECT * FROM huiyuan WHERE yonghuming= '"+userid+"'";
			mycomm = new SqlCommand(parth,myconn);
			SqlDataReader DR2;
			DR2=mycomm.ExecuteReader();
			if(DR2.Read())
			{
				
				touxiang.ImageUrl=DR2["face"].ToString();
				name.Text=DR2.GetValue(0).ToString();
				Session["name"]=DR2["yonghuming"].ToString();
				shengri.Text=DR2.GetValue(6).ToString();
				xingbie.Text=DR2.GetValue(7).ToString();
				jiguan.Text=DR2["sheng"].ToString()+DR2["shi"].ToString();;
				touxian.Text=DR2.GetValue(14).ToString();
				dengji.Text=DR2.GetValue(17).ToString();
				zhiye.Text=DR2["zhiye"].ToString();
				tell.Text=DR2["dianhua"].ToString();
				qq.Text=DR2["qq"].ToString();
				icq.Text=DR2["icq"].ToString();
				email1.Text=DR2["email"].ToString();
				Literal1.Text=DR2["gerenzhuye"].ToString();
				
				int fatieshu=(int)DR2["fatieshu"]+5;
				int wenzhangshu=(int)DR2["wenzhangshu"]+5;
				int jifen1=(int)DR2["jifen"]+5;
				int jinqian1=(int)DR2["jinqian"]+5;
				int meili1=(int)DR2["meili"]+5;
				if(fatieshu>550)
					fatieshu=550;
				if(wenzhangshu>550)
					wenzhangshu=550;
				if(jifen1>550)
					jifen1=550;
				if(jinqian1>550)
					jinqian1=550;
				if(meili1>550)
					meili1=550;
				fatie.Width=fatieshu;
				wenzhang.Width=wenzhangshu;
				jifen.Width=jifen1;
				jinqian.Width=jinqian1;
				meili.Width=meili1;
				Session["qianming"]=DR2["qianming"].ToString();
				if(DR2["qianming_pic"].ToString()!=null)
				{
					qianming_pic.ImageUrl=DR2["qianming_pic"].ToString();
				}
				else
					qianming_pic.ImageUrl="";
					
				zhuce.Text=DR2["zhuceshijian"].ToString();
				denglu.Text=DR2["lastlogin"].ToString();
				DR2.Close();
				myconn.Close();
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
