private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { __usergroupinfo.System = 0; __usergroupinfo.Type = 0; __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); __usergroupinfo.Radminid = 0; __usergroupinfo.Grouptitle = groupTitle.Text; __usergroupinfo.Creditshigher = Convert.ToInt32(creditshigher.Text); __usergroupinfo.Creditslower = Convert.ToInt32(creditslower.Text); usergrouppowersetting.GetSetting(ref __usergroupinfo); if (__usergroupinfo.Creditshigher >= __usergroupinfo.Creditslower) { base.RegisterStartupScript("", "<script>alert('操作失败, 金币下限必须小于金币上限');</script>"); return; } if (__usergroupinfo.Allowbonus == 1 && (__usergroupinfo.Minbonusprice >= __usergroupinfo.Maxbonusprice)) { base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>"); return; } __usergroupinfo.Stars = Convert.ToInt32(stars.Text); __usergroupinfo.Color = color.Text; __usergroupinfo.Groupavatar = groupavatar.Text; __usergroupinfo.Maxprice = Convert.ToInt32(maxprice.Text); __usergroupinfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); __usergroupinfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); __usergroupinfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); __usergroupinfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); __usergroupinfo.Attachextensions = attachextensions.GetSelectString(","); __usergroupinfo.Raterange = ""; if (AdminUserGroups.AddUserGroupInfo(__usergroupinfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加用户组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupgrid.aspx';</script>"); } } } #endregion }
private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { __usergroupinfo.System = 0; __usergroupinfo.Type = 0; __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); __usergroupinfo.Allowdirectpost = 1; __usergroupinfo.Allowmultigroups = 0; __usergroupinfo.Allowcstatus = 0; __usergroupinfo.Allowuseblog = 0; __usergroupinfo.Allowinvisible = 0; __usergroupinfo.Allowtransfer = 0; __usergroupinfo.Allowhtml = 0; __usergroupinfo.Allownickname = 0; __usergroupinfo.Allowviewstats = 0; __usergroupinfo.Radminid = -1; __usergroupinfo.Grouptitle = groupTitle.Text; __usergroupinfo.Creditshigher = 0; __usergroupinfo.Creditslower = 0; __usergroupinfo.Stars = Convert.ToInt32(stars.Text); __usergroupinfo.Color = color.Text; __usergroupinfo.Groupavatar = groupavatar.Text; __usergroupinfo.Maxprice = Convert.ToInt32(maxprice.Text); __usergroupinfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); __usergroupinfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); __usergroupinfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); __usergroupinfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); __usergroupinfo.Attachextensions = attachextensions.GetSelectString(","); __usergroupinfo.Raterange = ""; usergrouppowersetting.GetSetting(ref __usergroupinfo); if (AdminUserGroups.AddUserGroupInfo(__usergroupinfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加特殊用户组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupspecialgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } } } #endregion }
/// <summary> /// 增加用户信息 /// </summary> /// <returns>成功否</returns> private bool AddUserGroupInfo() { if (AdminUserGroups.AddUserGroupInfo(userGroupInfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加特殊用户组", "组名:" + groupTitle.Text); return(true); } return(false); }
private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { Hashtable ht = new Hashtable(); ht.Add("附件最大尺寸", maxattachsize.Text); ht.Add("每天最大附件总尺寸", maxsizeperday.Text); ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text); ht.Add("相册空间总尺寸", maxspacephotosize.Text); foreach (DictionaryEntry de in ht) { if (!Utils.IsInt(de.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_editusergroup.aspx';</script>"); return; } } UserGroupInfo userGroupInfo = new UserGroupInfo(); userGroupInfo.System = 0; userGroupInfo.Type = 0; userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); userGroupInfo.Radminid = 0; userGroupInfo.Grouptitle = groupTitle.Text; userGroupInfo.Creditshigher = Convert.ToInt32(creditshigher.Text); userGroupInfo.Creditslower = Convert.ToInt32(creditslower.Text); usergrouppowersetting.GetSetting(ref userGroupInfo); if (userGroupInfo.Creditshigher >= userGroupInfo.Creditslower) { base.RegisterStartupScript("", "<script>alert('操作失败, 积分下限必须小于积分上限');</script>"); return; } if (userGroupInfo.Allowbonus == 1 && (userGroupInfo.Minbonusprice >= userGroupInfo.Maxbonusprice)) { base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>"); return; } userGroupInfo.Stars = Convert.ToInt32(stars.Text); userGroupInfo.Color = color.Text; userGroupInfo.Groupavatar = groupavatar.Text; userGroupInfo.Maxprice = Convert.ToInt32(maxprice.Text); userGroupInfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); userGroupInfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); userGroupInfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); userGroupInfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text); userGroupInfo.Maxspacephotosize = Convert.ToInt32(maxspacephotosize.Text); userGroupInfo.Attachextensions = attachextensions.GetSelectString(","); //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text); userGroupInfo.Raterange = ""; if (AdminUserGroups.AddUserGroupInfo(userGroupInfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加用户组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupgrid.aspx';</script>"); } } } #endregion }
private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { if (radminid.SelectedValue == "0") { base.RegisterStartupScript("", "<script>alert('操作失败,请您选择相应的管理组, 再点击提交按钮!');</script>"); return; } if (groupTitle.Text.Trim() == string.Empty) { base.RegisterStartupScript("", "<script>alert('用户组名称不能为空!');</script>"); return; } Hashtable ht = new Hashtable(); ht.Add("附件最大尺寸", maxattachsize.Text); ht.Add("每天最大附件总尺寸", maxsizeperday.Text); ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text); ht.Add("相册空间总尺寸", maxspacephotosize.Text); foreach (DictionaryEntry de in ht) { if (!Utils.IsInt(de.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_addadminusergroup.aspx';</script>"); return; } } UserGroupInfo userGroupInfo = new UserGroupInfo(); userGroupInfo.System = 0; userGroupInfo.Type = 0; userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); userGroupInfo.Allowdirectpost = 1; userGroupInfo.Allowmultigroups = 0; userGroupInfo.Allowcstatus = 0; userGroupInfo.Allowuseblog = 0; userGroupInfo.Allowinvisible = 0; userGroupInfo.Allowtransfer = 0; userGroupInfo.Allowhtml = 0; userGroupInfo.Allownickname = 0; userGroupInfo.Allowviewstats = 0; userGroupInfo.Grouptitle = groupTitle.Text; userGroupInfo.Creditshigher = Convert.ToInt32(creditshigher.Text); userGroupInfo.Creditslower = Convert.ToInt32(creditslower.Text); userGroupInfo.Stars = Convert.ToInt32(stars.Text); userGroupInfo.Color = color.Text; userGroupInfo.Groupavatar = groupavatar.Text; userGroupInfo.Maxprice = Convert.ToInt32(maxprice.Text); userGroupInfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); userGroupInfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); userGroupInfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); userGroupInfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text); userGroupInfo.Maxspacephotosize = Convert.ToInt32(maxspacephotosize.Text); userGroupInfo.Attachextensions = attachextensions.GetSelectString(","); userGroupInfo.Raterange = ""; userGroupInfo.Radminid = Convert.ToInt32(radminid.SelectedValue); //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text); usergrouppowersetting.GetSetting(ref userGroupInfo); if (AdminUserGroups.AddUserGroupInfo(userGroupInfo)) { #region 是否允许接收举报信息和管理图片评论 GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); //是否允许接收举报信息 int groupid = UserGroups.GetMaxUserGroupId(); if (admingroupright.Items[13].Selected) { if (("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1) { if (configInfo.Reportusergroup == "") { configInfo.Reportusergroup = groupid.ToString(); } else { configInfo.Reportusergroup += "," + groupid.ToString(); } } } //是否允许管理图片评论 if (admingroupright.Items[14].Selected) { if (("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1) { if (configInfo.Photomangegroups == "") { configInfo.Photomangegroups = groupid.ToString(); } else { configInfo.Photomangegroups += "," + groupid.ToString(); } } } GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); #endregion AdminGroupInfo adminGroupInfo = new AdminGroupInfo(); //int adminId = DatabaseProvider.GetInstance().GetMaxUserGroupId() + 1; adminGroupInfo.Admingid = (short)UserGroups.GetMaxUserGroupId(); //插入相应的管理组 adminGroupInfo.Alloweditpost = BoolToByte(admingroupright.Items[0].Selected); adminGroupInfo.Alloweditpoll = BoolToByte(admingroupright.Items[1].Selected); adminGroupInfo.Allowstickthread = (byte)Convert.ToInt16(allowstickthread.SelectedValue); adminGroupInfo.Allowmodpost = 0; adminGroupInfo.Allowdelpost = BoolToByte(admingroupright.Items[2].Selected); adminGroupInfo.Allowmassprune = BoolToByte(admingroupright.Items[3].Selected); adminGroupInfo.Allowrefund = 0; adminGroupInfo.Allowcensorword = 0; adminGroupInfo.Allowviewip = BoolToByte(admingroupright.Items[4].Selected); adminGroupInfo.Allowbanip = 0; adminGroupInfo.Allowedituser = BoolToByte(admingroupright.Items[5].Selected); adminGroupInfo.Allowmoduser = 0; adminGroupInfo.Allowbanuser = 0; adminGroupInfo.Allowpostannounce = 0; adminGroupInfo.Allowviewlog = BoolToByte(admingroupright.Items[6].Selected); adminGroupInfo.Disablepostctrl = BoolToByte(admingroupright.Items[7].Selected); adminGroupInfo.Allowviewrealname = BoolToByte(admingroupright.Items[8].Selected); adminGroupInfo.Allowbanuser = BoolToByte(admingroupright.Items[9].Selected); adminGroupInfo.Allowbanip = BoolToByte(admingroupright.Items[10].Selected); adminGroupInfo.Allowmodpost = BoolToByte(admingroupright.Items[11].Selected); adminGroupInfo.Allowpostannounce = BoolToByte(admingroupright.Items[12].Selected); AdminGroups.CreateAdminGroupInfo(adminGroupInfo); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加管理组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>"); } } #endregion }
private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { UserGroupInfo __usergroupinfo = new UserGroupInfo(); __usergroupinfo.System = 0; __usergroupinfo.Type = 0; __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); __usergroupinfo.Allowdirectpost = 1; __usergroupinfo.Allowmultigroups = 0; __usergroupinfo.Allowcstatus = 0; __usergroupinfo.Allowuseblog = 0; __usergroupinfo.Allowinvisible = 0; __usergroupinfo.Allowtransfer = 0; __usergroupinfo.Allowhtml = 0; __usergroupinfo.Allownickname = 0; __usergroupinfo.Allowviewstats = 0; __usergroupinfo.Grouptitle = groupTitle.Text; __usergroupinfo.Creditshigher = Convert.ToInt32(creditshigher.Text); __usergroupinfo.Creditslower = Convert.ToInt32(creditslower.Text); __usergroupinfo.Stars = Convert.ToInt32(stars.Text); __usergroupinfo.Color = color.Text; __usergroupinfo.Groupavatar = groupavatar.Text; __usergroupinfo.Maxprice = Convert.ToInt32(maxprice.Text); __usergroupinfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); __usergroupinfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); __usergroupinfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); __usergroupinfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); __usergroupinfo.Attachextensions = attachextensions.GetSelectString(","); __usergroupinfo.Raterange = ""; if (radminid.SelectedValue == "0") { base.RegisterStartupScript("", "<script>alert('操作失败,请您选择相应的管理组, 再点击提交按钮!');</script>"); return; } __usergroupinfo.Radminid = Convert.ToInt32(radminid.SelectedValue); usergrouppowersetting.GetSetting(ref __usergroupinfo); if (AdminUserGroups.AddUserGroupInfo(__usergroupinfo)) { //usergrouppowersetting.GetReportAndPhotomangePower(DatabaseProvider.GetInstance().GetMaxUserGroupId(), ref __configinfo); #region 是否允许接收举报信息和管理图片评论 GeneralConfigInfo configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config")); //是否允许接收举报信息 int groupid = DatabaseProvider.GetInstance().GetMaxUserGroupId(); if (admingroupright.Items[11].Selected) { if (("," + configinfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1) { if (configinfo.Reportusergroup == "") { configinfo.Reportusergroup = groupid.ToString(); } else { configinfo.Reportusergroup += "," + groupid.ToString(); } } } //是否允许管理图片评论 if (admingroupright.Items[12].Selected) { if (("," + configinfo.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1) { if (configinfo.Photomangegroups == "") { configinfo.Photomangegroups = groupid.ToString(); } else { configinfo.Photomangegroups += "," + groupid.ToString(); } } } GeneralConfigs.Serialiaze(configinfo, Server.MapPath("../../config/general.config")); #endregion AdminGroupInfo __admingroupinfo = new AdminGroupInfo(); int adminid = DatabaseProvider.GetInstance().GetMaxUserGroupId() + 1; __admingroupinfo.Admingid = (short)adminid; //插入相应的管理组 __admingroupinfo.Alloweditpost = BoolToByte(admingroupright.Items[0].Selected); __admingroupinfo.Alloweditpoll = BoolToByte(admingroupright.Items[1].Selected); __admingroupinfo.Allowstickthread = (byte)Convert.ToInt16(allowstickthread.SelectedValue); __admingroupinfo.Allowmodpost = 0; __admingroupinfo.Allowdelpost = BoolToByte(admingroupright.Items[2].Selected); __admingroupinfo.Allowmassprune = BoolToByte(admingroupright.Items[3].Selected); __admingroupinfo.Allowrefund = 0; __admingroupinfo.Allowcensorword = 0; __admingroupinfo.Allowviewip = BoolToByte(admingroupright.Items[4].Selected); __admingroupinfo.Allowbanip = 0; __admingroupinfo.Allowedituser = BoolToByte(admingroupright.Items[5].Selected); __admingroupinfo.Allowmoduser = 0; __admingroupinfo.Allowbanuser = 0; __admingroupinfo.Allowpostannounce = 0; __admingroupinfo.Allowviewlog = BoolToByte(admingroupright.Items[6].Selected); __admingroupinfo.Disablepostctrl = BoolToByte(admingroupright.Items[7].Selected); __admingroupinfo.Allowviewrealname = BoolToByte(admingroupright.Items[8].Selected); __admingroupinfo.Allowbanuser = BoolToByte(admingroupright.Items[9].Selected); __admingroupinfo.Allowbanip = BoolToByte(admingroupright.Items[10].Selected); AdminGroups.CreateAdminGroupInfo(__admingroupinfo); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加管理组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>"); } } #endregion }