public bool SaveSettings() { MessageDisplay msgDisplay = CreateMessageDisplay("OtherAliasName"); int[] postIndexs = _Request.GetList <int>("postindex", Method.Post, new int[0]); string[] aliasNames = StringUtil.Split(_Request.Get("newAlias", Method.Post)); PostIndexAliasSettings settings; settings = new PostIndexAliasSettings(); string otherName = _Request.Get("OtherAliasName", Method.Post); if (string.IsNullOrEmpty(otherName)) { msgDisplay.AddError("通用楼层别名错误"); } else { string s; try { s = string.Format(otherName, 1); } catch { msgDisplay.AddError("通用楼层别名无效"); } } PostAliasNameCollection alias = new PostAliasNameCollection(); for (int i = 0; i < postIndexs.Length; i++) { if (!alias.ContainsKey(postIndexs[i])) { alias.Add(new PostAliasNameItem(postIndexs[i], aliasNames[i])); } else { msgDisplay.AddError("重复的楼层编号"); } } if (!msgDisplay.HasAnyError()) { settings.AliasNames = alias; settings.OtherAliasName = otherName; SettingManager.SaveSettings(settings); return(true); } return(false); }
public bool SaveSettings() { MessageDisplay msgDisplay=CreateMessageDisplay("OtherAliasName"); int[] postIndexs = _Request.GetList<int>("postindex", Method.Post, new int[0]); string[] aliasNames = StringUtil.Split(_Request.Get("newAlias", Method.Post)); PostIndexAliasSettings settings; settings = new PostIndexAliasSettings(); string otherName = _Request.Get("OtherAliasName",Method.Post); if (string.IsNullOrEmpty(otherName)) { msgDisplay.AddError("通用楼层别名错误"); } else { string s; try { s = string.Format(otherName, 1); } catch { msgDisplay.AddError("通用楼层别名无效"); } } PostAliasNameCollection alias = new PostAliasNameCollection(); for (int i = 0; i < postIndexs.Length; i++) { if (!alias.ContainsKey(postIndexs[i])) alias.Add( new PostAliasNameItem( postIndexs[i], aliasNames[i])); else { msgDisplay.AddError("重复的楼层编号"); } } if (!msgDisplay.HasAnyError()) { settings.AliasNames = alias; settings.OtherAliasName = otherName; SettingManager.SaveSettings(settings); return true; } return false; }