📄 index.aspx.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.Configuration;
using HouseSystem.Components;
using HouseSystem.SQLDAL;
namespace HouseSystem.UserCenter
{
/// <summary>
/// Index 的摘要说明。
/// </summary>
public class Index : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblUserName;
protected System.Web.UI.WebControls.Label lblLoginNum;
protected System.Web.UI.WebControls.Label lblNum1;
protected System.Web.UI.WebControls.Label lblNum2;
protected System.Web.UI.WebControls.Label lblNum3;
protected System.Web.UI.WebControls.Label lblNum4;
protected string WebName;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
this.WebName = ConfigurationSettings.AppSettings["My_WebName"];
if (!this.Page.IsPostBack)
{
if (Tools.IsUserLogin()==false)
{
Response.Redirect("../login.aspx");
}
this.lblUserName.Text = Tools.GetUserCookie("UserName");
this.lblLoginNum.Text = Tools.GetUserCookie("LoginNum");
int num1 = Convert.ToInt32(Tools.GetUserCookie("UserId"));
string text1 = "SELECT COUNT(*) FROM RentSell WHERE Type = 1 AND User_ID = " + num1 + "";
string text2 = "SELECT COUNT(*) FROM RentSell WHERE Type = 2 AND User_ID = " + num1 + "";
string text3 = "SELECT COUNT(*) FROM Need WHERE Type = 1 AND User_ID = " + num1 + "";
string text4 = "SELECT COUNT(*) FROM Need WHERE Type = 2 AND User_ID = " + num1 + "";
string text5 = SQLHelper.ExecuteScalar(text1).ToString();
string text6 = SQLHelper.ExecuteScalar(text2).ToString();
string text7 = SQLHelper.ExecuteScalar(text3).ToString();
string text8 = SQLHelper.ExecuteScalar(text4).ToString();
this.lblNum1.Text = text5;
this.lblNum2.Text = text6;
this.lblNum3.Text = text7;
this.lblNum4.Text = text8;
}
}
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -