Beispiel #1
0
        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);
                }
        }
Beispiel #2
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     //网站域名或虚拟目录
     string virtualPath = ConfigurationManager.AppSettings.Get("VirtualPath");
     //登录页地址
     string loginPage = ConfigurationManager.AppSettings.Get("LoginPage");
     if (Context.User.Identity.IsAuthenticated)
     {
         AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
         if ((PermissionID != -1) && (!user.HasPermissionID(PermissionID)))
         {
             Response.Clear();
             Response.Write("<script defer>window.alert('您没有权限进入本页!');history.back();</script>");
             Response.End();
         }
     }
     else
     {
         FormsAuthentication.SignOut();
         Session.Clear();
         Session.Abandon();
         Response.Clear();
         Response.Write("<script defer>window.alert('您没有权限进入本页或当前登录用户已过期!\\n请重新登录或与管理员联系!');parent.location='" + virtualPath + "/" + loginPage + "';</script>");
         Response.End();
     }
 }
Beispiel #3
0
        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");
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string s=Request.Params["UserID"];
            userID=int.Parse(Request.Params["UserID"]);
            currentUser = new User(userID);

            Label1.Text="�û�: "+currentUser.UserName+" ��ɫ����";
            if(!Page.IsPostBack)
            {
                DataSet dsRole=AccountsTool.GetRoleList();
                CheckBoxList1.DataSource=dsRole.Tables[0].DefaultView;
                CheckBoxList1.DataTextField="Description";
                CheckBoxList1.DataValueField="RoleID";
                CheckBoxList1.DataBind();

                AccountsPrincipal newUser = new AccountsPrincipal( currentUser.UserName );

                if ( newUser.Roles.Count > 0 )
                {
                    ArrayList roles = newUser.Roles;
                    for(int i=0; i<roles.Count; i++)
                    {
            //						RoleList.Text += "<li>" + roles[i] + "</li>";
                        foreach(ListItem item in CheckBoxList1.Items)
                        {
                            if(item.Text==roles[i].ToString())item.Selected=true;
                        }
                    }
                }
            }
        }
        /// <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 BindRoles()
        {
            if (DropUserlist.SelectedItem == null)
            {
                return;
            }

            string UserName = DropUserlist.SelectedItem.Text;
            currentUser = new User(UserName);
            AccountsPrincipal newUser = new AccountsPrincipal(UserName);
            
            DataSet dsRole = AccountsTool.GetRoleList();
            chkboxRolelist.DataSource = dsRole.Tables[0].DefaultView;
            chkboxRolelist.DataTextField = "Description";
            chkboxRolelist.DataValueField = "RoleID";
            chkboxRolelist.DataBind();           

            if (newUser.Roles.Count > 0)
            {
                ArrayList roles = newUser.Roles;
                for (int i = 0; i < roles.Count; i++)
                {
                    //RoleList.Text += "<li>" + roles[i] + "</li>";
                    foreach (ListItem item in chkboxRolelist.Items)
                    {
                        if (item.Text == roles[i].ToString()) item.Selected = true;
                    }
                }
            }
 
        }
Beispiel #7
0
		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;					
				}
			}
		}
		private void BindRoles(AccountsPrincipal user)
		{
			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 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();

            }
        }
Beispiel #10
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack) 
			{
                //BindSuppData();								
				User currentUser;
				if(Request["userid"]!=null)
				{
					int userid=int.Parse(Request["userid"]);
					currentUser=new User(userid);					
					if(currentUser==null)
					{
						Response.Write("<script language=javascript>window.alert('该用户不存在!\\');history.back();</script>");
						return;
					}

					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;
                    //    }
                    //}
					

					this.dropStyle.SelectedIndex=currentUser.Style-1;

					AccountsPrincipal user=new AccountsPrincipal(userid);
					BindRoles(user);

					
				}
			}
		}
