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

📄 selectuser.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.Controls
{
    using PowerEasy.Common;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class SelectUser : BaseUserControl
    {
        protected CheckBoxList ChklUserGroupList;
        protected RadioButton RadUserType0;
        protected RadioButton RadUserType1;
        protected RadioButton RadUserType2;
        protected TextBox TxtUserID;

        private string GetUserGroupId(ListControl chklUserGroupList)
        {
            StringBuilder sb = new StringBuilder("");
            for (int i = 0; i < chklUserGroupList.Items.Count; i++)
            {
                if (chklUserGroupList.Items[i].Selected)
                {
                    StringHelper.AppendString(sb, this.ChklUserGroupList.Items[i].Value);
                }
            }
            return sb.ToString();
        }

        protected void GetUserGroupList()
        {
            IList<UserGroupsInfo> userGroupList = UserGroups.GetUserGroupList(0, 0);
            this.ChklUserGroupList.Items.Clear();
            this.ChklUserGroupList.DataSource = userGroupList;
            this.ChklUserGroupList.DataTextField = "GroupName";
            this.ChklUserGroupList.DataValueField = "GroupId";
            this.ChklUserGroupList.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                this.GetUserGroupList();
            }
        }

        public string GroupId
        {
            get
            {
                return this.GetUserGroupId(this.ChklUserGroupList);
            }
        }

        public string UserId
        {
            get
            {
                return this.TxtUserID.Text;
            }
            set
            {
                this.TxtUserID.Text = value;
            }
        }

        public int UserType
        {
            get
            {
                foreach (Control control in this.Controls)
                {
                    if ((!string.IsNullOrEmpty(control.ID) && control.ID.StartsWith("RadUserType")) && ((control is RadioButton) && ((RadioButton) control).Checked))
                    {
                        return DataConverter.CLng(control.ID.Replace("RadUserType", ""));
                    }
                }
                return 0;
            }
            set
            {
                ((RadioButton) this.FindControl("RadUserType" + value)).Checked = true;
            }
        }
    }
}

⌨️ 快捷键说明

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