private void SaveSmiles_Click(object sender, EventArgs e) { #region 保存对表情信息的编辑 if (this.CheckCookie()) { int rowid = -1; bool error = false; foreach (object o in smilesgrid.GetKeyIDArray()) { string id = o.ToString(); string code = smilesgrid.GetControlValue(rowid, "code"); string displayorder = smilesgrid.GetControlValue(rowid, "displayorder"); string type = smilesgrid.GetControlValue(rowid, "type"); string url = smilesgrid.GetControlValue(rowid, "url"); rowid++; if (code == "" || !Utils.IsNumeric(displayorder) || Smilies.IsExistSameSmilieCode(code, int.Parse(id))) { error = true; continue; } AdminForums.UpdateSmilies(int.Parse(id), int.Parse(displayorder), Utils.StrToInt(type, 0), code, url, userid, username, usergroupid, grouptitle, ip); } if (error) { base.RegisterStartupScript("", "<script>alert('某些记录输入不完整或数据库中已存在相同的表情组名称');window.location.href='forum_smiliemanage.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>window.location.href='forum_smiliemanage.aspx';</script>"); } } #endregion }
private void SaveSmiles_Click(object sender, EventArgs e) { if (base.CheckCookie()) { int num = -1; bool flag = false; foreach (object current in this.smilesgrid.GetKeyIDArray()) { string s = current.ToString(); string controlValue = this.smilesgrid.GetControlValue(num, "code"); string controlValue2 = this.smilesgrid.GetControlValue(num, "displayorder"); string controlValue3 = this.smilesgrid.GetControlValue(num, "type"); string controlValue4 = this.smilesgrid.GetControlValue(num, "url"); num++; if (String.IsNullOrEmpty(controlValue) || !Utils.IsNumeric(controlValue2) || Smilies.IsExistSameSmilieCode(controlValue, int.Parse(s))) { flag = true; } else { AdminForums.UpdateSmilies(int.Parse(s), int.Parse(controlValue2), controlValue3.ToInt(0), controlValue, controlValue4, this.userid, this.username, this.usergroupid, this.grouptitle, this.ip); } } if (flag) { base.RegisterStartupScript("", "<script>alert('某些记录输入不完整或数据库中已存在相同的表情组名称');window.location.href='forum_smiliemanage.aspx';</script>"); return; } base.RegisterStartupScript("", "<script>window.location.href='forum_smiliemanage.aspx';</script>"); } }