protected void SaveCombinationInfo_Click(object sender, EventArgs e) { #region 保存相册配置 config.Enablealbum = int.Parse(EnableAlbum.SelectedValue); GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config")); if (Utils.IsNumeric(maxalbumcount.Text.ToString()) == true && Utils.IsInt(maxalbumcount.Text.ToString()) == true) { if (config.Enablealbum == 1) { AlbumConfigInfo albumconfiginfo = new AlbumConfigInfo(); albumconfiginfo.MaxAlbumCount = maxalbumcount.Text; AlbumConfigs.SaveConfig(albumconfiginfo); //保存组照片最大空间 DataTable dt = DatabaseProvider.GetInstance().GetUserGroupMaxspacephotosize(); foreach (DataRow dr in dt.Rows) { if (!Utils.IsInt(DNTRequest.GetString("maxspacephotosize" + dr["groupid"].ToString()).ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误,相册大小只能是0或者正整数');window.location.href='album_config.aspx';</script>"); return; } int photosize = DNTRequest.GetInt("maxspacephotosize" + dr["groupid"].ToString(), 0); Discuz.Entity.UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(dr["groupid"].ToString())); __usergroupinfo.Maxspacephotosize = photosize; AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo); } } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); Response.Redirect("album_config.aspx"); } else { base.RegisterStartupScript("", "<script>alert('相册数上限输入错误,请检查');window.location.href='album_config.aspx';</script>"); return; } #endregion }
public void Submit_Click(object sender, EventArgs e) { config.Enablespace = int.Parse(EnableSpace.SelectedValue); GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config")); if (!Utils.IsInt(Postcount.Text)) { base.RegisterStartupScript("", "<script>alert('论坛发帖数超过输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } if (!Utils.IsInt(Digestcount.Text)) { base.RegisterStartupScript("", "<script>alert('论坛精华帖数输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } if (!Utils.IsInt(Score.Text)) { base.RegisterStartupScript("", "<script>alert('论坛用户积分输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } if (config.Enablespace == 1) { XmlDocument xmlDoc = new XmlDocument(); string filePath = Server.MapPath("../../config/space.config"); xmlDoc.Load(filePath); XmlNode root = xmlDoc.SelectSingleNode("SpaceActiveConfigInfo"); XmlNodeInnerTextVisitor rootvisitor = new XmlNodeInnerTextVisitor(); rootvisitor.SetNode(root); rootvisitor["AllowPostcount"] = allowPostcount.Checked ? "1" : "0"; rootvisitor["Postcount"] = Postcount.Text; rootvisitor["AllowDigestcount"] = allowDigestcount.Checked ? "1" : "0"; rootvisitor["Digestcount"] = Digestcount.Text; rootvisitor["AllowScore"] = allowScore.Checked ? "1" : "0"; rootvisitor["Score"] = Score.Text; rootvisitor["AllowUsergroups"] = allowUserGroup.Checked ? "1" : "0"; string groupList = ""; for (int i = 0; i < UserGroup.Items.Count; i++) { if (UserGroup.Items[i].Selected) { groupList += UserGroup.Items[i].Value + ","; } } if (groupList == "") { rootvisitor["Usergroups"] = ""; } else { rootvisitor["Usergroups"] = groupList.Substring(0, groupList.Length - 1); } rootvisitor["ActiveType"] = ActiveType.SelectedValue; xmlDoc.Save(filePath); //保存个人空间最大附件空间 DataTable dt = DatabaseProvider.GetInstance().GetUserGroupMaxspaceattachsize(); foreach (DataRow dr in dt.Rows) { if (!Utils.IsInt(DNTRequest.GetString("maxspaceattachsize" + dr["groupid"].ToString()).ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误,空间附件最大空间只能是0或者正整数');window.location.href='space_spaceapplysetting.aspx';</script>"); return; } int attachsize = DNTRequest.GetInt("maxspaceattachsize" + dr["groupid"].ToString(), 0); Discuz.Entity.UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(dr["groupid"].ToString())); __usergroupinfo.Maxspaceattachsize = attachsize; AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); } Response.Redirect("space_spaceapplysetting.aspx"); }