private void StopTalk_Click(object sender, EventArgs e)
        {
            #region 设置禁言

            if (this.CheckCookie())
            {
                userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1));

                if (!AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true))
                {
                    return;
                }

                if (ViewState["Groupid"].ToString() != "4") //当用户不是系统禁言组时
                {
                    if (userInfo.Uid > 1)                   //判断是不是当前uid是不是系统初始化时生成的uid
                    {
                        if (AlbumPluginProvider.GetInstance() != null)
                        {
                            AlbumPluginProvider.GetInstance().Ban(userInfo.Uid);
                        }
                        if (SpacePluginProvider.GetInstance() != null)
                        {
                            SpacePluginProvider.GetInstance().Ban(userInfo.Uid);
                        }
                        Users.UpdateUserToStopTalkGroup(userInfo.Uid.ToString());
                        base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>");
                    }
                }
                else
                {
                    if (CreditsFacade.GetCreditsUserGroupId(0) != null)
                    {
                        int tmpGroupID = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid;
                        Users.UpdateUserGroup(userInfo.Uid, tmpGroupID);
                        base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>");
                    }
                }
                OnlineUsers.DeleteUserByUid(userInfo.Uid);
            }

            #endregion
        }
        private void InitializeComponent()
        {
            this.StopTalk.Click                += new EventHandler(this.StopTalk_Click);
            this.DelPosts.Click                += new EventHandler(this.DelPosts_Click);
            this.SaveUserInfo.Click            += new EventHandler(this.SaveUserInfo_Click);
            this.ResetPassWord.Click           += new EventHandler(this.ResetPassWord_Click);
            this.IsEditUserName.CheckedChanged += new EventHandler(this.IsEditUserName_CheckedChanged);

            this.DelUserInfo.Click         += new EventHandler(this.DelUserInfo_Click);
            this.ReSendEmail.Click         += new EventHandler(this.ReSendEmail_Click);
            this.CalculatorScore.Click     += new EventHandler(this.CalculatorScore_Click);
            this.ResetUserDigestPost.Click += new EventHandler(this.ResetUserDigestPost_Click);
            this.ResetUserPost.Click       += new EventHandler(this.ResetUserPost_Click);

            this.GivenMedal.Click += new EventHandler(this.GivenMedal_Click);
            //UserCredits.UpdateUserCredits(DNTRequest.GetInt("uid", -1));
            userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1));

            UserGroupInfo tmpUserGroupInfo = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits);

            groupid.Items.Add(new ListItem(UserGroups.GetUserGroupInfo(tmpUserGroupInfo.Groupid).Grouptitle, tmpUserGroupInfo.Groupid.ToString()));
            foreach (UserGroupInfo userGroupInfo in UserGroups.GetUserGroupList())
            {
                //if (userGroupInfo.System == 0 && userInfo.Groupid != userGroupInfo.Groupid || userGroupInfo.Groupid == 7)
                //    continue;

                if ((userGroupInfo.System == 0 && userGroupInfo.Radminid == 0) || userGroupInfo.Groupid == 7)
                {
                    continue;
                }
                groupid.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString()));
                extgroupids.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString()));
            }

            templateid.AddTableData(Templates.GetValidTemplateList(), "name", "templateid");
            templateid.Items[0].Text = "默认";
            TabControl1.InitTabPage();

            if (DNTRequest.GetString("uid") == "")
            {
                Response.Redirect("global_usergrid.aspx");
                return;
            }
            LoadCurrentUserInfo(DNTRequest.GetInt("uid", -1));
            LoadScoreInf(DNTRequest.GetString("uid"), DNTRequest.GetString("fieldname"));
        }
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

            if (this.CheckCookie())
            {
                int    uid       = DNTRequest.GetInt("uid", -1);
                string errorInfo = "";

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (userName.Text != ViewState["username"].ToString())
                {
                    if (AdminUsers.GetUserId(userName.Text) > 0)
                    {
                        base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
                        return;
                    }
                }

                if (userName.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
                    return;
                }

                if (groupid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
                    return;
                }

                userInfo             = AdminUsers.GetUserInfo(uid);
                userInfo.Username    = userName.Text;
                userInfo.Nickname    = nickname.Text;
                userInfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue);

                //当用户组发生变化时则相应更新用户的管理组字段
                if (userInfo.Groupid.ToString() != groupid.SelectedValue)
                {
                    userInfo.Adminid = UserGroups.GetUserGroupInfo(int.Parse(groupid.SelectedValue)).Radminid;
                }

                //userInfo.Avatarshowid = 0;

                if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == ""))
                {
                    userInfo.Bday = "";
                }
                else
                {
                    if (!Utils.IsDateString(bday.Text.Trim()))
                    {
                        base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                        return;
                    }
                    else
                    {
                        userInfo.Bday = bday.Text;
                    }
                }


                if (!Users.ValidateEmail(email.Text, uid))
                {
                    base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                    return;
                }

                userInfo.Email  = email.Text;
                userInfo.Gender = Convert.ToInt32(gender.SelectedValue);
                //userInfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);后台操作为永久禁言和永久禁访

                userInfo.Groupexpiry = 0;
                userInfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (userInfo.Uid == BaseConfigs.GetFounderUid))
                {
                    base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>");
                    return;
                }

                userInfo.Groupid      = Convert.ToInt32(groupid.SelectedValue);
                userInfo.Invisible    = Convert.ToInt32(invisible.SelectedValue);
                userInfo.Joindate     = joindate.Text;
                userInfo.Lastactivity = lastactivity.Text;
                userInfo.Lastip       = lastip.Text;
                userInfo.Lastpost     = lastpost.Text;
                userInfo.Lastvisit    = lastvisit.Text;
                userInfo.Newpm        = Convert.ToInt32(newpm.SelectedValue);
                userInfo.Newsletter   = (ReceivePMSettingType)GetNewsLetter();
                userInfo.Oltime       = Convert.ToInt32(oltime.Text);
                userInfo.Pageviews    = Convert.ToInt32(pageviews.Text);
                userInfo.Pmsound      = Convert.ToInt32(pmsound.Text);
                userInfo.Posts        = Convert.ToInt32(posts.Text);
                userInfo.Ppp          = Convert.ToInt32(ppp.Text);
                userInfo.Regip        = regip.Text;
                userInfo.Digestposts  = Convert.ToInt32(digestposts.Text);

                if (secques.SelectedValue == "1")
                {
                    userInfo.Secques = "";                               //清空安全码
                }
                userInfo.Showemail  = Convert.ToInt32(showemail.SelectedValue);
                userInfo.Sigstatus  = Convert.ToInt32(sigstatus.SelectedValue);
                userInfo.Templateid = Convert.ToInt32(templateid.SelectedValue);
                userInfo.Tpp        = Convert.ToInt32(tpp.Text);


                if (Utils.IsNumeric(extcredits1.Text.Replace("-", "")))
                {
                    userInfo.Extcredits1 = float.Parse(extcredits1.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits2.Text.Replace("-", "")))
                {
                    userInfo.Extcredits2 = float.Parse(extcredits2.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits3.Text.Replace("-", "")))
                {
                    userInfo.Extcredits3 = float.Parse(extcredits3.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits4.Text.Replace("-", "")))
                {
                    userInfo.Extcredits4 = float.Parse(extcredits4.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits5.Text.Replace("-", "")))
                {
                    userInfo.Extcredits5 = float.Parse(extcredits5.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits6.Text.Replace("-", "")))
                {
                    userInfo.Extcredits6 = float.Parse(extcredits6.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits7.Text.Replace("-", "")))
                {
                    userInfo.Extcredits7 = float.Parse(extcredits7.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits8.Text.Replace("-", "")))
                {
                    userInfo.Extcredits8 = float.Parse(extcredits8.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }


                //根据公式计算用户的总积分,并更新
                userInfo.Credits = CreditsFacade.GetUserCreditsByUserInfo(userInfo);
                //判断用户组是否为积分用户组。如果是的话,就用当前积分更新。
                if (UserGroups.IsCreditUserGroup(userInfo.Groupid))
                {
                    userInfo.Groupid = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid;
                }
                //用户扩展信息
                userInfo.Website      = website.Text;
                userInfo.Icq          = icq.Text;
                userInfo.Qq           = qq.Text;
                userInfo.Yahoo        = yahoo.Text;
                userInfo.Msn          = msn.Text;
                userInfo.Skype        = skype.Text;
                userInfo.Location     = location.Text;
                userInfo.Customstatus = customstatus.Text;
                //userInfo.Avatar = avatar.Text;
                //userInfo.Avatarheight = Convert.ToInt32(avatarheight.Text);
                //userInfo.Avatarwidth = Convert.ToInt32(avatarwidth.Text);
                userInfo.Bio = bio.Text;
                if (signature.Text.Length > UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize)
                {
                    errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize + " 字符的限制,未能更新。";
                }
                else
                {
                    userInfo.Signature = signature.Text;
                    //签名UBB转换HTML
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(userInfo.Groupid).Allowsigimgcode;
                    _postpramsinfo.Sdetail    = signature.Text;
                    userInfo.Sightml          = UBB.UBBToHTML(_postpramsinfo);
                }

                userInfo.Realname = realname.Text;
                userInfo.Idcard   = idcard.Text;
                userInfo.Mobile   = mobile.Text;
                userInfo.Phone    = phone.Text;
                userInfo.Medals   = DNTRequest.GetString("medalid");

                if (IsEditUserName.Checked && userName.Text != ViewState["username"].ToString())
                {
                    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //用户重命名同步
                    Discuz.Forum.Sync.RenameUser(userInfo.Uid, ViewState["username"].ToString(), userInfo.Username, "");
                }

                if (AdminUsers.UpdateUserAllInfo(userInfo))
                {
                    OnlineUsers.DeleteUserByUid(userInfo.Uid);    //移除该用户的在线信息,使之重建在线表信息
                    if (ViewState["Groupid"].ToString() != userInfo.Groupid.ToString())
                    {
                        if (userInfo.Groupid == 4)
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                        }
                        else
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                        }
                    }
                    //if (userName.Text != ViewState["username"].ToString())
                    //{
                    //    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //}
                    //删除头像
                    if (delavart.Checked)
                    {
                        Avatars.DeleteAvatar(userInfo.Uid.ToString());
                    }
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text);
                    if (errorInfo == "")
                    {
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
예제 #4
0
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

            if (this.CheckCookie())
            {
                int    uid       = DNTRequest.GetInt("uid", -1);
                string errorInfo = "";

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (userName.Text != ViewState["username"].ToString())
                {
                    if (AdminUsers.GetUserID(userName.Text) != -1)
                    {
                        base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
                        return;
                    }
                }

                if (userName.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
                    return;
                }

                if (groupid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
                    return;
                }

                __userinfo             = AdminUsers.GetUserInfo(uid);
                __userinfo.Username    = userName.Text;
                __userinfo.Nickname    = nickname.Text;
                __userinfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue);

                //当用户组发生变化时则相应更新用户的管理组字段
                if (__userinfo.Groupid.ToString() != groupid.SelectedValue)
                {
                    __userinfo.Adminid = DatabaseProvider.GetInstance().GetRadminidByGroupid(int.Parse(groupid.SelectedValue));
                }

                __userinfo.Avatarshowid = 0;

                if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == ""))
                {
                    __userinfo.Bday = "";
                }
                else
                {
                    if (!Utils.IsDateString(bday.Text.Trim()))
                    {
                        base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                        return;
                    }
                    else
                    {
                        __userinfo.Bday = bday.Text;
                    }
                }

                if (Utils.IsNumeric(credits.Text.Replace("-", "")))
                {
                    __userinfo.Credits = Convert.ToInt32(credits.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户的金币不能为空或大于9位 !');</script>");
                    return;
                }

                GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                if (__configinfo.Doublee == 0)
                {
                    int currentuid = AdminUsers.FindUserEmail(email.Text);
                    if ((currentuid != -1) && (currentuid != uid))
                    {
                        base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                        return;
                    }
                }

                __userinfo.Email       = email.Text;
                __userinfo.Gender      = Convert.ToInt32(gender.SelectedValue);
                __userinfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);
                __userinfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (__userinfo.Uid == 1))
                {
                    base.RegisterStartupScript("", "<script>alert('初始化系统管理员的所属用户组设置不能修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>");
                    return;
                }

                __userinfo.Groupid      = Convert.ToInt32(groupid.SelectedValue);
                __userinfo.Invisible    = Convert.ToInt32(invisible.SelectedValue);
                __userinfo.Joindate     = joindate.Text;
                __userinfo.Lastactivity = lastactivity.Text;
                __userinfo.Lastip       = lastip.Text;
                __userinfo.Lastpost     = lastpost.Text;
                __userinfo.Lastvisit    = lastvisit.Text;
                __userinfo.Newpm        = Convert.ToInt32(newpm.SelectedValue);
                __userinfo.Newsletter   = (ReceivePMSettingType)GetNewsLetter();
                __userinfo.Oltime       = Convert.ToInt32(oltime.Text);
                __userinfo.Pageviews    = Convert.ToInt32(pageviews.Text);
                __userinfo.Pmsound      = Convert.ToInt32(pmsound.Text);
                __userinfo.Posts        = Convert.ToInt32(posts.Text);
                __userinfo.Ppp          = Convert.ToInt32(ppp.Text);
                __userinfo.Regip        = regip.Text;
                __userinfo.Digestposts  = Convert.ToInt32(digestposts.Text);

                if (secques.SelectedValue == "1")
                {
                    __userinfo.Secques = "";                               //清空安全码
                }
                __userinfo.Showemail  = Convert.ToInt32(showemail.SelectedValue);
                __userinfo.Sigstatus  = Convert.ToInt32(sigstatus.SelectedValue);
                __userinfo.Templateid = Convert.ToInt32(templateid.SelectedValue);
                __userinfo.Tpp        = Convert.ToInt32(tpp.Text);


                if (Utils.IsNumeric(extcredits1.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits1 = float.Parse(extcredits1.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits2.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits2 = float.Parse(extcredits2.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits3.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits3 = float.Parse(extcredits3.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits4.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits4 = float.Parse(extcredits4.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits5.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits5 = float.Parse(extcredits5.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits6.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits6 = float.Parse(extcredits6.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits7.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits7 = float.Parse(extcredits7.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits8.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits8 = float.Parse(extcredits8.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }


                //用户扩展信息
                __userinfo.Website      = website.Text;
                __userinfo.Icq          = icq.Text;
                __userinfo.Qq           = qq.Text;
                __userinfo.Yahoo        = yahoo.Text;
                __userinfo.Msn          = msn.Text;
                __userinfo.Skype        = skype.Text;
                __userinfo.Location     = location.Text;
                __userinfo.Customstatus = customstatus.Text;
                __userinfo.Avatar       = avatar.Text;
                __userinfo.Avatarheight = Convert.ToInt32(avatarheight.Text);
                __userinfo.Avatarwidth  = Convert.ToInt32(avatarwidth.Text);
                __userinfo.Bio          = bio.Text;
                if (signature.Text.Length > UserGroups.GetUserGroupInfo(__userinfo.Groupid).Maxsigsize)
                {
                    errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(__userinfo.Groupid).Maxsigsize + " 字符的限制,未能更新。";
                }
                else
                {
                    __userinfo.Signature = signature.Text;
                    //签名UBB转换HTML
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(__userinfo.Groupid).Allowsigimgcode;
                    _postpramsinfo.Sdetail    = signature.Text;
                    __userinfo.Sightml        = UBB.UBBToHTML(_postpramsinfo);
                }

                __userinfo.Realname = realname.Text;
                __userinfo.Idcard   = idcard.Text;
                __userinfo.Mobile   = mobile.Text;
                __userinfo.Phone    = phone.Text;
                __userinfo.Medals   = DNTRequest.GetString("medalid");

                if (IsEditUserName.Checked)
                {
                    AdminUsers.UserNameChange(__userinfo, ViewState["username"].ToString());
                }

                if (AdminUsers.UpdateUserAllInfo(__userinfo))
                {
                    if (userName.Text != ViewState["username"].ToString())
                    {
                        AdminUsers.UserNameChange(__userinfo, ViewState["username"].ToString());
                    }
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text);
                    if (errorInfo == "")
                    {
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
예제 #5
0
        public void LoadCurrentUserInfo(int uid)
        {
            #region 加载相关信息

            __userinfo = AdminUsers.GetUserInfo(uid);

            ViewState["username"] = __userinfo.Username;
            userName.Text         = __userinfo.Username;

            //只有在当前用户为等待验证用户, 且系统论坛设置为1时才会显示重发EMAIL按钮
            if ((__userinfo.Groupid == 8) && (config.Regverify == 1))
            {
                ReSendEmail.Visible = true;
            }
            else
            {
                ReSendEmail.Visible = false;
            }

            nickname.Text             = __userinfo.Nickname;
            accessmasks.SelectedValue = __userinfo.Accessmasks.ToString();
            bday.Text            = __userinfo.Bday.Trim();
            credits.Text         = __userinfo.Credits.ToString();
            digestposts.Text     = __userinfo.Digestposts.ToString();
            email.Text           = __userinfo.Email.Trim();
            gender.SelectedValue = __userinfo.Gender.ToString();
            groupexpiry.Text     = __userinfo.Groupexpiry.ToString();

            if (__userinfo.Groupid.ToString() == "")
            {
                groupid.SelectedValue = "0";
            }
            else
            {
                try
                {
                    groupid.SelectedValue = __userinfo.Groupid.ToString();
                }
                catch
                {
                    groupid.SelectedValue = UserCredits.GetCreditsUserGroupID(__userinfo.Credits).Groupid.ToString();
                }
            }

            if (uid == BaseConfigs.GetFounderUid)
            {
                groupid.Enabled = false;
            }

            if (__userinfo.Groupid == 4)
            {
                StopTalk.Text     = "取消禁言";
                StopTalk.HintInfo = "取消禁言将会把当前用户所在的 \\'系统禁言\\' 组进行系统调整成为非禁言组";
            }

            ViewState["Groupid"] = __userinfo.Groupid.ToString();

            invisible.SelectedValue = __userinfo.Invisible.ToString();
            joindate.Text           = __userinfo.Joindate.ToString();
            lastactivity.Text       = __userinfo.Lastactivity.ToString();
            lastip.Text             = __userinfo.Lastip.Trim();
            lastpost.Text           = __userinfo.Lastpost.ToString();
            lastvisit.Text          = __userinfo.Lastvisit;
            newpm.SelectedValue     = __userinfo.Newpm.ToString();
            switch (__userinfo.Newsletter)
            {
            case ReceivePMSettingType.ReceiveNone:
                SetNewsLetter(false, false, false);
                break;

            case ReceivePMSettingType.ReceiveSystemPM:
                SetNewsLetter(true, false, false);
                break;

            case ReceivePMSettingType.ReceiveUserPM:
                SetNewsLetter(false, true, false);
                break;

            case ReceivePMSettingType.ReceiveAllPM:
                SetNewsLetter(true, true, false);
                break;

            case ReceivePMSettingType.ReceiveSystemPMWithHint:
                SetNewsLetter(true, false, true);
                break;

            case ReceivePMSettingType.ReceiveUserPMWithHint:
                SetNewsLetter(false, true, true);
                break;

            default:
                SetNewsLetter(true, true, true);
                break;
            }
            oltime.Text    = __userinfo.Oltime.ToString();
            pageviews.Text = __userinfo.Pageviews.ToString();
            pmsound.Text   = __userinfo.Pmsound.ToString();
            posts.Text     = __userinfo.Posts.ToString();
            ppp.Text       = __userinfo.Ppp.ToString();
            regip.Text     = __userinfo.Regip.Trim();

            showemail.SelectedValue = __userinfo.Showemail.ToString();
            sigstatus.SelectedValue = __userinfo.Sigstatus.ToString();

            if ((__userinfo.Templateid.ToString() != "") && (__userinfo.Templateid.ToString() != "0"))
            {
                templateid.SelectedValue = __userinfo.Templateid.ToString();
            }

            tpp.Text = __userinfo.Tpp.ToString();

            extcredits1.Text = __userinfo.Extcredits1.ToString();
            extcredits2.Text = __userinfo.Extcredits2.ToString();
            extcredits3.Text = __userinfo.Extcredits3.ToString();
            extcredits4.Text = __userinfo.Extcredits4.ToString();
            extcredits5.Text = __userinfo.Extcredits5.ToString();
            extcredits6.Text = __userinfo.Extcredits6.ToString();
            extcredits7.Text = __userinfo.Extcredits7.ToString();
            extcredits8.Text = __userinfo.Extcredits8.ToString();


            //用户扩展信息
            website.Text      = __userinfo.Website;
            icq.Text          = __userinfo.Icq;
            qq.Text           = __userinfo.Qq;
            yahoo.Text        = __userinfo.Yahoo;
            msn.Text          = __userinfo.Msn;
            skype.Text        = __userinfo.Skype;
            location.Text     = __userinfo.Location;
            customstatus.Text = __userinfo.Customstatus;
            avatar.Text       = __userinfo.Avatar;
            avatarheight.Text = __userinfo.Avatarheight.ToString();
            avatarwidth.Text  = __userinfo.Avatarwidth.ToString();
            bio.Text          = __userinfo.Bio;
            signature.Text    = __userinfo.Signature;
            realname.Text     = __userinfo.Realname;
            idcard.Text       = __userinfo.Idcard;
            mobile.Text       = __userinfo.Mobile;
            phone.Text        = __userinfo.Phone;

            givenusername.Text = __userinfo.Username;

            if (__userinfo.Medals.Trim() == "")
            {
                __userinfo.Medals = "0";
            }

            string    begivenmedals = "," + __userinfo.Medals + ",";
            DataTable dt            = DatabaseProvider.GetInstance().GetAvailableMedal();

            if (dt != null)
            {
                DataColumn dc = new DataColumn();
                dc.ColumnName   = "isgiven";
                dc.DataType     = Type.GetType("System.Boolean");
                dc.DefaultValue = false;
                dc.AllowDBNull  = false;
                dt.Columns.Add(dc);

                foreach (DataRow dr in dt.Rows)
                {
                    if (begivenmedals.IndexOf("," + dr["medalid"].ToString() + ",") >= 0)
                    {
                        dr["isgiven"] = true;
                    }
                }
                medalslist.DataSource = dt;
                medalslist.DataBind();
            }

            #endregion
        }