Пример #1
0
        private void ComAdminUsergroup_Click(object sender, EventArgs e)
        {
            #region 合并管理组

            if (this.CheckCookie())
            {
                if ((sourceadminusergroup.SelectedIndex == 0) || (targetadminusergroup.SelectedIndex == 0))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的管理组!');</script>");
                    return;
                }

                if ((Convert.ToInt32(sourceadminusergroup.SelectedValue) <= 3) || (Convert.ToInt32(sourceadminusergroup.SelectedValue) <= 3))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,您选择的组为系统初始化的管理组,这些组不允许合并!');</script>");
                    return;
                }

                if (sourceadminusergroup.SelectedValue == targetadminusergroup.SelectedValue)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,同一个管理组不能够合并!');</script>");
                    return;
                }

                //删除被合并的源用户组
                //DatabaseProvider.GetInstance().DeleteAdminGroupInfo(int.Parse(sourceadminusergroup.SelectedValue));
                AdminGroups.DeleteAdminGroupInfo(Convert.ToInt16(sourceadminusergroup.SelectedValue));

                //删除被合并的源用户组
                //DatabaseProvider.GetInstance().DeleteUserGroupInfo(int.Parse(sourceadminusergroup.SelectedValue));
                UserGroups.DeleteUserGroupInfo(int.Parse(sourceadminusergroup.SelectedValue));

                //更新用户组中的信息
                //Data.DatabaseProvider.GetInstance().UpdateAdminUsergroup(targetadminusergroup.SelectedValue.ToString(), sourceadminusergroup.SelectedValue.ToString());
                UserGroups.ChangeAllUserGroupId(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetadminusergroup.SelectedValue));

                //Data.DatabaseProvider.GetInstance().ChangeUsergroup(int.Parse(sourceadminusergroup.SelectedValue), int.Parse(targetadminusergroup.SelectedValue));

                DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并管理组", "把组ID:" + sourceusergroup.SelectedIndex + " 合并到组ID:" + targetusergroup.SelectedIndex);
                base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
            }

            #endregion
        }
        private void ComUsergroup_Click(object sender, EventArgs e)
        {
            #region 合并用户组
            if (this.CheckCookie())
            {
                if ((sourceusergroup.SelectedIndex == 0) || (targetusergroup.SelectedIndex == 0))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的用户组!');</script>");
                    return;
                }

                if (sourceusergroup.SelectedValue == targetusergroup.SelectedValue)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,同一个用户组不能够合并!');</script>");
                    return;
                }

                if (UserGroups.GetUserGroupInfo(int.Parse(sourceusergroup.SelectedValue)).Creditslower !=
                    UserGroups.GetUserGroupInfo(int.Parse(targetusergroup.SelectedValue)).Creditshigher)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,要合并的用户组必须是积分相连的两个用户组!');</script>");
                    return;
                }

                //合并用户积分上下限
                UserGroupInfo userGroupInfo = UserGroups.GetUserGroupInfo(int.Parse(targetusergroup.SelectedValue));
                userGroupInfo.Creditshigher = UserGroups.GetUserGroupInfo(int.Parse(sourceusergroup.SelectedValue)).Creditshigher;
                UserGroups.UpdateUserGroup(userGroupInfo);
                //UserGroups.CombinationUserGroupScore(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetusergroup.SelectedValue));
                //删除被合并的源用户组
                //DatabaseProvider.GetInstance().DeleteUserGroupInfo(int.Parse(sourceusergroup.SelectedValue));
                UserGroups.DeleteUserGroupInfo(int.Parse(sourceusergroup.SelectedValue));

                //更新用户组中的信息
                //Data.DatabaseProvider.GetInstance().ChangeUsergroup(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetusergroup.SelectedValue));
                UserGroups.ChangeAllUserGroupId(int.Parse(sourceusergroup.SelectedValue), int.Parse(targetusergroup.SelectedValue));

                DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并用户组", "把组ID:" + sourceusergroup.SelectedIndex + " 合并到组ID:" + targetusergroup.SelectedIndex);
                base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';");
            }

            #endregion
        }