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

📄 index.aspx.cs

📁 c#做的WEB disk
💻 CS
字号:
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.Web.Security;
using System.Data.SqlClient;
using System.Configuration;
using webihClass;

namespace ConfirmWebDisk.friendshare
{
	/// <summary>
	/// index 的摘要说明。
	/// </summary>
	public class index : System.Web.UI.Page
	{
		public string HiveId,iHiveId,typesize,dateString,iH_wwwServer,AttachHiveID;
		protected System.Web.UI.WebControls.Table iDeskShareListTable;
		protected System.Web.UI.WebControls.Button addBtn;
		protected System.Web.UI.WebControls.TextBox TextBox1;
		webihClass.iHiveIDClass iHive = new iHiveIDClass();
		public string mail,rss,collection,search,web,tool;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			bool IsAuthen;
			iHiveId = Request.Params[0].ToString();//我的蜂盘号码
			Session["persondiskid"] = iHiveId;
			HiveId = Request.Params[1].ToString();//蜂盘验证号码
			typesize = Request.Params[2].ToString();//蜂盘大小
			AttachHiveID = Request.Params[3].ToString();//附加验证码
			IsAuthen = iHive.IsAuthiHiveID( iHiveId,typesize,HiveId );
			//if( IsAuthen == true && iHive.IsAttachHiveID(AttachHiveID) && Convert.ToBoolean(Request.Cookies["UserInfo"]["IsLogin"]))
			if( IsAuthen == true )
			{

				iH_wwwServer = iH_ServerAddr(iHiveId);
				iHiveFriendShareList(iHiveId);
			}
			else
			{
				Response.Write("<script>alert('系统超时,现在返回登录页面!');location.href='../JLService/Client_SSO.aspx'</script>");
			}

			DataSet ds = new DataSet();
			APP.DataBase DB = new ConfirmWebDisk.friendshare.APP.DataBase();
			ds = DB.ExecuteStoreProc("JL_APPWeb");
			Random rd = new Random(10000);
			mail = ds.Tables[0].Rows[0][0].ToString()+"?Uid="+Session["persondiskid"].ToString()+"&id="+rd.Next().ToString()+"&pid="+(((Convert.ToUInt64(Session["persondiskid"].ToString())+49)*2-1001)*3).ToString();
			rss  = ds.Tables[0].Rows[1][0].ToString()+"?Uid="+Session["persondiskid"].ToString()+"&id="+rd.Next().ToString()+"&pid="+(((Convert.ToUInt64(Session["persondiskid"].ToString())+49)*2-1001)*3).ToString();
			collection = ds.Tables[0].Rows[2][0].ToString()+"?Uid="+Session["persondiskid"].ToString()+"&id="+rd.Next().ToString()+"&pid="+(((Convert.ToUInt64(Session["persondiskid"].ToString())+49)*2-1001)*3).ToString();
			search = ds.Tables[0].Rows[3][0].ToString()+"?Uid="+Session["persondiskid"].ToString()+"&id="+rd.Next().ToString()+"&pid="+(((Convert.ToUInt64(Session["persondiskid"].ToString())+49)*2-1001)*3).ToString();
			web = ds.Tables[0].Rows[4][0].ToString()+"?Uid="+Session["persondiskid"].ToString()+"&id="+rd.Next().ToString()+"&pid="+(((Convert.ToUInt64(Session["persondiskid"].ToString())+49)*2-1001)*3).ToString();
			tool = ds.Tables[0].Rows[4].ToString()+"?Uid="+Session["persondiskid"].ToString()+"&id="+rd.Next().ToString()+"&pid="+(((Convert.ToUInt64(Session["persondiskid"].ToString())+49)*2-1001)*3).ToString();
			// 在此处放置用户代码以初始化页面
		}

		#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

		private void iHiveFriendShareList(string UserID )
		{ 
			string ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"];
			SqlConnection connect = new SqlConnection( ConnectionString );
			SqlCommand command = new SqlCommand("JL_FriendUserList",connect);
			command.CommandType = CommandType.StoredProcedure;

			command.Parameters.Add("@FriendUserID",SqlDbType.BigInt,18,"FriendUserID");
			command.Parameters["@FriendUserID"].Value = UserID;
			
			TableCell tc;
			TableRow tr;
			HyperLink hlink;
			System.Web.UI.WebControls.Image im;
			connect.Open();
			SqlDataReader reader = command.ExecuteReader();
			while( reader.Read() )
			{	

				tr = new TableRow();
				tc = new TableCell();
				im = new System.Web.UI.WebControls.Image();
				im.ImageUrl = "../img/ihivefriend.jpg";
				tc.Controls.Add(im);
				tc.HorizontalAlign = HorizontalAlign.Center;
				tr.Cells.Add(tc);
				tc = new TableCell();
				
				hlink = new HyperLink();
				hlink.Text = GetLoginID(reader["UserID"].ToString());
				string UserFriendSha = iHive.GetShareiHiveID(iHiveId,reader["UserID"].ToString());
				string src = "friendsharelogin.aspx?UserId="+iHiveId+"&iHiveId="+HiveId+"&typesize="+typesize+"&UserFriendID="+reader["UserID"].ToString()+"&UFriendID="+UserFriendSha;
				hlink.Attributes.Add("style","cursor:hand");
				hlink.Attributes.Add("onclick","javascript:iframelocation('"+src+"','"+reader["UserID"].ToString()+"')");
				tc.Attributes.Add("onmouseover","bgColor ='#EDF1F4'");
				tc.Attributes.Add("onmouseout","bgColor = '#FFFFFF'");
				tc.HorizontalAlign = HorizontalAlign.Left;
				tc.Controls.Add( hlink );
				tr.Cells.Add(tc);

				iDeskShareListTable.Rows.Add(tr);
			}
			reader.Close();
			connect.Close();
		}
		private string iH_ServerAddr(string iHiveID)//我的蜂盘服务地址
		{
			string iHiveServerAddr = "http://jlwt.1g.cn/webdisk/";
			SqlConnection Connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlCommand Command = new SqlCommand("Select Hive_www From HD_ServerList",Connection);
			Connection.Open();
			iHiveServerAddr = Command.ExecuteScalar().ToString();
			Connection.Close();
			/*SqlConnection Connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlCommand Command = new SqlCommand("SP_iHiveServerAddr",Connection);
			Command.CommandType = CommandType.StoredProcedure;

			Command.Parameters.Add("@iHiveID",SqlDbType.Int,4);
			Command.Parameters.Add("@iH_www",SqlDbType.VarChar,50,"iH_www");

			Command.Parameters["@iH_www"].Direction = ParameterDirection.Output;
			Command.Parameters["@iHiveID"].Value = iHiveID;
			
			Connection.Open();
			Command.ExecuteNonQuery();
			iHiveServerAddr = Command.Parameters["@iH_www"].Value.ToString();
			Connection.Close();*/

			return iHiveServerAddr;
		}
		private string GetLoginID(string vdiskid)
		{
			string loginId;
			SqlConnection Connection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
			SqlCommand Command = new SqlCommand("Select loginID From JL_Tv_UserInfo Where vdiskid='"+vdiskid+"'",Connection);
			Connection.Open();
			loginId = Command.ExecuteScalar().ToString();
			Connection.Close();

			return loginId;
		}

	}
}

⌨️ 快捷键说明

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