温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:企业客户管理系统源码
当前文件:
QiYeKeHuGuanLi/Default.aspx.cs,打开代码结构图
QiYeKeHuGuanLi/Default.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
14
public partial class _Default : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
Session["branch"] = "3"; 19
} 20
21
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) 22
{ 23
string strconn = ConfigurationSettings.AppSettings["ConnectionString"]; 24
SqlConnection conn = new SqlConnection(strconn); 25
conn.Open(); 26
string strsql = "select * from sysuser where login='" + Login1.UserName.ToString() + "'and password='"+Login1.Password.ToString()+"'"; 27
SqlCommand cm = new SqlCommand(strsql, conn); 28
SqlDataReader dr = cm.ExecuteReader(); 29
if (dr.Read()) 30
{ 31
//保存用户权限 32
Session["branch"] = dr["branch"]; 33
if (Session["branch"].ToString() == "0") 34
{ 35
//系统管理员登录 36
Response.Redirect("Edituser.aspx"); 37
} 38
else if (Session["branch"].ToString() == "1") 39
{ 40
//销售部登录 41
Response.Redirect("Editproduct.aspx"); 42
} 43
else if (Session["branch"].ToString() == "2") 44
{ 45
//客户部登录 46
Response.Redirect("Editclient.aspx"); 47
} 48
} 49
50
} 51
} 52





}
}