Пример #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
            if (!this.Page.IsPostBack)
            {
                this.dropRole.DataBind();
            }

            //存储Url参数值 clientUserId
            if (int.TryParse(this.Page.Request.QueryString["userId"], out this.clientUserId))
            {
                //判断是否升级过
                if (ManagerHelper.ExistClientUserId(clientUserId))
                {
                    //已经升级过
                    this.PanelID.Visible  = false;          //禁用保存按钮
                    this.litTitle.Text    = "该用户已经设置为代理商。"; //设置提示
                    this.litTitle.Visible = true;           //显示提示
                }
                else
                {
                    //未升级过,默认选择代理商角色,不能修改
                    IList <RoleInfo> roles = ManagerHelper.GetRoles();//设置部门为代理商
                    for (int i = 0; i < roles.Count; i++)
                    {
                        if (roles[i].RoleName.Contains("代理商"))
                        {
                            //this.dropRole.SelectedValue = roles[i].RoleId;
                            //this.dropRole.Enabled = false;
                            break;
                        }
                    }
                }
            }
        }