private void btnEditVote_Click(object sender, EventArgs e) { if (StoreHelper.GetVoteCounts(this.voteId) > 0) { this.ShowMsg("投票已经开始,不能再对投票选项进行任何操作", false); } else { VoteInfo voteInfo = new VoteInfo(); voteInfo.VoteName = Globals.HtmlEncode(this.txtAddVoteName.Text.Trim()); voteInfo.VoteId = this.voteId; int maxCheck = default(int); if (int.TryParse(this.txtMaxCheck.Text.Trim(), out maxCheck)) { voteInfo.MaxCheck = maxCheck; } else { voteInfo.MaxCheck = -2147483648; } voteInfo.StartDate = this.calendarStartDate.SelectedDate; voteInfo.EndDate = this.calendarEndDate.SelectedDate; voteInfo.IsDisplayAtWX = this.chkDisplayWeixin.Checked; voteInfo.Keys = string.Empty; voteInfo.IsBackup = true; if (this.chkDisplayWeixin.Checked) { if (string.IsNullOrEmpty(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字不能为空!", false); return; } ReplyHelper.DeleteReplyKey(this.txtOldKeys.Value.Trim()); if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } voteInfo.Keys = this.txtKeys.Text.Trim(); string empty = string.Empty; try { string text2 = voteInfo.ImageUrl = this.UploadImage(); this.hidOldImages.Value = voteInfo.ImageUrl; } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } IList <VoteItemInfo> list = null; if (!string.IsNullOrEmpty(this.txtValues.Text.Trim())) { list = new List <VoteItemInfo>(); string text3 = this.txtValues.Text.Trim().Replace("\r\n", "\n"); string[] array = text3.Replace("\n", "*").Split('*'); for (int i = 0; i < array.Length; i++) { VoteItemInfo voteItemInfo = new VoteItemInfo(); if (array[i].Length > 60) { this.ShowMsg("投票选项长度限制在60个字符以内", false); return; } voteItemInfo.VoteItemName = Globals.HtmlEncode(array[i]); list.Add(voteItemInfo); } voteInfo.VoteItems = list; if (this.ValidationVote(voteInfo)) { if (StoreHelper.UpdateVote(voteInfo)) { if (this.txtKeys.Text.Trim().Length > 0 && !string.IsNullOrEmpty(this.hidUploadImages.Value)) { this.CreateVshopKeyReply(voteInfo.VoteId, voteInfo.ImageUrl); } this.ShowMsg("修改投票成功", true); } else { this.ShowMsg("修改投票失败", false); } } } else { this.ShowMsg("投票选项不能为空", false); } } }