Beispiel #11
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            userID=int.Parse(Request.Params["UserID"]);
            currentUser = new User(userID);

            Label1.Text="Ϊ�û�: "+currentUser.UserName+" �����ɫ";
            if(!Page.IsPostBack)
            {
            //��ȡ����ʾ���н�ɫ
            DataSet dsRole=AccountsTool.GetRoleList();
            CheckBoxList1.DataSource=dsRole.Tables[0].DefaultView;
            CheckBoxList1.DataTextField="Description";
            CheckBoxList1.DataValueField="RoleID";
            CheckBoxList1.DataBind();

            //��ȡ�û��Ѿ�ӵ�еĽ�ɫ������CheckBoxList�ؼ�����ѡ��״̬
            AccountsPrincipal newUser = new AccountsPrincipal(currentUser.UserName);
            if (newUser.Roles.Count > 0 )
            {
                ArrayList roles = newUser.Roles;
                for(int i=0; i<roles.Count; i++)
                {
                    foreach(ListItem item in CheckBoxList1.Items)
                    {
                        if(item.Text==roles[i].ToString())
                            item.Selected=true;
                    }
                }
            }

            if (newUser.Permissions.Count > 0)
            {
                RoleList.Visible = true;
                ArrayList Permissions = newUser.Permissions;
                RoleList.Text = "�û�ӵ�е�Ȩ���б��<ul>";
                for (int i = 0; i < Permissions.Count; i++)
                {
                    RoleList.Text += "<li>" + Permissions[i] + "</li>";
                }
                RoleList.Text += "</ul>";
            }
            }
        }
Beispiel #12
0
		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 Page_Load(object sender, System.EventArgs e)
        {
            userID=int.Parse(Request.Params["UserID"]);
            currentUser = new User(userID);

            Label1.Text="为用户: "+currentUser.UserName+" 分配角色";
            if(!Page.IsPostBack)
            {
            //获取并显示所有角色
            DataSet dsRole=AccountsTool.GetRoleList();
            CheckBoxList1.DataSource=dsRole.Tables[0].DefaultView;
            CheckBoxList1.DataTextField="Description";
            CheckBoxList1.DataValueField="RoleID";
            CheckBoxList1.DataBind();

            //获取用户已经拥有的角色,遍历CheckBoxList控件设置选中状态
            AccountsPrincipal newUser = new AccountsPrincipal(currentUser.UserName);
            if (newUser.Roles.Count > 0 )
            {
                ArrayList roles = newUser.Roles;
                for(int i=0; i<roles.Count; i++)
                {
                    foreach(ListItem item in CheckBoxList1.Items)
                    {
                        if(item.Text==roles[i].ToString())
                            item.Selected=true;
                    }
                }
            }

            if (newUser.Permissions.Count > 0)
            {
                RoleList.Visible = true;
                ArrayList Permissions = newUser.Permissions;
                RoleList.Text = "用户拥有的权限列表:<ul>";
                for (int i = 0; i < Permissions.Count; i++)
                {
                    RoleList.Text += "<li>" + Permissions[i] + "</li>";
                }
                RoleList.Text += "</ul>";
            }
            }
        }
Beispiel #14
0
        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);

                }

            }
        }
Beispiel #15
0
        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, "�û�������³ɹ�");
                    }

                }
            }
        }
        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);
        }
Beispiel #17
0
		protected void Page_Load(object sender, System.EventArgs e)
		{            			
			if (!Context.User.Identity.IsAuthenticated )
			{
				Session["message"]="你没有通过权限审核!";
				Session["returnPage"]=Request.RawUrl;
				Response.Redirect("../Login.aspx",true);
			}
            
            AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name);			
			if(!user.HasPermission("帐户管理"))
			{
				Session["message"]="你没有帐户管理的权限!";
				Session["returnPage"]=Request.RawUrl;
				Response.Redirect("../Login.aspx",true);
			}

//			int i=user.Roles.Count;
//			string s=user.Roles[0].ToString();
//			bool b=user.Roles.Contains("管理员");
//			i=user.Permissions.Count;
//			s=user.Permissions[0].ToString();
//			b=user.Permissions.Contains("帐户管理");



