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

📄 usermanage.aspx.cs

📁 1、用SQL查询器打开install目录下的dooogo.sql运行之后创建数据库dooogo。 2、然后打开web.config修改 <DbProvider type="Club.Fram
💻 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 Club.Framework;
using Club.Framework.Components;
using Club.Framework.Configuration;
using Club.Framework.Data;
namespace Club.Manage
{
	/// <summary>
	/// UserManage 的摘要说明。
	/// </summary>
	public class UserManage : System.Web.UI.Page
	{	
		protected Club.Common.SqlPager pageList;
		protected System.Web.UI.WebControls.Repeater rptList;
		protected System.Web.UI.HtmlControls.HtmlForm Form1;
		protected System.Web.UI.WebControls.Label txtCount;
		protected System.Web.UI.WebControls.Button btnSearch;
		protected System.Web.UI.WebControls.TextBox txtKeywrod;
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!FormSecurity.IsInRole("-1"))
			{
				throw new AdminException("对不起,你没有管理的权限!",Globals.UrlFormats.ClubManage());
			}
			if(!Page.IsPostBack)
			{
				bindPage();
			}
		}
		private void bindPage()
		{
			this.pageList.SelectCommand = "select * from c_user";
			this.pageList.CurrentPageIndex = 0;
			this.pageList.ConnectionString=Config.Settings.WebProviders.DbProvider.ConnectionString;
			this.pageList.SortField = "[RegisterDate]";
			this.pageList.DataBind();
			txtCount.Text = this.pageList.RecordCount.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);
			this.rptList.ItemCommand+=new RepeaterCommandEventHandler(rptList_ItemCommand);
			this.btnSearch.Click+=new EventHandler(btnSearch_Click);

		}
		#endregion

		private void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
		{
			int id=int.Parse(((TextBox)e.Item.FindControl("txtId")).Text);
			if(e.CommandName=="Delete")
			{
				userDelete(id);
				this.pageList.DataBind();
				txtCount.Text = this.pageList.RecordCount.ToString();
				return ;
			}
			if(e.CommandName=="Login")
			{
				Response.Cookies["AdminUserId"].Value=id.ToString();
				Response.Redirect("~/ClubManage/");
			}
			if(e.CommandName=="Edit")
			{
				Response.Redirect("~/Manage/UserEdit.aspx?RegisterId="+id);
			}
		}
		private bool userDelete(int id)
		{
			FileHelper.DelFolder(Globals.GetFilePath(Config.ClubPhotoPath+id+"\\"),true);
			FileHelper.DelFolder(Globals.GetFilePath(Config.ClubSPhotoPath+id+"\\"),true);
			FileHelper.DelFolder(Globals.GetFilePath(Config.ClubMusicPath+id+"\\"),true);
			return Globals.DbProvider.Delete_c_UserByID(id);
		}

		private void btnSearch_Click(object sender, EventArgs e)
		{
			this.pageList.SelectCommand = "select * from c_user where userName='"+this.txtKeywrod.Text+"' or niceName like'%"+this.txtKeywrod.Text+"%'";
			this.pageList.DataBind();
		}
	}
}

⌨️ 快捷键说明

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