示例#1
0
        /// <summary>
        /// 添加新管理员时,点击保存按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lb_save_Click(object sender, EventArgs e)
        {
            string aname     = this.tb_LoginName.Text.Trim();
            string anickname = this.tb_ANickName.Text.Trim();
            string pwd1      = this.tb_LoginPwd1.Text.Trim();
            string pwd2      = this.tb_LoginPwd2.Text.Trim();
            string email     = this.tb_Email.Text.Trim();
            int    gid       = this.ddl_GroupList.SelectedValue.GetInt(0);

            if (gid == 0)
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_GROUP_ERR);
                return;
            }

            if (!aname.IsUserName())
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_USERNAME_ERR);
                return;
            }

            if (anickname.Length == 0 || anickname.Length > 10)
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_NICKNAME_ERR);
                return;
            }

            if (pwd1 != pwd2)
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_PWD_NOT_THE_SAME);
                return;
            }

            if (!email.IsEmail())
            {
                this.Alert(AdminCollect.EDITOR_INFO_ERR_EMAIL_ERR);
                return;
            }

            IAdminManage iamobj = GetInterface.GetIAdminManage();

            int aid = iamobj.Add(aname, pwd1, anickname, email, gid);

            SiteRuleCheck.FlushPageAndRightCache();
            DgBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            int selectedGID = ddl_GroupList.SelectedValue.GetInt(0, false);

            if (selectedGID <= 0)
            {
                this.Alert("必须选择一个预设组,否则将无法登录!");
                return;
            }

            foreach (GridViewRow dvr in adminList.Rows)
            {
                CheckBox cb            = (CheckBox)dvr.FindControl("cb_AName");
                Label    lab_ANickName = (Label)dvr.FindControl("lab_ANickName");
                Label    lab_Email     = (Label)dvr.FindControl("lab_Email");
                if (cb.Checked)
                {
                    iamobj.Add(cb.Text, "", lab_ANickName.Text, lab_Email.Text, selectedGID);
                }
            }
            this.Alert("添加成功!!");
            SiteRuleCheck.FlushPageAndRightCache();
            BindData();
        }