/*
			Context.User = new AccountsPrincipal(Context.User.Identity.Name);
			if(!((AccountsPrincipal)Context.User).HasPermission("帐户管理"))
			{
				Session["message"]="你没有帐户管理的权限!";
				Session["returnPage"]=Request.RawUrl;
				Response.Redirect("../Login.aspx",true);
			}
*/



		}
Beispiel #18
0
 public bool SetPassword(string UserName, string password)
 {
     byte[]    encPassword = AccountsPrincipal.EncryptPassword(password);
     Data.User user        = new Data.User(PubConstant.ConnectionString);
     return(user.SetPassword(UserName, encPassword));
 }
Beispiel #19
0
        private void BindData()
        {
            #region 权限检查
            if (!Context.User.Identity.IsAuthenticated)
            {
                return;
            }
            AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
            if (user.HasPermissionID(PermId_Modify))
            {
                gridView.Columns[7].Visible = true;
            }
            if (user.HasPermissionID(PermId_Delete))
            {
                gridView.Columns[8].Visible = true;
            }
            #endregion

            string strWhere = "";
            if (Session["strWhereNews"] != null && Session["strWhereNews"].ToString() != "")
            {
                strWhere += Session["strWhereNews"].ToString();
            }
            DataSet ds = new DataSet();
            ds = bll.GetList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            gridView.DataSource = dv;
            gridView.DataBind();

            //分页
            int rows_Count = ds.Tables[0].Rows.Count;
            int page_Size = gridView.PageSize;
            int page_Count = gridView.PageCount;
            int page_Current = gridView.PageIndex + 1;

            lblRowsCount.Text = rows_Count.ToString();
            lblPageCount.Text = page_Count.ToString();
            lblCurrentPage.Text = page_Current.ToString();


            #region 显示页导航

            btnFirst.Enabled = true;
            btnPrev.Enabled = true;
            btnNext.Enabled = true;
            btnLast.Enabled = true;
            if (gridView.PageIndex == 0)
            {
                btnFirst.Enabled = false;
                btnPrev.Enabled = false;
                if (gridView.PageCount == 1)
                {
                    btnLast.Enabled = false;
                    btnNext.Enabled = false;
                }
            }
            else if (gridView.PageIndex == gridView.PageCount - 1)
            {
                btnLast.Enabled = false;
                btnNext.Enabled = false;
            }

            #endregion

        }
Beispiel #20
0
        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>";
            //					}

                }

            }
        }
Beispiel #21
0
 /// <summary>
 /// 设置用户密码
 /// </summary>
 public bool SetPassword(string UserName, string password)
 {
     byte[] cryptPassword = AccountsPrincipal.EncryptPassword(password);
     return(dataUser.SetPassword(UserName, cryptPassword));
 }
Beispiel #22
0
 public User(AccountsPrincipal existingPrincipal)
 {
     this.departmentID = "-1";
     this.userID       = ((SiteIdentity)existingPrincipal.Identity).UserID;
     this.LoadFromID();
 }
Beispiel #23
0
        /// <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();
                }
            }
        }
Beispiel #24
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if(!Page.IsPostBack)
            {
                user=new AccountsPrincipal(Context.User.Identity.Name);
                if(Session["UserInfo"]==null)
                {
                    return ;
                }
                currentUser=(LTP.Accounts.Bus.User)Session["UserInfo"];
                Maticsoft.BLL.SysManage sm=new Maticsoft.BLL.SysManage();
                DataSet ds;
                ds=sm.GetTreeList("");
                BindTreeView("mainFrame",ds.Tables[0]);

                if(this.TreeView1.Nodes.Count==0)
                {
                    strWelcome+="<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;����û���κ�ģ��ķ���Ȩ";
                }

            }
        }
Beispiel #25
0
 /// <summary>
 /// 根据AccountsPrincipal构造
 /// </summary>
 public User(AccountsPrincipal existingPrincipal)
 {
     userID = ((SiteIdentity)existingPrincipal.Identity).UserID;
     LoadFromID();
 }