private void GetUserInfo() { string loginPage = ConfigurationManager.AppSettings.Get("LoginPage"); if (HttpContext.Current.User.Identity.IsAuthenticated) { user = new AccountsPrincipal(Context.User.Identity.Name); var permissions = (from p in user.PermissionsID.ToArray() select p.ToString()).ToArray(); PermissionStr = "[" + String.Join(",", permissions) + "]"; if (Session["UserInfo"] == null) { User currentUser = new LTP.Accounts.Bus.User(user); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; } } else { FormsAuthentication.SignOut(); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Redirect(loginPage); } }
public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); if (txtKeyword.Text.Trim() != "") { #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称 strWhere.AppendFormat("name like '%{0}%' and", txtKeyword.Text.Trim()); } AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); strWhere.Append(" [lururen]= '" + currentUser.TrueName+"' "); ds = bll.GetList(500,strWhere.ToString(),"time desc"); gridView.DataSource = ds; gridView.DataBind(); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器 /// 修改此方法的内容。 /// </summary> private void InitializeComponent() { if (!Page.IsPostBack) { string virtualPath = ConfigurationManager.AppSettings.Get("VirtualPath"); if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); if (Session["UserInfo"] == null) { LTP.Accounts.Bus.User currentUser = new LTP.Accounts.Bus.User(user); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; Response.Write("<script defer>location.reload();</script>"); } if ((PermissionID != -1) && (!user.HasPermissionID(PermissionID))) { Response.Clear(); Response.Write("<script defer>window.alert('您没有权限进入本页!\\n请重新登录或与管理员联系');history.back();</script>"); Response.End(); } } else { FormsAuthentication.SignOut(); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Write("<script defer>window.alert('您没有权限进入本页或当前登录用户已过期!\\n请重新登录或与管理员联系!');parent.location='" + virtualPath + "/Login.aspx';</script>"); Response.End(); } } }
private void PageBase_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //权限验证 if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); if (Session["UserInfo"] == null) { LTP.Accounts.Bus.User currentUser = new LTP.Accounts.Bus.User(user); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; Response.Write("<script defer>location.reload();</script>"); } if ((PermissionID != -1) && (!user.HasPermissionID(PermissionID))) { Response.Clear(); Response.Write("<script defer>window.alert('您没有权限进入本页!\\n请重新登录或与管理员联系');history.back();</script>"); Response.End(); } } else { FormsAuthentication.SignOut(); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Write("<script defer>window.alert('您没有权限进入本页或当前登录用户已过期!\\n请重新登录或与管理员联系!');parent.location='" + virtualPath + "/Login.aspx';</script>"); Response.End(); } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { string username = this.lblName.Text.Trim(); AccountsPrincipal user = new AccountsPrincipal(username); User currentUser = new LTP.Accounts.Bus.User(user); currentUser.UserName = username; currentUser.TrueName = txtTrueName.Text.Trim(); currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); if (RadioButton1.Checked) { currentUser.Sex = "男"; } else { currentUser.Sex = "女"; } currentUser.Phone = this.txtPhone.Text.Trim(); currentUser.Email = txtEmail.Text.Trim(); //currentUser.EmployeeID=0; //currentUser.DepartmentID=this.Dropdepart.SelectedValue; int style = int.Parse(this.dropStyle.SelectedValue); currentUser.Style = style; if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; } else { Response.Redirect("Admin/useradmin.aspx"); } }
protected void btnAdd_Click(object sender, System.EventArgs e) { string username=this.lblName.Text.Trim(); AccountsPrincipal user=new AccountsPrincipal(username); User currentUser=new LTP.Accounts.Bus.User(user); currentUser.UserName=username; currentUser.TrueName=txtTrueName.Text.Trim(); if (txtPassword.Text.Trim() != "") { currentUser.NonEncryptPasswordPassword = txtPassword.Text.Trim(); // currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text.Trim()); } if(RadioButton1.Checked) currentUser.Sex="��"; else currentUser.Sex="Ů"; currentUser.Phone=this.txtPhone.Text.Trim(); currentUser.Email=txtEmail.Text.Trim(); currentUser.UserType = dropType.SelectedValue; //currentUser.EmployeeID=0; //currentUser.DepartmentID=this.Dropdepart.SelectedValue; int style=int.Parse(this.dropStyle.SelectedValue); currentUser.Style=style; if (!currentUser.Update()) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text = "�����û���Ϣ��������"; } else { Response.Redirect("/Admin/accounts/useradmin.aspx"); } }
private void loaddata() { Maticsoft.BLL.wuzi wuzi_bll = new BLL.wuzi(); DataTable dt = wuzi_bll.GetList("style = 1").Tables[0]; GridView1.DataSource = dt; GridView1.DataBind(); AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); fengongsi.Text = currentUser.TrueName; Maticsoft.BLL.peixunban1 bll = new Maticsoft.BLL.peixunban1(); DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("[start_time] < '"); strWhere.Append(DateTime.Today.AddDays(30).Date.ToShortDateString()); strWhere.Append("' and [end_time] > '"); strWhere.Append(DateTime.Today.AddDays(-30).Date.ToShortDateString()); strWhere.Append("'"); ds = bll.GetList(strWhere.ToString()); qishu.DataSource = ds; qishu.DataTextField = "name"; qishu.DataValueField = "id"; qishu.DataBind(); shijian.Text = DateTime.Now.ToShortDateString(); }
private void loaddata() { name.Text = DateTime.Now.ToShortDateString() + "填的单据"; return_str(); Maticsoft.BLL.account_detail ac_d = new BLL.account_detail(); dt_all = ac_d.GetList(500, "", " id desc").Tables[0]; DataTable dt = new DataTable(); dt.Columns.Add("id", typeof(int)); for (int i = 1; i < 6; i++) { DataRow row = dt.NewRow(); row["id"] = i; dt.Rows.Add(row); } GridView1.DataSource = dt; GridView1.DataBind(); AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); //lururen.Text = currentUser.TrueName; Maticsoft.BLL.peixunban1 bll = new Maticsoft.BLL.peixunban1(); DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("[start_time] < '"); strWhere.Append(DateTime.Today.AddDays(30).Date.ToShortDateString()); strWhere.Append("' and [end_time] > '"); strWhere.Append(DateTime.Today.AddDays(-30).Date.ToShortDateString()); strWhere.Append("'"); ds = bll.GetList(strWhere.ToString()); qishu.DataSource = ds; qishu.DataTextField = "name"; qishu.DataValueField = "id"; qishu.DataBind(); Maticsoft.BLL.account account_bll = new BLL.account(); DataSet ds2 = account_bll.lururen(""); jingshouren.DataSource = ds2; jingshouren.DataTextField = "lururen"; jingshouren.DataValueField = "lururen"; jingshouren.DataBind(); for (int i = 0; i < jingshouren.Items.Count; i++) { if (jingshouren.Items[i].Value.Trim() == currentUser.TrueName) { jingshouren.Items[i].Selected = true; } } //jingshouren.SelectedValue = currentUser.TrueName; luru_time.Text = DateTime.Now.ToShortDateString(); }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name); User currentUser=new LTP.Accounts.Bus.User(user); this.lblName.Text=currentUser.UserName; } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); this.lblName.Text = currentUser.UserName; } } }
protected void btnSave_Click(object sender, EventArgs e) { string err = gridview_err(); string str = ""; int wuzi_id = 0; AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); string fengongsi = currentUser.TrueName; int num = 0; int peixunbanid = Convert.ToInt16(qishu.SelectedValue); int style = Convert.ToInt16(RadioButtonList1.SelectedValue); DateTime dtime = DateTime.Now; string beizhu = ""; if (err == "") { int i = 0; foreach (GridViewRow row in GridView1.Rows) { num = Convert.ToInt16(((TextBox)row.FindControl("num")).Text); if (num != 0) { beizhu = ((TextBox)row.FindControl("beizhu")).Text; wuzi_id = Convert.ToInt16(((Label)row.FindControl("id")).Text); Maticsoft.Model.wuzi_diaoyong model = new Maticsoft.Model.wuzi_diaoyong(); model.wuzi_id = wuzi_id; model.fengongsi = fengongsi; model.num = num; model.peixunbanid = peixunbanid; model.style = style; model.time = dtime; model.beizhu = beizhu; Maticsoft.BLL.wuzi_diaoyong bll = new Maticsoft.BLL.wuzi_diaoyong(); if (bll.Add(model) > 0) { i++; } ; } } if (i > 0) { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "共调用了" + i + "项物品", "list.aspx"); } } else { MessageBox.Show(this, err); return; } }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { string username = this.lblName.Text.Trim(); AccountsPrincipal user = new AccountsPrincipal(username); User currentUser = new LTP.Accounts.Bus.User(user); currentUser.UserName = username; currentUser.TrueName = txtTrueName.Text.Trim(); if (RadioButton1.Checked) { currentUser.Sex = "男"; } else { currentUser.Sex = "女"; } currentUser.Phone = this.txtPhone.Text.Trim(); currentUser.Email = txtEmail.Text.Trim(); //currentUser.UserType = dropUserType.SelectedValue; int style = int.Parse(this.dropStyle.SelectedValue); currentUser.Style = style; if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; } string virtualPath = ConfigurationManager.AppSettings.Get("VirtualPath"); Session["Style"] = style; Response.Clear(); Response.Write("<SCRIPT LANGUAGE=\"JavaScript\">\n"); Response.Write("<!--\n"); Response.Write("parent.topFrame.location=\"" + virtualPath + "/Admin/top.aspx\";\n"); Response.Write("parent.leftFrame.location=\"" + virtualPath + "/Admin/left.aspx\";\n"); Response.Write("parent.spliterFrame.location=\"" + virtualPath + "/Admin/spliter.aspx\";\n"); Response.Write("parent.mainFrame.location=\"userinfo.aspx\";\n"); // Response.Write("parent.mainFrame.location=\"userinfo.aspx?id="+userName+"\";\n"); Response.Write("//-->\n"); Response.Write("</SCRIPT>"); Response.End(); } }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { string username=this.lblName.Text.Trim(); AccountsPrincipal user=new AccountsPrincipal(username); User currentUser=new LTP.Accounts.Bus.User(user); currentUser.UserName=username; currentUser.TrueName=txtTrueName.Text.Trim(); if(RadioButton1.Checked) currentUser.Sex="男"; else currentUser.Sex="女"; currentUser.Phone=this.txtPhone.Text.Trim(); currentUser.Email=txtEmail.Text.Trim(); //currentUser.UserType = dropUserType.SelectedValue; int style=int.Parse(this.dropStyle.SelectedValue); currentUser.Style=style; if (!currentUser.Update()) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; } else { this.lblMsg.ForeColor=Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; } string virtualPath=ConfigurationManager.AppSettings.Get("VirtualPath"); Session["Style"]=style; Response.Clear(); Response.Write("<SCRIPT LANGUAGE=\"JavaScript\">\n"); Response.Write("<!--\n"); Response.Write("parent.topFrame.location=\""+virtualPath+"/Admin/top.aspx\";\n"); Response.Write("parent.leftFrame.location=\""+virtualPath+"/Admin/left.aspx\";\n"); Response.Write("parent.spliterFrame.location=\""+virtualPath+"/Admin/spliter.aspx\";\n"); Response.Write("parent.mainFrame.location=\"userinfo.aspx\";\n"); // Response.Write("parent.mainFrame.location=\"userinfo.aspx?id="+userName+"\";\n"); Response.Write("//-->\n"); Response.Write("</SCRIPT>"); Response.End(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); this.lblName.Text = currentUser.UserName; txtTrueName.Text = currentUser.TrueName; if (currentUser.Sex == "男") { RadioButton1.Checked = true; } else { RadioButton2.Checked = true; } this.txtPhone.Text = currentUser.Phone; txtEmail.Text = currentUser.Email; // for(int i=0;i<this.Dropdepart.Items.Count;i++) // { // if(this.Dropdepart.Items[i].Value==currentUser.DepartmentID) // { // this.Dropdepart.Items[i].Selected=true; // } // } //for (int i = 0; i < this.dropUserType.Items.Count; i++) //{ // if (this.dropUserType.Items[i].Value == currentUser.UserType) // { // this.dropUserType.Items[i].Selected = true; // } //} this.dropStyle.SelectedIndex = currentUser.Style - 1; // BindRoles(user); } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name); User currentUser=new LTP.Accounts.Bus.User(user); this.lblName.Text=currentUser.UserName; txtTrueName.Text=currentUser.TrueName; if(currentUser.Sex=="��") RadioButton1.Checked=true; else RadioButton2.Checked=true; this.txtPhone.Text=currentUser.Phone; txtEmail.Text=currentUser.Email; // for(int i=0;i<this.Dropdepart.Items.Count;i++) // { // if(this.Dropdepart.Items[i].Value==currentUser.DepartmentID) // { // this.Dropdepart.Items[i].Selected=true; // } // } //for (int i = 0; i < this.dropUserType.Items.Count; i++) //{ // if (this.dropUserType.Items[i].Value == currentUser.UserType) // { // this.dropUserType.Items[i].Selected = true; // } //} this.dropStyle.SelectedIndex=currentUser.Style-1; // BindRoles(user); } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID=new SiteIdentity(User.Identity.Name); if(SID.TestPassword(txtOldPassword.Text)==0) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if(this.txtPassword.Text.Trim()!=this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text="密码输入的不一致!请重试!"; } else { AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name); User currentUser=new LTP.Accounts.Bus.User(user); currentUser.Password=AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; //日志 UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败"); } else { this.lblMsg.ForeColor=Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; //日志 UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功"); } } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID=new SiteIdentity(User.Identity.Name); if(SID.TestPassword(txtOldPassword.Text)==0) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text = "ԭ�����������"; } else if(this.txtPassword.Text.Trim()!=this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text="��������IJ�һ�£������ԣ�"; } else { AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name); User currentUser=new LTP.Accounts.Bus.User(user); currentUser.Password=AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { this.lblMsg.ForeColor=Color.Red; this.lblMsg.Text = "�����û���Ϣ��������"; //��־ UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "�û��������ʧ��"); } else { this.lblMsg.ForeColor=Color.Blue; this.lblMsg.Text = "�û���Ϣ���³ɹ���"; //��־ UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "�û�������³ɹ�"); } } } }
public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); if (currentUser.TrueName != "Maticsoft") { strWhere.Append("id in (select [peixunban_id] from [branch_company]where [fengongsi]= '"); strWhere.Append(currentUser.TrueName); strWhere.Append("')"); } else { strWhere.Append(""); } if (txtKeyword.Text.Trim() != "") { #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称 //strWhere.AppendFormat("keywordField like '%{0}%'", txtKeyword.Text.Trim()); } ds = bll.GetList(strWhere.ToString()); gridView.DataSource = ds; gridView.DataBind(); }
protected void btnAdd_Click(object sender, EventArgs e) { this.doing.Attributes.Add("display", "none"); int userid = int.Parse(this.ddlUser.SelectedValue); string Idlist = ""; int num = this.AllRoleList.Items.Count; for (int i = 0; i < num; i++) { if (this.AllRoleList.Items[i].Selected) { int roleid = int.Parse(this.AllRoleList.Items[i].Value); string description = this.AllRoleList.Items[i].Text; bll.Add(userid,roleid); Idlist += roleid + ","; } } #region 添加日志 //获取当前用户及权限 AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //获取当前用户 User currentUser = new LTP.Accounts.Bus.User(user); try { UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "管理员端 | 系统管理 | 用户角色权函数限设置 | 要关联的用户ID: " + userid + " , 被设置的角色ID: " + Idlist); } catch { UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "管理员端 | 系统管理 | 用户角色权函数限设置 | 要关联的用户ID: " + userid + " , 被设置的角色ID " + Idlist + ", 添加日志失败"); } #endregion ddlUser_SelectedIndexChanged(sender, e); }
protected void btnAdd_Click(object sender, EventArgs e) { this.doing.Attributes.Add("display", "none"); int userid = int.Parse(this.ddlUser.SelectedValue); string Idlist = ""; int num = this.AllRoleList.Items.Count; for (int i = 0; i < num; i++) { if (this.AllRoleList.Items[i].Selected) { int roleid = int.Parse(this.AllRoleList.Items[i].Value); string description = this.AllRoleList.Items[i].Text; //bll.Add(userid,roleid); Idlist += roleid + ","; } } #region 添加日志 //获取当前用户及权限 AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //获取当前用户 User currentUser = new LTP.Accounts.Bus.User(user); try { //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "管理员端 | 系统管理 | 用户角色权函数限设置 | 要关联的用户ID: " + userid + " , 被设置的角色ID: " + Idlist); } catch { //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "管理员端 | 系统管理 | 用户角色权函数限设置 | 要关联的用户ID: " + userid + " , 被设置的角色ID " + Idlist + ", 添加日志失败"); } #endregion ddlUser_SelectedIndexChanged(sender, e); }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "密码输入的不一致!请重试!"; } else { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); //currentUser.Password=AccountsPrincipal.EncryptPassword(txtPassword.Text); currentUser.NonEncryptPasswordPassword = txtPassword.Text; if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败"); } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功"); } } } }
public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); fengongsi.Text = currentUser.TrueName; bindqishu(); bindgridview(); }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "密码输入的不一致!请重试!"; } else { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; } } } }
private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); if (PassErroeCount > 3) { txtUsername.Disabled = true; txtPass.Disabled = true; btnLogin.Enabled = false; this.lblMsg.Text = "�Բ���������¼�����Σ�ϵͳ��¼������"; return; } } #region �����֤�� if ((Session["CheckCode"] != null) && (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "����д����֤���������IJ��� !"; Session["CheckCode"] = null; return; } else { Session["CheckCode"] = null; } } else { Response.Redirect("login.aspx"); } #endregion string userName = LTP.Common.PageValidate.InputText(txtUsername.Value.Trim(), 30); string Password = LTP.Common.PageValidate.InputText(txtPass.Value.Trim(), 30); //��֤��¼��Ϣ�������֤ͨ���ص�ǰ�û�����İ�ȫ��������Ϣ AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName, Password); if (newUser == null)//��¼��Ϣ���� { this.lblMsg.Text = "��½ʧ�ܣ� " + userName; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { //�����û�����������ĵõ��û�������Ϣ�����ڵõ�������Ϣ User currentUser = new LTP.Accounts.Bus.User(newUser); //if (currentUser.UserType != "AA") //{ // this.lblMsg.Text = "��ǹ���Ա�û�����û��Ȩ��¼��̨ϵͳ��"; // return; //} //�ѵ�ǰ�û�����ʵ������Context.User��������������������û���Ϣ���ص�ASP.NET�ṩ����֤��ϵ�� Context.User = newUser; //��֤��ǰ�û����� if (((SiteIdentity)User.Identity).TestPassword(Password) == 0) { this.lblMsg.Text = "���������Ч��"; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else if (currentUser.UserType.Trim() != ((int)UserType.Type.Admin).ToString()) { //Response.Write(currentUser.UserType); this.lblMsg.Text = "��û��Ȩ��½"; return; } else { //���浱ǰ�û�������Ϣ FormsAuthentication.SetAuthCookie(userName, false); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; if (Session["returnPage"] != null) { string returnpage = Session["returnPage"].ToString(); Session["returnPage"] = null; Response.Redirect(returnpage); } else { Response.Redirect("./"); } } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name); User currentUser=new LTP.Accounts.Bus.User(user); this.lblName.Text=currentUser.UserName; this.lblTruename.Text=currentUser.TrueName; this.lblSex.Text=currentUser.Sex; this.lblPhone.Text=currentUser.Phone; this.lblEmail.Text=currentUser.Email; lblUserIP.Text = Request.UserHostAddress; //if(currentUser.DepartmentID=="-1") //{ // string herosoftmana=Maticsoft.Common.ConfigHelper.GetConfigString("AdManager"); // this.lblDepart.Text=herosoftmana; //} //else //{ // if(Maticsoft.Common.PageValidate.IsNumber(currentUser.DepartmentID)) // { // Maticsoft.BLL.ADManage.AdSupplier supp=new Maticsoft.BLL.ADManage.AdSupplier(); // Maticsoft.Model.ADManage.AdSupplier suppmodel=supp.GetModel(int.Parse(currentUser.DepartmentID)); // this.lblDepart.Text=suppmodel.SupplierName; // this.lblModeys.Text=suppmodel.Moneys.ToString(); // } //} switch(currentUser.Style) { case 1: this.lblStyle.Text="默认蓝"; break; case 2: this.lblStyle.Text="橄榄绿"; break; case 3: this.lblStyle.Text="深红"; break; case 4: this.lblStyle.Text="深绿"; break; } // if(user.Roles.Count>0) // { // RoleList.Visible = true; // ArrayList roles = user.Roles; // RoleList.Text = "角色列表:<ul>"; // for(int i=0;i<roles.Count;i++) // { // RoleList.Text+="<li>" + roles[i] + "</li>"; // } // RoleList.Text += "</ul>"; // } // if(user.Permissions.Count>0) // { // RoleList.Visible = true; // ArrayList Permissions = user.Permissions; // RoleList.Text = "权限列表:<ul>"; // for(int i=0;i<Permissions.Count;i++) // { // RoleList.Text+="<li>" + Permissions[i] + "</li>"; // } // RoleList.Text += "</ul>"; // } } } }
protected void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); if (PassErroeCount > 3) { txtUsername.Disabled = true; txtPass.Disabled = true; btnLogin.Enabled = false; this.lblMsg.Text = "对不起,你错误登录了三次,系统登录锁定!"; return; } } #region 检查验证码 if ((Session["CheckCode"] != null) || (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "所填写的验证码与所给的不符 !"; Session["CheckCode"] = null; return; } else { Session["CheckCode"] = null; } } else { Response.Redirect("login.aspx"); } #endregion string userName = LTP.Common.PageValidate.InputText(txtUsername.Value.Trim(), 30); string Password = LTP.Common.PageValidate.InputText(txtPass.Value.Trim(), 30); //验证登录信息,如果验证通过则返回当前用户对象的安全上下文信息 AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName, Password); if (newUser == null)//登录信息不对 { this.lblMsg.Text = "登陆失败: " + userName; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { //根据用户对象的上下文得到用户对象信息,用于得到其他信息 User currentUser = new LTP.Accounts.Bus.User(newUser); //if (currentUser.UserType != "AA") //{ // this.lblMsg.Text = "你非管理员用户,你没有权限登录后台系统!"; // return; //} //把当前用户对象实例赋给Context.User,这样做将会把完整的用户信息加载到ASP.NET提供的验证体系中 Context.User = newUser; //验证当前用户密码 if (((SiteIdentity)User.Identity).TestPassword(Password) == 0) { this.lblMsg.Text = "你的密码无效!"; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { //保存当前用户对象信息 FormsAuthentication.SetAuthCookie(userName, false); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; if (Session["returnPage"] != null) { string returnpage = Session["returnPage"].ToString(); Session["returnPage"] = null; Response.Redirect(returnpage); } else { Response.Redirect("Main.htm"); } } } }
private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); if (PassErroeCount > 3) { txtUsername.Disabled = true; txtPass.Disabled = true; btnLogin.Enabled = false; this.lblMsg.Text = "对不起,你错误登录了三次,系统登录锁定!"; return; } } #region 检查验证码 if ((Session["CheckCode"] != null) && (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "所填写的验证码与所给的不符 !"; Session["CheckCode"] = null; return; } else { Session["CheckCode"] = null; } } else { Response.Redirect("login.aspx"); } #endregion string userName = RuRo.Common.PageValidate.InputText(txtUsername.Value.Trim(), 30); string Password = RuRo.Common.PageValidate.InputText(txtPass.Value.Trim(), 30); //验证登录信息,如果验证通过则返回当前用户对象的安全上下文信息 AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName, Password); if (newUser == null)//登录信息不对 { this.lblMsg.Text = "登陆失败: " + userName; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { //根据用户对象的上下文得到用户对象信息,用于得到其他信息 User currentUser = new LTP.Accounts.Bus.User(newUser); //if (currentUser.UserType != "AA") //{ // this.lblMsg.Text = "你非管理员用户,你没有权限登录后台系统!"; // return; //} //把当前用户对象实例赋给Context.User,这样做将会把完整的用户信息加载到ASP.NET提供的验证体系中 Context.User = newUser; //验证当前用户密码 if (((SiteIdentity)User.Identity).TestPassword(Password) == 0) { this.lblMsg.Text = "你的密码无效!"; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { //保存当前用户对象信息 FormsAuthentication.SetAuthCookie(userName, false); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; if (Session["returnPage"] != null) { string returnpage = Session["returnPage"].ToString(); Session["returnPage"] = null; Response.Redirect(returnpage); } else { Response.Redirect("main.htm"); } } } }
private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); if (PassErroeCount > 3) { txtUsername.Disabled = true; txtPass.Disabled = true; btnLogin.Enabled = false; this.lblMsg.Text = "�Բ���������¼�����Σ�ϵͳ��¼������"; return; } } if ((Session["CheckCode"] != null) || (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "����д����֤���������IJ��� !"; Session["CheckCode"] = null; return; } else { Session["CheckCode"] = null; } } else { Response.Redirect("login.aspx"); } string userName=LTP.Common.PageValidate.InputText(txtUsername.Value.Trim(),30); string Password=LTP.Common.PageValidate.InputText(txtPass.Value.Trim(),30); AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName,Password); if (newUser == null) { this.lblMsg.Text = "��½ʧ�ܣ� " + userName; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { User currentUser=new LTP.Accounts.Bus.User(newUser); //if (currentUser.UserType != "AA") //{ // this.lblMsg.Text = "��ǹ���Ա�û�����û��Ȩ��¼��̨ϵͳ��"; // return; //} Context.User = newUser; if(((SiteIdentity)User.Identity).TestPassword( Password) == 0) { this.lblMsg.Text = "���������Ч��"; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { FormsAuthentication.SetAuthCookie( userName,false ); //��־ //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "��¼�ɹ�"); Session["UserInfo"]=currentUser; Session["Style"]=currentUser.Style; if(Session["returnPage"]!=null) { string returnpage=Session["returnPage"].ToString(); Session["returnPage"]=null; Response.Redirect(returnpage); } else { Response.Redirect("main.htm"); } } } }
private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); if (PassErroeCount > 3) { txtUsername.Disabled = true; txtPass.Disabled = true; btnLogin.Enabled = false; this.lblMsg.Text = "对不起,你错误登录了三次,系统登录锁定!"; return; } } if ((Session["CheckCode"] != null) && (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "所填写的验证码与所给的不符 !"; Session["CheckCode"] = null; return; } else { Session["CheckCode"] = null; } } else { Response.Redirect("login.aspx"); } string userName=Maticsoft.Common.PageValidate.InputText(txtUsername.Value.Trim(),30); string Password=Maticsoft.Common.PageValidate.InputText(txtPass.Value.Trim(),30); AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName,Password); if (newUser == null) { this.lblMsg.Text = "登陆失败: " + userName; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { User currentUser=new LTP.Accounts.Bus.User(newUser); //if (currentUser.UserType != "AA") //{ // this.lblMsg.Text = "你非管理员用户,你没有权限登录后台系统!"; // return; //} Context.User = newUser; if(((SiteIdentity)User.Identity).TestPassword( Password) == 0) { this.lblMsg.Text = "你的密码无效!"; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { FormsAuthentication.SetAuthCookie( userName,false ); //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "登录成功"); Session["UserInfo"]=currentUser; Session["Style"]=currentUser.Style; if(Session["returnPage"]!=null) { string returnpage=Session["returnPage"].ToString(); Session["returnPage"]=null; Response.Redirect(returnpage); } else { Response.Redirect("main.htm"); } } } }
/// <summary> /// 页面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PageBase_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //权限验证 if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); if (Session["UserInfo"] == null) { LTP.Accounts.Bus.User currentUser = new LTP.Accounts.Bus.User(user); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; Response.Write("<script defer>location.reload();</script>"); } if ((PermissionID != -1) && (!user.HasPermissionID(PermissionID))) { Response.Clear(); Response.Write("<script defer>window.alert('您没有权限进入本页!\\n请重新登录或与管理员联系');history.back();</script>"); Response.End(); } } else { FormsAuthentication.SignOut(); Session.Clear(); Session.Abandon(); Response.Clear(); Response.Write("<script defer>window.alert('您没有权限进入本页或当前登录用户已过期!\\n请重新登录或与管理员联系!');parent.location='" + virtualPath + "/Login.aspx';</script>"); Response.End(); } } }
protected void submit_Click(object sender, EventArgs e) { string strErr = ""; if (this.start_detail.Text.Trim().Length == 0) { strErr += "入住时间明细不能为空!\\n"; } if (this.end_detail.Text.Trim().Length == 0) { strErr += "退房时间明细不能为空!\\n"; } if (!PageValidate.IsDecimal(cleaning_fee.Text)) { strErr += "清洁费必须为数字!\\n"; } if (this.fapiao_taitou.Text.Trim().Length == 0) { strErr += "发票抬头不能为空!\\n"; } if (this.fantang.Text.Trim().Length == 0) { strErr += "fantang不能为空!\\n"; } //if (!PageValidate.IsNumber(txtyuedu_shuoming.Text)) //{ // strErr += "yuedu_shuoming格式错误!\\n"; //} if (strErr != "") { MessageBox.Show(this, strErr); return; } AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); bcp.peixunban_id = peixunbanid; bcp.num = num; bcp.start_detail = start_detail.Text.Trim(); bcp.end_detail = end_detail.Text.Trim(); bcp.num_detail = num_detail.Text.Trim(); bcp.cleaning_fee = Convert.ToDecimal(cleaning_fee.Text.Trim()); bcp.fapiao_taitou = fapiao_taitou.Text.Trim(); bcp.basketball_time = basketball_time.Text.Trim(); bcp.fantang = fantang.Text.Trim(); bcp.fangka_print = Convert.ToInt16(fangka_print.SelectedValue); bcp.xishu_yongpin = Convert.ToInt16(xishu.SelectedValue); bcp.fengongsi = currentUser.TrueName; bcp.date = DateTime.Today; Maticsoft.BLL.branch_company bcp_bll = new Maticsoft.BLL.branch_company(); bcp_bll.Add(bcp); Maticsoft.BLL.peixunban1 pxb_bll = new BLL.peixunban1(); pxb.id = peixunbanid; pxb.beizhu = beizhu.Text.Trim(); pxb_bll.Update_beizhu(pxb); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); if (PassErroeCount > 3) { txtUsername.Disabled = true; txtPass.Disabled = true; btnLogin.Enabled = false; this.lblMsg.Text = "对不起,你错误登录了三次,系统登录锁定!"; return; } } if ((Session["CheckCode"] != null) && (Session["CheckCode"].ToString() != "")) { if (Session["CheckCode"].ToString().ToLower() != this.CheckCode.Value.ToLower()) { this.lblMsg.Text = "所填写的验证码与所给的不符 !"; Session["CheckCode"] = null; return; } else { Session["CheckCode"] = null; } } else { Response.Redirect("login.aspx"); } string userName = Maticsoft.Common.PageValidate.InputText(txtUsername.Value.Trim(), 30); string Password = Maticsoft.Common.PageValidate.InputText(txtPass.Value.Trim(), 30); AccountsPrincipal newUser = AccountsPrincipal.ValidateLogin(userName, Password); if (newUser == null) { this.lblMsg.Text = "登陆失败: " + userName; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { User currentUser = new LTP.Accounts.Bus.User(newUser); //if (currentUser.UserType != "AA") //{ // this.lblMsg.Text = "你非管理员用户,你没有权限登录后台系统!"; // return; //} Context.User = newUser; if (((SiteIdentity)User.Identity).TestPassword(Password) == 0) { this.lblMsg.Text = "你的密码无效!"; if ((Session["PassErrorCountAdmin"] != null) && (Session["PassErrorCountAdmin"].ToString() != "")) { int PassErroeCount = Convert.ToInt32(Session["PassErrorCountAdmin"]); Session["PassErrorCountAdmin"] = PassErroeCount + 1; } else { Session["PassErrorCountAdmin"] = 1; } } else { FormsAuthentication.SetAuthCookie(userName, false); //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "登录成功"); Session["UserInfo"] = currentUser; Session["Style"] = currentUser.Style; if (Session["returnPage"] != null) { string returnpage = Session["returnPage"].ToString(); Session["returnPage"] = null; Response.Redirect(returnpage); } else { Response.Redirect("main.htm"); } } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { if (Context.User.Identity.IsAuthenticated) { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); this.lblName.Text = currentUser.UserName; this.lblTruename.Text = currentUser.TrueName; this.lblSex.Text = currentUser.Sex; this.lblPhone.Text = currentUser.Phone; this.lblEmail.Text = currentUser.Email; lblUserIP.Text = Request.UserHostAddress; //if(currentUser.DepartmentID=="-1") //{ // string herosoftmana=Maticsoft.Common.ConfigHelper.GetConfigString("AdManager"); // this.lblDepart.Text=herosoftmana; //} //else //{ // if(Maticsoft.Common.PageValidate.IsNumber(currentUser.DepartmentID)) // { // Maticsoft.BLL.ADManage.AdSupplier supp=new Maticsoft.BLL.ADManage.AdSupplier(); // Maticsoft.Model.ADManage.AdSupplier suppmodel=supp.GetModel(int.Parse(currentUser.DepartmentID)); // this.lblDepart.Text=suppmodel.SupplierName; // this.lblModeys.Text=suppmodel.Moneys.ToString(); // } //} switch (currentUser.Style) { case 1: this.lblStyle.Text = "默认蓝"; break; case 2: this.lblStyle.Text = "橄榄绿"; break; case 3: this.lblStyle.Text = "深红"; break; case 4: this.lblStyle.Text = "深绿"; break; } // if(user.Roles.Count>0) // { // RoleList.Visible = true; // ArrayList roles = user.Roles; // RoleList.Text = "角色列表:<ul>"; // for(int i=0;i<roles.Count;i++) // { // RoleList.Text+="<li>" + roles[i] + "</li>"; // } // RoleList.Text += "</ul>"; // } // if(user.Permissions.Count>0) // { // RoleList.Visible = true; // ArrayList Permissions = user.Permissions; // RoleList.Text = "权限列表:<ul>"; // for(int i=0;i<Permissions.Count;i++) // { // RoleList.Text+="<li>" + Permissions[i] + "</li>"; // } // RoleList.Text += "</ul>"; // } } } }