private void btnAddActivity_Click(object sender, EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { int maxValue = 0; if (!this.txtStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择开始日期!", false); } else if (!this.txtEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择结束日期!", false); } else { DateTime dateTime = this.txtStartDate.SelectedDate.Value; if (dateTime.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0) { this.ShowMsg("开始日期不能晚于结束日期!", false); } else if (this.txtMaxValue.Text != "" && !int.TryParse(this.txtMaxValue.Text, out maxValue)) { this.ShowMsg("人数上限格式错误!", false); } else { VActivityInfo vActivityInfo = new VActivityInfo(); vActivityInfo.CloseRemark = this.txtCloseRemark.Text.Trim(); vActivityInfo.Description = this.txtDescription.Text.Trim(); VActivityInfo vActivityInfo2 = vActivityInfo; dateTime = this.txtEndDate.SelectedDate.Value; dateTime = dateTime.AddMinutes(59.0); vActivityInfo2.EndDate = dateTime.AddSeconds(59.0); vActivityInfo.Item1 = this.txtItem1.Text.Trim(); vActivityInfo.Item2 = this.txtItem2.Text.Trim(); vActivityInfo.Item3 = this.txtItem3.Text.Trim(); vActivityInfo.Item4 = this.txtItem4.Text.Trim(); vActivityInfo.Item5 = this.txtItem5.Text.Trim(); vActivityInfo.Keys = this.txtKeys.Text.Trim(); vActivityInfo.MaxValue = maxValue; vActivityInfo.Name = this.txtName.Text.Trim(); vActivityInfo.PicUrl = this.UploadImage(); vActivityInfo.StartDate = this.txtStartDate.SelectedDate.Value; if (VShopHelper.SaveActivity(vActivityInfo)) { base.Response.Redirect("ManageActivity.aspx"); } else { this.ShowMsg("添加失败", false); } } } } }
protected void btnUpdateTopic_Click(object sender, System.EventArgs e) { TopicInfo topic = VShopHelper.Gettopic(this.topicId); if (topic.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { if (this.fileUpload.HasFile) { try { ResourcesHelper.DeleteImage(topic.IconUrl); topic.IconUrl = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); this.imgPic.ImageUrl = topic.IconUrl; } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } topic.TopicId = this.topicId; topic.Title = this.txtTopicTitle.Text.Trim(); topic.Keys = this.txtKeys.Text.Trim(); topic.IconUrl = topic.IconUrl; topic.Content = this.fcContent.Text; topic.AddedDate = System.DateTime.Now; topic.IsRelease = true; ValidationResults results = Validation.Validate <TopicInfo>(topic, new string[] { "ValTopicInfo" }); string msg = string.Empty; if (results.IsValid) { if (VShopHelper.Updatetopic(topic)) { this.ShowMsg("已经成功修改当前专题", true); } else { this.ShowMsg("修改专题失败", false); } } else { foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results) { msg += Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } } }
protected void btnAddTopic_Click(object sender, System.EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { string str = string.Empty; if (this.fileUpload.HasFile) { try { str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } TopicInfo target = new TopicInfo { Title = this.txtTopicTitle.Text.Trim(), Keys = this.txtKeys.Text.Trim(), IconUrl = str, Content = this.fcContent.Text, AddedDate = System.DateTime.Now, IsRelease = true }; ValidationResults results = Validation.Validate <TopicInfo>(target, new string[] { "ValTopicInfo" }); string msg = string.Empty; if (results.IsValid) { int num; if (VShopHelper.Createtopic(target, out num) && num > 0) { base.Response.Redirect("SetTopicProducts.aspx?topicid=" + num); } else { this.ShowMsg("添加专题错误", false); } } else { foreach (ValidationResult result in (System.Collections.Generic.IEnumerable <ValidationResult>)results) { msg += Formatter.FormatErrorMessage(result.Message); } this.ShowMsg(msg, false); } } }
protected void btnAddTopic_Click(object sender, System.EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } string iconUrl = string.Empty; if (this.fileUpload.HasFile) { try { iconUrl = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } TopicInfo topicInfo = new TopicInfo(); topicInfo.Title = this.txtTopicTitle.Text.Trim(); topicInfo.Keys = this.txtKeys.Text.Trim(); topicInfo.IconUrl = iconUrl; topicInfo.Content = this.fcContent.Text; topicInfo.AddedDate = System.DateTime.Now; topicInfo.IsRelease = true; ValidationResults validationResults = Validation.Validate <TopicInfo>(topicInfo, new string[] { "ValTopicInfo" }); string text = string.Empty; if (!validationResults.IsValid) { foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults) { text += Formatter.FormatErrorMessage(current.Message); } this.ShowMsg(text, false); } else { int num; if (VShopHelper.Createtopic(topicInfo, out num) && num > 0) { base.Response.Redirect("SetTopicProducts.aspx?topicid=" + num); return; } this.ShowMsg("添加专题错误", false); return; } }
private void btnAddActivity_Click(object sender, EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { int result = 0; if (!this.txtStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择开始日期!", false); } else if (!this.txtEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择结束日期!", false); } else if (this.txtStartDate.SelectedDate.Value.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0) { this.ShowMsg("开始日期不能晚于结束日期!", false); } else if ((this.txtMaxValue.Text != "") && !int.TryParse(this.txtMaxValue.Text, out result)) { this.ShowMsg("人数上限格式错误!", false); } else { ActivityInfo activity = new ActivityInfo { CloseRemark = this.txtCloseRemark.Text.Trim(), Description = this.txtDescription.Text.Trim(), EndDate = this.txtEndDate.SelectedDate.Value.AddMinutes(59.0).AddSeconds(59.0), Item1 = this.txtItem1.Text.Trim(), Item2 = this.txtItem2.Text.Trim(), Item3 = this.txtItem3.Text.Trim(), Item4 = this.txtItem4.Text.Trim(), Item5 = this.txtItem5.Text.Trim(), Keys = this.txtKeys.Text.Trim(), MaxValue = result, Name = this.txtName.Text.Trim(), PicUrl = this.uploader1.UploadedImageUrl, StartDate = this.txtStartDate.SelectedDate.Value }; if (VShopHelper.SaveActivity(activity)) { base.Response.Redirect("ManageActivity.aspx"); } else { this.ShowMsg("添加失败", false); } } } }
private void btnEditActivity_Click(object sender, EventArgs e) { int result = 0; if (!this.txtStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择开始日期!", false); } else if (!this.txtEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择结束日期!", false); } else if (this.txtStartDate.SelectedDate.Value.CompareTo(this.txtEndDate.SelectedDate.Value) >= 0) { this.ShowMsg("开始日期不能晚于结束日期!", false); } else if ((this.txtMaxValue.Text != "") && !int.TryParse(this.txtMaxValue.Text, out result)) { this.ShowMsg("人数上限格式错误!", false); } else { ActivityInfo activity = VShopHelper.GetActivity(base.GetUrlIntParam("id")); if ((activity.Keys != this.txtKeys.Text.Trim()) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { activity.CloseRemark = this.txtCloseRemark.Text.Trim(); activity.Description = this.txtDescription.Text.Trim(); activity.EndDate = this.txtEndDate.SelectedDate.Value.AddMinutes(59.0).AddSeconds(59.0); activity.Item1 = this.txtItem1.Text.Trim(); activity.Item2 = this.txtItem2.Text.Trim(); activity.Item3 = this.txtItem3.Text.Trim(); activity.Item4 = this.txtItem4.Text.Trim(); activity.Item5 = this.txtItem5.Text.Trim(); activity.Keys = this.txtKeys.Text.Trim(); activity.MaxValue = result; activity.Name = this.txtName.Text.Trim(); activity.PicUrl = this.uploader1.UploadedImageUrl; activity.StartDate = this.txtStartDate.SelectedDate.Value; if (VShopHelper.UpdateActivity(activity)) { base.Response.Redirect("ManageActivity.aspx"); } else { this.ShowMsg("更新失败", false); } } } }
private void btnSubmit_Click(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { TextReplyInfo info = new TextReplyInfo(); info.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { info.Keys = this.txtKeys.Text.Trim(); } info.Text = this.fcContent.Text.Trim(); info.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); if (this.chkKeys.Checked) { info.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { info.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { info.ReplyType |= ReplyType.NoMatch; } if (info.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else { if (ReplyHelper.SaveReply(info)) { Hishop.Weixin.MP.Domain.TemplateMessage msg = new Hishop.Weixin.MP.Domain.TemplateMessage(); this.ShowMsg("添加成功", true); } else { this.ShowMsg("添加失败", false); } } } }
private void btnSubmit_Click(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } TextReplyInfo textReplyInfo = new TextReplyInfo(); textReplyInfo.IsDisable = !this.radDisable.SelectedValue; if ((this.chkKeys.Checked || this.chkKefu.Checked) && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { textReplyInfo.Keys = this.txtKeys.Text.Trim(); } textReplyInfo.Text = this.fcContent.Text.Trim(); textReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); if (this.chkKeys.Checked) { textReplyInfo.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { textReplyInfo.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { textReplyInfo.ReplyType |= ReplyType.NoMatch; } if (this.chkKefu.Checked) { textReplyInfo.ReplyType |= ReplyType.Kefu; } if (textReplyInfo.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); return; } if (ReplyHelper.SaveReply(textReplyInfo)) { this.ShowMsg("添加成功", true); return; } this.ShowMsg("添加失败", false); }
protected void btnAddActivity_Click(object sender, EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); } else if (!this.calendarOpenDate.SelectedDate.HasValue) { this.ShowMsg("请选择抽奖开始时间", false); } else if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动结束时间", false); } else { string str = string.Empty; if (this.fileUpload.HasFile) { try { str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } string str2 = string.Empty; for (int i = 0; i < this.cbList.Items.Count; i++) { if (this.cbList.Items[i].Selected) { str2 = str2 + "," + this.cbList.Items[i].Value; } } if (!string.IsNullOrEmpty(str2)) { LotteryTicketInfo info = new LotteryTicketInfo { GradeIds = str2, MinValue = Convert.ToInt32(this.txtMinValue.Text), InvitationCode = this.txtCode.Text.Trim(), ActivityName = this.txtActiveName.Text, ActivityKey = this.txtKeyword.Text, ActivityDesc = this.txtdesc.Text, ActivityPic = str, ActivityType = 4, StartTime = this.calendarStartDate.SelectedDate.Value, OpenTime = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex), EndTime = this.calendarEndDate.SelectedDate.Value, PrizeSettingList = new List <PrizeSetting>() }; try { PrizeSetting item = new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖" }; info.PrizeSettingList.Add(item); PrizeSetting setting2 = new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖" }; info.PrizeSettingList.Add(setting2); PrizeSetting setting3 = new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖" }; info.PrizeSettingList.Add(setting3); } catch (FormatException) { this.ShowMsg("奖品数量格式错误", false); return; } if (this.ChkOpen.Checked) { try { PrizeSetting setting4 = new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖" }; info.PrizeSettingList.Add(setting4); PrizeSetting setting5 = new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖" }; info.PrizeSettingList.Add(setting5); PrizeSetting setting6 = new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖" }; info.PrizeSettingList.Add(setting6); } catch (FormatException) { this.ShowMsg("奖品数量格式错误", false); return; } } int num2 = VShopHelper.SaveLotteryTicket(info); if (num2 > 0) { ReplyInfo reply = new TextReplyInfo { Keys = info.ActivityKey, MatchType = MatchType.Equal, MessageType = MessageType.Text, ReplyType = ReplyType.Ticket, ActivityId = num2 }; ReplyHelper.SaveReply(reply); base.Response.Redirect("ManageLotteryTicket.aspx"); } } else { this.ShowMsg("请选择活动会员等级", false); } } }
protected void btnSave_Click(object sender, EventArgs e) { NewsReplyInfo info; int num = Globals.ToNum(this.hdfMessageType.Value); int articleIDByOldArticle = Globals.ToNum(this.hdfArticleID.Value); MessageType msgtype = (MessageType)num; int num3 = Globals.ToNum(this.rbtlMatchType.SelectedValue); if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && (this.type != "subscribe")) { this.ShowMsg("请输入关键词!", false); return; } if (this.txtKeys.Text.Trim().Length > 50) { this.ShowMsg("关键词必须少于50个字!", false); return; } if (num3 == 0) { this.ShowMsg("请选择匹配类型!", false); return; } if ((articleIDByOldArticle < 1) && (msgtype != MessageType.Text)) { if (this.hdfIsOldArticle.Value == "0") { this.ShowMsg("请先选择图文!", false); return; } if (this.replyID > 0) { articleIDByOldArticle = ReplyHelper.GetArticleIDByOldArticle(this.replyID, msgtype); } } switch (msgtype) { case MessageType.Text: if (this.fkContent.Text.Length <= 0x3e8) { TextReplyInfo reply = new TextReplyInfo { Keys = this.txtKeys.Text.Trim(), MatchType = (num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch) }; if (reply.Keys == "*") { reply.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键字回复回复内容已存在!", false); return; } } else if (this.type == "subscribe") { if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复内容已存在!", false); return; } reply.ReplyType = ReplyType.Subscribe; reply.Keys = ""; } else { reply.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(reply.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } reply.MessageType = msgtype; reply.IsDisable = false; reply.ArticleID = articleIDByOldArticle; string str = Regex.Replace(Regex.Replace(Regex.Replace(this.fkContent.Text, "</?([^>^a^p]*)>", ""), "<img([^>]*)>", ""), "<ul([^>]*)>", ""); reply.Text = str; reply.Id = this.replyID; if (string.IsNullOrEmpty(reply.Text)) { this.ShowMsg("请填写文本内容!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(reply); } else { ReplyHelper.SaveReply(reply); } goto Label_03D5; } this.ShowMsg("回复内容必须1000字以内!", false); return; case MessageType.News: case MessageType.List: info = new NewsReplyInfo { Keys = this.txtKeys.Text.Trim(), MatchType = (num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch) }; if (!(info.Keys == "*")) { if (this.type == "subscribe") { info.ReplyType = ReplyType.Subscribe; info.Keys = ""; if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复已存在!", false); return; } } else { info.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(info.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } break; } info.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) <= 0) { break; } this.ShowMsg("无关键词回复已存在!", false); return; default: goto Label_03D5; } info.MessageType = msgtype; info.IsDisable = false; info.ArticleID = articleIDByOldArticle; info.Id = this.replyID; if (num3 < 1) { this.ShowMsg("请选择类型!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(info); } else { ReplyHelper.SaveReply(info); } Label_03D5: if (this.replyID > 0) { this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx"); } else { this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx"); } }
protected void btnSave_Click(object sender, System.EventArgs e) { int num = Globals.ToNum(this.hdfMessageType.Value); int num2 = Globals.ToNum(this.hdfArticleID.Value); MessageType messageType = (MessageType)num; int num3 = Globals.ToNum(this.rbtlMatchType.SelectedValue); if (string.IsNullOrEmpty(this.txtKeys.Text.Trim()) && this.type != "subscribe") { this.ShowMsg("请输入关键词!", false); return; } if (this.txtKeys.Text.Trim().Length > 50) { this.ShowMsg("关键词必须少于50个字!", false); return; } if (num3 == 0) { this.ShowMsg("请选择匹配类型!", false); return; } if (num2 < 1 && messageType != MessageType.Text) { if (this.hdfIsOldArticle.Value == "0") { this.ShowMsg("请先选择图文!", false); return; } if (this.replyID > 0) { num2 = ReplyHelper.GetArticleIDByOldArticle(this.replyID, messageType); } } switch (messageType) { case MessageType.Text: { if (this.fkContent.Text.Length > 1000) { this.ShowMsg("回复内容必须1000字以内!", false); return; } TextReplyInfo textReplyInfo = new TextReplyInfo(); textReplyInfo.Keys = this.txtKeys.Text.Trim(); textReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch)); if (textReplyInfo.Keys == "*") { textReplyInfo.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键字回复回复内容已存在!", false); return; } } else if (this.type == "subscribe") { if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复内容已存在!", false); return; } textReplyInfo.ReplyType = ReplyType.Subscribe; textReplyInfo.Keys = ""; } else { textReplyInfo.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(textReplyInfo.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } textReplyInfo.MessageType = messageType; textReplyInfo.IsDisable = false; textReplyInfo.ArticleID = num2; string text = this.fkContent.Text; text = System.Text.RegularExpressions.Regex.Replace(text, "</?([^>^a^p]*)>", ""); text = System.Text.RegularExpressions.Regex.Replace(text, "<img([^>]*)>", ""); text = text.Replace("<p>", ""); text = text.Replace("</p>", "\r"); text = text.Trim(new char[] { '\r' }); text = text.Replace("\r", "\r\n"); textReplyInfo.Text = text; textReplyInfo.Id = this.replyID; if (string.IsNullOrEmpty(textReplyInfo.Text)) { this.ShowMsg("请填写文本内容!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(textReplyInfo); } else { ReplyHelper.SaveReply(textReplyInfo); } break; } case MessageType.News: case MessageType.List: { NewsReplyInfo newsReplyInfo = new NewsReplyInfo(); newsReplyInfo.Keys = this.txtKeys.Text.Trim(); newsReplyInfo.MatchType = ((num3 == 2) ? MatchType.Equal : ((num3 == 1) ? MatchType.Like : MatchType.NoMatch)); if (newsReplyInfo.Keys == "*") { newsReplyInfo.ReplyType = ReplyType.NoMatch; if (ReplyHelper.GetNoMatchReplyID(this.replyID) > 0) { this.ShowMsg("无关键词回复已存在!", false); return; } } else if (this.type == "subscribe") { newsReplyInfo.ReplyType = ReplyType.Subscribe; newsReplyInfo.Keys = ""; if (ReplyHelper.GetSubscribeID(this.replyID) > 0) { this.ShowMsg("首次关注回复已存在!", false); return; } } else { newsReplyInfo.ReplyType = ReplyType.Keys; if (ReplyHelper.HasReplyKey(newsReplyInfo.Keys, this.replyID)) { this.ShowMsg("该关键词已存在!", false); return; } } newsReplyInfo.MessageType = messageType; newsReplyInfo.IsDisable = false; newsReplyInfo.ArticleID = num2; newsReplyInfo.Id = this.replyID; if (num3 < 1) { this.ShowMsg("请选择类型!", false); return; } if (this.replyID > 0) { ReplyHelper.UpdateReply(newsReplyInfo); } else { ReplyHelper.SaveReply(newsReplyInfo); } break; } } if (this.replyID > 0) { this.ShowMsgAndReUrl("自动回复修改成功!", true, "replyonkey.aspx"); return; } this.ShowMsgAndReUrl("自动回复添加成功!", true, "replyonkey.aspx"); }
protected void Page_Load(object sender, System.EventArgs e) { this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { return; } if (string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { return; } string value = base.Request.Form["MultiArticle"]; System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject(value, typeof(System.Collections.Generic.List <ArticleList>)) as System.Collections.Generic.List <ArticleList>; if (list != null && list.Count > 0) { NewsReplyInfo newsReplyInfo = new NewsReplyInfo(); newsReplyInfo.MessageType = MessageType.List; newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true"); if (base.Request.Form["chkKeys"] == "true") { newsReplyInfo.Keys = base.Request.Form.Get("Keys"); } if (!string.IsNullOrWhiteSpace(newsReplyInfo.Keys) && ReplyHelper.HasReplyKey(newsReplyInfo.Keys)) { base.Response.Write("key"); base.Response.End(); } newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>(); foreach (ArticleList current in list) { if (current.Status != "del") { NewsMsgInfo newsMsgInfo = current; if (newsMsgInfo != null) { newsMsgInfo.Reply = newsReplyInfo; list2.Add(newsMsgInfo); } } } newsReplyInfo.NewsMsg = list2; if (ReplyHelper.SaveReply(newsReplyInfo)) { base.Response.Write("true"); base.Response.End(); } } }
protected void btnAddActivity_Click(object sender, EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { string str = string.Empty; if (this.fileUpload.HasFile) { try { str = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); } else if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动结束时间", false); } else { int num; if (!int.TryParse(this.txtMaxNum.Text, out num) || (num.ToString() != this.txtMaxNum.Text)) { this.ShowMsg("可抽奖次数必须是整数", false); } else { int num2; LotteryActivityInfo info = new LotteryActivityInfo { ActivityName = this.txtActiveName.Text, ActivityKey = this.txtKeyword.Text, ActivityDesc = this.txtdesc.Text, ActivityPic = str, ActivityType = this.type, StartTime = this.calendarStartDate.SelectedDate.Value, EndTime = this.calendarEndDate.SelectedDate.Value, MaxNum = Convert.ToInt32(this.txtMaxNum.Text) }; List <PrizeSetting> list = new List <PrizeSetting>(); if ((int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2)) && int.TryParse(this.txtPrize3Num.Text, out num2)) { decimal num3 = Convert.ToDecimal(this.txtProbability1.Text); decimal num4 = Convert.ToDecimal(this.txtProbability2.Text); decimal num5 = Convert.ToDecimal(this.txtProbability3.Text); List <PrizeSetting> collection = new List <PrizeSetting>(); PrizeSetting item = new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖", Probability = num3 }; collection.Add(item); PrizeSetting setting2 = new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖", Probability = num4 }; collection.Add(setting2); PrizeSetting setting3 = new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖", Probability = num5 }; collection.Add(setting3); list.AddRange(collection); } else { this.ShowMsg("奖品数量必须为数字!", false); return; } if (this.ChkOpen.Checked) { if ((string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text)) || string.IsNullOrEmpty(this.txtPrize6.Text)) { this.ShowMsg("开启四五六名必须填写", false); return; } if ((int.TryParse(this.txtPrize4Num.Text, out num2) && int.TryParse(this.txtPrize5Num.Text, out num2)) && int.TryParse(this.txtPrize6Num.Text, out num2)) { decimal num6 = Convert.ToDecimal(this.txtProbability4.Text); decimal num7 = Convert.ToDecimal(this.txtProbability5.Text); decimal num8 = Convert.ToDecimal(this.txtProbability6.Text); List <PrizeSetting> list3 = new List <PrizeSetting>(); PrizeSetting setting4 = new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖", Probability = num6 }; list3.Add(setting4); PrizeSetting setting5 = new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖", Probability = num7 }; list3.Add(setting5); PrizeSetting setting6 = new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖", Probability = num8 }; list3.Add(setting6); list.AddRange(list3); } else { this.ShowMsg("奖品数量必须为数字!", false); return; } } info.PrizeSettingList = list; int num9 = VShopHelper.InsertLotteryActivity(info); if (num9 > 0) { ReplyInfo reply = new TextReplyInfo { Keys = info.ActivityKey, MatchType = MatchType.Equal, ActivityId = num9 }; string str2 = ((LotteryActivityType)info.ActivityType).ToString(); object obj2 = Enum.Parse(typeof(ReplyType), str2); reply.ReplyType = (ReplyType)obj2; ReplyHelper.SaveReply(reply); base.Response.Redirect("ManageLotteryActivity.aspx?type=" + this.type, true); this.ShowMsg("添加成功!", true); } } } return; } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } this.ShowMsg("您没有选择上传的图片文件!", false); } }
protected void btnCreate_Click(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.Tbtitle.Text) || string.IsNullOrEmpty(this.Tbdescription.Text) || string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("您填写的信息不完整!", false); return; } int urlIntParam = base.GetUrlIntParam("id"); NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(urlIntParam) as NewsReplyInfo; if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0) { base.GotoResourceNotFound(); return; } if (!string.IsNullOrEmpty(this.txtKeys.Text) && newsReplyInfo.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } newsReplyInfo.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { newsReplyInfo.Keys = this.txtKeys.Text.Trim(); } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } if (newsReplyInfo.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); return; } if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); return; } if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); return; } if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); return; } if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } newsReplyInfo.NewsMsg[0].Content = this.fkContent.Text; newsReplyInfo.NewsMsg[0].Description = this.Tbdescription.Text; newsReplyInfo.NewsMsg[0].PicUrl = this.hdpic.Value; newsReplyInfo.NewsMsg[0].Title = this.Tbtitle.Text; newsReplyInfo.NewsMsg[0].Url = this.TbUrl.Text; if (ReplyHelper.UpdateReply(newsReplyInfo)) { this.ShowMsg("修改成功", true); return; } this.ShowMsg("修改失败", false); }
protected void btnUpdateActivity_Click(object sender, System.EventArgs e) { if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); } else { if (!this.calendarOpenDate.SelectedDate.HasValue) { this.ShowMsg("请选择抽奖开始时间", false); } else { if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动结束时间", false); } else { string imageUrl = string.Empty; if (this.fileUpload.HasFile) { try { imageUrl = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); goto IL_104; } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } if (string.IsNullOrEmpty(this.imgPic.ImageUrl)) { this.ShowMsg("您没有选择上传的图片文件!", false); return; } imageUrl = this.imgPic.ImageUrl; IL_104: string str2 = string.Empty; for (int i = 0; i < this.cbList.Items.Count; i++) { if (this.cbList.Items[i].Selected) { str2 = str2 + "," + this.cbList.Items[i].Value; } } if (string.IsNullOrEmpty(str2)) { this.ShowMsg("请选择活动会员等级", false); } else { LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid); if (lotteryTicket.ActivityKey != this.txtKeyword.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { lotteryTicket.GradeIds = str2; lotteryTicket.MinValue = System.Convert.ToInt32(this.txtMinValue.Text); lotteryTicket.InvitationCode = this.txtCode.Text.Trim(); lotteryTicket.ActivityName = this.txtActiveName.Text; lotteryTicket.ActivityKey = this.txtKeyword.Text; lotteryTicket.ActivityDesc = this.txtdesc.Text; lotteryTicket.ActivityPic = imageUrl; lotteryTicket.StartTime = this.calendarStartDate.SelectedDate.Value; lotteryTicket.OpenTime = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex); lotteryTicket.EndTime = this.calendarEndDate.SelectedDate.Value; int num2; if (int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2) && int.TryParse(this.txtPrize3Num.Text, out num2)) { lotteryTicket.PrizeSettingList.Clear(); PrizeSetting item = new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖" }; lotteryTicket.PrizeSettingList.Add(item); PrizeSetting setting2 = new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖" }; lotteryTicket.PrizeSettingList.Add(setting2); PrizeSetting setting3 = new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖" }; lotteryTicket.PrizeSettingList.Add(setting3); if (this.ChkOpen.Checked) { if (string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text) || string.IsNullOrEmpty(this.txtPrize6.Text)) { this.ShowMsg("开启四五六名必须填写", false); return; } if (!int.TryParse(this.txtPrize4Num.Text, out num2) || !int.TryParse(this.txtPrize5Num.Text, out num2) || !int.TryParse(this.txtPrize6Num.Text, out num2)) { this.ShowMsg("奖品数量必须为数字!", false); return; } PrizeSetting setting4 = new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖" }; lotteryTicket.PrizeSettingList.Add(setting4); PrizeSetting setting5 = new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖" }; lotteryTicket.PrizeSettingList.Add(setting5); PrizeSetting setting6 = new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖" }; lotteryTicket.PrizeSettingList.Add(setting6); } if (VShopHelper.UpdateLotteryTicket(lotteryTicket)) { this.imgPic.ImageUrl = imageUrl; base.Response.Redirect("ManageLotteryTicket.aspx"); } } else { this.ShowMsg("奖品数量必须为数字!", false); } } } } } } }
protected void btnAddActivity_Click(object sender, EventArgs e) { if (ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); } else if (!this.calendarOpenDate.SelectedDate.HasValue) { this.ShowMsg("请选择抽奖开始时间", false); } else if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动结束时间", false); } else if (this.calendarEndDate.SelectedDate.Value < this.calendarStartDate.SelectedDate.Value) { this.ShowMsg("活动开始时间不能晚于活动结束时间", false); } else { string activityPic = this.UploadImage(); string text = string.Empty; for (int i = 0; i < this.cbList.Items.Count; i++) { if (this.cbList.Items[i].Selected) { text = text + "," + this.cbList.Items[i].Value; } } if (string.IsNullOrEmpty(text)) { this.ShowMsg("请选择活动会员等级", false); } else { LotteryTicketInfo lotteryTicketInfo = new LotteryTicketInfo(); lotteryTicketInfo.GradeIds = text; lotteryTicketInfo.MinValue = Convert.ToInt32(this.txtMinValue.Text); lotteryTicketInfo.InvitationCode = this.txtCode.Text.Trim(); lotteryTicketInfo.ActivityName = this.txtActiveName.Text; lotteryTicketInfo.ActivityKey = this.txtKeyword.Text; lotteryTicketInfo.ActivityDesc = this.txtdesc.Text; lotteryTicketInfo.ActivityPic = activityPic; lotteryTicketInfo.ActivityType = 4; lotteryTicketInfo.StartTime = this.calendarStartDate.SelectedDate.Value; lotteryTicketInfo.OpenTime = this.calendarOpenDate.SelectedDate.Value; lotteryTicketInfo.EndTime = this.calendarEndDate.SelectedDate.Value; lotteryTicketInfo.PrizeSettingList = new List <PrizeSetting>(); try { lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖" }); lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖" }); lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖" }); } catch (FormatException) { this.ShowMsg("奖品数量格式错误", false); return; } if (this.ooOpen.SelectedValue) { try { lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖" }); lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖" }); lotteryTicketInfo.PrizeSettingList.Add(new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖" }); } catch (FormatException) { this.ShowMsg("奖品数量格式错误", false); return; } } int num = VShopHelper.SaveLotteryTicket(lotteryTicketInfo); if (num > 0) { ReplyInfo replyInfo = new TextReplyInfo(); replyInfo.Keys = lotteryTicketInfo.ActivityKey; replyInfo.MatchType = MatchType.Equal; replyInfo.MessageType = MessageType.Text; replyInfo.ReplyType = ReplyType.Ticket; replyInfo.ActivityId = num; ReplyHelper.SaveReply(replyInfo); base.Response.Redirect("ManageLotteryTicket.aspx"); } } } }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(base.Request.QueryString["id"], out this.MaterialID)) { base.Response.Redirect("ReplyOnKey.aspx"); } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { if (!string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string str = base.Request.Form["MultiArticle"]; System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject <System.Collections.Generic.List <ArticleList> >(str); if (list != null && list.Count > 0) { NewsReplyInfo reply = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; reply.IsDisable = (base.Request.Form["radDisable"] != "true"); string str2 = base.Request.Form.Get("Keys"); if (base.Request.Form["chkKeys"] == "true") { if (!string.IsNullOrEmpty(str2) && reply.Keys != str2 && ReplyHelper.HasReplyKey(str2)) { base.Response.Write("key"); base.Response.End(); } reply.Keys = str2; } else { reply.Keys = string.Empty; } reply.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); reply.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { reply.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { reply.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { reply.ReplyType |= ReplyType.NoMatch; } foreach (NewsMsgInfo info2 in reply.NewsMsg) { ReplyHelper.DeleteNewsMsg(info2.Id); } System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>(); foreach (ArticleList list3 in list) { if (list3.Status != "del") { NewsMsgInfo item = list3; if (item != null) { item.Reply = reply; list2.Add(item); } } } reply.NewsMsg = list2; if (ReplyHelper.UpdateReply(reply)) { base.Response.Write("true"); base.Response.End(); } } } } else { NewsReplyInfo info3 = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; if (info3 != null) { System.Collections.Generic.List <ArticleList> list4 = new System.Collections.Generic.List <ArticleList>(); if (info3.NewsMsg != null && info3.NewsMsg.Count > 0) { int num = 1; foreach (NewsMsgInfo info4 in info3.NewsMsg) { ArticleList list5 = new ArticleList { PicUrl = info4.PicUrl, Title = info4.Title, Url = info4.Url, Description = info4.Description, Content = info4.Content }; list5.BoxId = num++.ToString(); list5.Status = ""; list4.Add(list5); } this.articleJson = JsonConvert.SerializeObject(list4); } this.fkContent.Text = info3.NewsMsg[0].Content; this.txtKeys.Text = info3.Keys; this.radMatch.SelectedValue = (info3.MatchType == MatchType.Like); this.radDisable.SelectedValue = !info3.IsDisable; this.chkKeys.Checked = (ReplyType.Keys == (info3.ReplyType & ReplyType.Keys)); this.chkSub.Checked = (ReplyType.Subscribe == (info3.ReplyType & ReplyType.Subscribe)); this.chkNo.Checked = (ReplyType.NoMatch == (info3.ReplyType & ReplyType.NoMatch)); if (this.chkNo.Checked) { this.chkNo.Enabled = true; this.chkNo.ToolTip = ""; } if (this.chkSub.Checked) { this.chkSub.Enabled = true; this.chkSub.ToolTip = ""; } } } }
protected void btnCreate_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.Tbtitle.Text) && !string.IsNullOrEmpty(this.Tbdescription.Text) && !string.IsNullOrEmpty(this.hdpic.Value)) { if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { NewsReplyInfo newsReplyInfo = new NewsReplyInfo(); string text = ""; newsReplyInfo.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { newsReplyInfo.Keys = this.txtKeys.Text.Trim(); } if (this.chkKeys.Checked && string.IsNullOrWhiteSpace(this.txtKeys.Text)) { this.ShowMsg("你选择了关键字回复,必须填写关键字!", false); } else { newsReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); newsReplyInfo.MessageType = MessageType.News; if (this.chkKeys.Checked) { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } if (newsReplyInfo.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); } else if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); } else if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); } else { if (this.chkSub.Checked) { if (this.ddlsubType.SelectedValue == "0") { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrltoSub.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } text = this.TbUrltoSub.Text; } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.ddlCoupon.SelectedValue)) { this.ShowMsg("请输入内容或选择优惠券", false); return; } text = "http://" + HttpContext.Current.Request.Url.Host + "/Vshop/ShakeCouponsForAttention.aspx?cid=" + this.ddlCoupon.SelectedValue; } } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } text = this.TbUrl.Text; } string picUrl = Globals.SaveFile("reply", this.hdpic.Value, "/Storage/master/", true, false, ""); NewsMsgInfo item = new NewsMsgInfo { Reply = newsReplyInfo, Content = this.fkContent.Text, Description = HttpUtility.HtmlEncode(this.Tbdescription.Text), PicUrl = picUrl, Title = HttpUtility.HtmlEncode(this.Tbtitle.Text), Url = text.Trim() }; newsReplyInfo.NewsMsg = new List <NewsMsgInfo>(); newsReplyInfo.NewsMsg.Add(item); if (ReplyHelper.SaveReply(newsReplyInfo)) { this.ShowMsg("添加成功", true, "ReplyOnKey.aspx"); } else { this.ShowMsg("添加失败", false); } } } } } else { this.ShowMsg("您填写的信息不完整!", false); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!int.TryParse(base.Request.QueryString["id"], out this.MaterialID)) { base.Response.Redirect("ReplyOnKey.aspx"); } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { if (!string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string value = base.Request.Form["MultiArticle"]; System.Collections.Generic.List <ArticleList> list = JsonConvert.DeserializeObject(value, typeof(System.Collections.Generic.List <ArticleList>)) as System.Collections.Generic.List <ArticleList>; if (list != null && list.Count > 0) { NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true"); string text = base.Request.Form.Get("Keys"); if (base.Request.Form["chkKeys"] == "true") { if (!string.IsNullOrEmpty(text) && newsReplyInfo.Keys != text && ReplyHelper.HasReplyKey(text)) { base.Response.Write("key"); base.Response.End(); } newsReplyInfo.Keys = text; } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } foreach (NewsMsgInfo current in newsReplyInfo.NewsMsg) { ReplyHelper.DeleteNewsMsg(current.Id); } System.Collections.Generic.List <NewsMsgInfo> list2 = new System.Collections.Generic.List <NewsMsgInfo>(); foreach (ArticleList current2 in list) { if (current2.Status != "del") { NewsMsgInfo newsMsgInfo = current2; if (newsMsgInfo != null) { newsMsgInfo.Reply = newsReplyInfo; list2.Add(newsMsgInfo); } } } newsReplyInfo.NewsMsg = list2; if (ReplyHelper.UpdateReply(newsReplyInfo)) { base.Response.Write("true"); base.Response.End(); return; } } } } else { NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; if (newsReplyInfo2 != null) { System.Collections.Generic.List <ArticleList> list3 = new System.Collections.Generic.List <ArticleList>(); if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0) { int num = 1; foreach (NewsMsgInfo current3 in newsReplyInfo2.NewsMsg) { list3.Add(new ArticleList { PicUrl = current3.PicUrl, Title = current3.Title, Url = current3.Url, Description = current3.Description, Content = current3.Content, BoxId = num++.ToString(), Status = "" }); } this.articleJson = JsonConvert.SerializeObject(list3); } this.fkContent.Text = newsReplyInfo2.NewsMsg[0].Content; this.txtKeys.Text = newsReplyInfo2.Keys; this.radMatch.SelectedValue = (newsReplyInfo2.MatchType == MatchType.Like); this.radDisable.SelectedValue = !newsReplyInfo2.IsDisable; this.chkKeys.Checked = (ReplyType.Keys == (newsReplyInfo2.ReplyType & ReplyType.Keys)); this.chkSub.Checked = (ReplyType.Subscribe == (newsReplyInfo2.ReplyType & ReplyType.Subscribe)); this.chkNo.Checked = (ReplyType.NoMatch == (newsReplyInfo2.ReplyType & ReplyType.NoMatch)); if (this.chkNo.Checked) { this.chkNo.Enabled = true; this.chkNo.ToolTip = ""; } if (this.chkSub.Checked) { this.chkSub.Enabled = true; this.chkSub.ToolTip = ""; } } } }
protected void Page_Load(object sender, EventArgs e) { wid = GetCurWebId(); if (string.IsNullOrEmpty(wid)) { return; } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = ReplyHelper.GetMismatchReply(this.wid) == null; this.chkSub.Enabled = ReplyHelper.GetSubscribeReply(this.wid) == null; if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"]) && !string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string str = base.Request.Form["MultiArticle"]; List <ArticleList> list = JsonConvert.DeserializeObject <List <ArticleList> >(str); if ((list != null) && (list.Count > 0)) { NewsReplyInfo reply = new NewsReplyInfo { MessageType = MessageType.List, IsDisable = base.Request.Form["radDisable"] != "true" }; if (base.Request.Form["chkKeys"] == "true") { reply.Keys = base.Request.Form.Get("Keys"); } if (!string.IsNullOrWhiteSpace(reply.Keys) && ReplyHelper.HasReplyKey(reply.Keys, this.wid)) { base.Response.Write("key"); base.Response.End(); } reply.MatchType = (base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal; reply.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { reply.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { reply.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { reply.ReplyType |= ReplyType.NoMatch; } List <NewsMsgInfo> list2 = new List <NewsMsgInfo>(); foreach (ArticleList list3 in list) { if (list3.Status != "del") { NewsMsgInfo item = list3; if (item != null) { item.Reply = reply; list2.Add(item); } } } reply.NewsMsg = list2; if (ReplyHelper.SaveReply(reply)) { base.Response.Write("true"); base.Response.End(); } } } }
private void btnEditVote_Click(object obj, EventArgs eventArg) { //if (StoreHelper.GetVoteCounts(this.voteId) > 0) //{ // this.ShowMsg("投票已经开始,不能再对投票选项进行任何操作", false); // return; //} VoteInfo voteById = StoreHelper.GetVoteById(this.voteId); if (voteById.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } if (this.calendarStartDate.SelectedDate.Value.CompareTo(this.calendarEndDate.SelectedDate.Value) >= 0) { this.ShowMsg("开始时间不能晚于结束时间!", false); return; } string uploadedImageUrl = this.uploader1.UploadedImageUrl; if (string.IsNullOrEmpty(uploadedImageUrl)) { this.ShowMsg("请上传封面图片", false); return; } voteById.ImageUrl = uploadedImageUrl; voteById.VoteName = Globals.HtmlEncode(this.txtAddVoteName.Text.Trim()); voteById.Keys = this.txtKeys.Text.Trim(); //int num = 1; //if (int.TryParse(this.txtMaxCheck.Text.Trim(), out num)) //{ // voteById.MaxCheck = num; //} voteById.StartDate = this.calendarStartDate.SelectedDate.Value; voteById.EndDate = this.calendarEndDate.SelectedDate.Value; //IList<VoteItemInfo> voteItemInfos = null; //if (string.IsNullOrEmpty(this.txtValues.Text.Trim())) //{ // this.ShowMsg("投票选项不能为空", false); // return; //} //System.Collections.Generic.IList<VoteItemInfo> list = new System.Collections.Generic.List<VoteItemInfo>(); //voteItemInfos = new List<VoteItemInfo>(); //string[] strArrays = this.txtValues.Text.Trim().Replace("\r\n", "\n").Replace("\n", "*").Split(new char[] // { // '*' // }); //for (int i = 0; i < (int)strArrays.Length; i++) //{ // VoteItemInfo voteItemInfo = new VoteItemInfo(); // if (strArrays[i].Length > 60) // { // this.ShowMsg("投票选项长度限制在60个字符以内", false); // return; // } // voteItemInfo.VoteItemName = Globals.HtmlEncode(strArrays[i]); // voteItemInfos.Add(voteItemInfo); //} //voteById.VoteItems = voteItemInfos; //if (!this.ValidationVote(voteById)) //{ // return; //} if (!StoreHelper.UpdateVote(voteById)) { this.ShowMsg("修改投票失败", false); return; } if (base.Request.QueryString["reurl"] != null) { this.ReUrl = base.Request.QueryString["reurl"].ToString(); } this.ShowMsgAndReUrl("修改投票成功", true, this.ReUrl); }
protected void Page_Load(object sender, EventArgs e) { if (!int.TryParse(base.Request.QueryString["id"], out this.MaterialID)) { base.Response.Redirect("ReplyOnKey.aspx"); } this.radMatch.Items[0].Text = "模糊匹配"; this.radMatch.Items[1].Text = "精确匹配"; this.radDisable.Items[0].Text = "启用"; this.radDisable.Items[1].Text = "禁用"; this.chkNo.Enabled = (ReplyHelper.GetMismatchReply() == null); this.chkSub.Enabled = (ReplyHelper.GetSubscribeReply() == null); if (!this.chkNo.Enabled) { this.chkNo.ToolTip = "该类型已被使用"; } if (!this.chkSub.Enabled) { this.chkSub.ToolTip = "该类型已被使用"; } if (!string.IsNullOrEmpty(base.Request.QueryString["cmd"])) { if (!string.IsNullOrEmpty(base.Request.Form["MultiArticle"])) { string value = base.Request.Form["MultiArticle"]; List <ArticleList> list = JsonConvert.DeserializeObject(value, typeof(List <ArticleList>)) as List <ArticleList>; if (list != null && list.Count > 0) { NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; newsReplyInfo.IsDisable = (base.Request.Form["radDisable"] != "true"); string text = base.Request.Form.Get("Keys"); if (base.Request.Form["chkKeys"] == "true") { if (!string.IsNullOrEmpty(text) && newsReplyInfo.Keys != text && ReplyHelper.HasReplyKey(text)) { base.Response.Write("key"); base.Response.End(); } newsReplyInfo.Keys = text; } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = ((base.Request.Form["radMatch"] == "true") ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (base.Request.Form["chkKeys"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (base.Request.Form["chkSub"] == "true") { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (base.Request.Form["chkNo"] == "true") { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } foreach (NewsMsgInfo item in newsReplyInfo.NewsMsg) { ReplyHelper.DeleteNewsMsg(item.Id); } List <NewsMsgInfo> list2 = new List <NewsMsgInfo>(); foreach (ArticleList item2 in list) { if (item2.Status != "del") { NewsMsgInfo newsMsgInfo = item2; if (newsMsgInfo != null) { newsMsgInfo.Reply = newsReplyInfo; list2.Add(newsMsgInfo); } } } newsReplyInfo.NewsMsg = list2; foreach (NewsMsgInfo item3 in newsReplyInfo.NewsMsg) { item3.PicUrl = Globals.SaveFile("article", item3.PicUrl, "/Storage/master/", true, false, ""); } if (ReplyHelper.UpdateReply(newsReplyInfo)) { base.Response.Write("true"); base.Response.End(); } } } } else { NewsReplyInfo newsReplyInfo2 = ReplyHelper.GetReply(this.MaterialID) as NewsReplyInfo; if (newsReplyInfo2 != null) { List <ArticleList> list3 = new List <ArticleList>(); if (newsReplyInfo2.NewsMsg != null && newsReplyInfo2.NewsMsg.Count > 0) { int num = 1; foreach (NewsMsgInfo item4 in newsReplyInfo2.NewsMsg) { ArticleList articleList = new ArticleList(); articleList.PicUrl = item4.PicUrl; articleList.Title = item4.Title; articleList.Url = item4.Url; articleList.Description = item4.Description; articleList.Content = item4.Content; ArticleList articleList2 = articleList; int num2 = num; num = num2 + 1; articleList2.BoxId = num2.ToString(); articleList.Status = ""; list3.Add(articleList); } this.articleJson = JsonConvert.SerializeObject(list3); } this.fkContent.Text = newsReplyInfo2.NewsMsg[0].Content; this.txtKeys.Text = newsReplyInfo2.Keys; this.radMatch.SelectedValue = (newsReplyInfo2.MatchType == MatchType.Like); this.radDisable.SelectedValue = !newsReplyInfo2.IsDisable; this.chkKeys.Checked = (ReplyType.Keys == (newsReplyInfo2.ReplyType & ReplyType.Keys)); this.chkSub.Checked = (ReplyType.Subscribe == (newsReplyInfo2.ReplyType & ReplyType.Subscribe)); this.chkNo.Checked = (ReplyType.NoMatch == (newsReplyInfo2.ReplyType & ReplyType.NoMatch)); if (this.chkNo.Checked) { this.chkNo.Enabled = true; this.chkNo.ToolTip = ""; } if (this.chkSub.Checked) { this.chkSub.Enabled = true; this.chkSub.ToolTip = ""; } } } }
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); } } }
protected void btnCreate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Tbtitle.Text) || string.IsNullOrEmpty(this.Tbdescription.Text) || string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("您填写的信息不完整!", false); } else { int urlIntParam = base.GetUrlIntParam("id"); NewsReplyInfo newsReplyInfo = ReplyHelper.GetReply(urlIntParam) as NewsReplyInfo; if (newsReplyInfo == null || newsReplyInfo.NewsMsg == null || newsReplyInfo.NewsMsg.Count == 0) { base.GotoResourceNotFound(); } else if (!string.IsNullOrEmpty(this.txtKeys.Text) && newsReplyInfo.Keys != this.txtKeys.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { newsReplyInfo.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { newsReplyInfo.Keys = this.txtKeys.Text.Trim(); } else { newsReplyInfo.Keys = string.Empty; } newsReplyInfo.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); newsReplyInfo.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { newsReplyInfo.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { newsReplyInfo.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { newsReplyInfo.ReplyType |= ReplyType.NoMatch; } if (newsReplyInfo.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else { string text = ""; if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); } else if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); } else if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); } else { if (this.chkSub.Checked) { if (this.ddlsubType.SelectedValue == "0") { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrltoSub.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } text = this.TbUrltoSub.Text; } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.ddlCoupon.SelectedValue)) { this.ShowMsg("请输入内容或选择优惠券", false); return; } text = "http://" + HttpContext.Current.Request.Url.Host + "/Vshop/ShakeCouponsForAttention.aspx?cid=" + this.ddlCoupon.SelectedValue; } } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); return; } text = this.TbUrl.Text; } string picUrl = Globals.SaveFile("reply", this.hdpic.Value, "/Storage/master/", true, false, ""); newsReplyInfo.NewsMsg[0].Content = this.fkContent.Text; newsReplyInfo.NewsMsg[0].Description = this.Tbdescription.Text; newsReplyInfo.NewsMsg[0].PicUrl = picUrl; newsReplyInfo.NewsMsg[0].Title = this.Tbtitle.Text; newsReplyInfo.NewsMsg[0].Url = text; if (ReplyHelper.UpdateReply(newsReplyInfo)) { this.ShowMsg("修改成功", true, "ReplyOnKey.aspx"); } else { this.ShowMsg("修改失败", false); } } } } } }
protected void btnUpdateActivity_Click(object sender, System.EventArgs e) { if (VShopHelper.GetLotteryActivityInfo(this.activityid).ActivityKey != this.txtKeyword.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim())) { this.ShowMsg("关键字重复!", false); return; } string text = string.Empty; if (this.fileUpload.HasFile) { try { text = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); goto IL_AB; } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } if (!string.IsNullOrEmpty(this.imgPic.ImageUrl)) { text = this.imgPic.ImageUrl; goto IL_AB; } this.ShowMsg("您没有选择上传的图片文件!", false); return; IL_AB: if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); return; } if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动结束时间", false); return; } if (this.calendarEndDate.SelectedDate.Value < this.calendarStartDate.SelectedDate.Value) { this.ShowMsg("活动开始时间不能晚于活动结束时间", false); return; } int num; if (!int.TryParse(this.txtMaxNum.Text, out num) || num.ToString() != this.txtMaxNum.Text) { this.ShowMsg("可抽奖次数必须是整数", false); return; } LotteryActivityInfo lotteryActivityInfo = new LotteryActivityInfo(); lotteryActivityInfo.ActivityName = this.txtActiveName.Text; lotteryActivityInfo.ActivityId = this.activityid; lotteryActivityInfo.ActivityType = this.type; lotteryActivityInfo.ActivityKey = this.txtKeyword.Text; lotteryActivityInfo.ActivityDesc = this.txtdesc.Text; lotteryActivityInfo.ActivityPic = text; lotteryActivityInfo.StartTime = this.calendarStartDate.SelectedDate.Value; lotteryActivityInfo.EndTime = this.calendarEndDate.SelectedDate.Value; lotteryActivityInfo.MaxNum = System.Convert.ToInt32(this.txtMaxNum.Text); System.Collections.Generic.List <PrizeSetting> list = new System.Collections.Generic.List <PrizeSetting>(); int num2; if (int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2) && int.TryParse(this.txtPrize3Num.Text, out num2)) { decimal probability = System.Convert.ToDecimal(this.txtProbability1.Text); decimal probability2 = System.Convert.ToDecimal(this.txtProbability2.Text); decimal probability3 = System.Convert.ToDecimal(this.txtProbability3.Text); list.AddRange(new System.Collections.Generic.List <PrizeSetting> { new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖", Probability = probability }, new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖", Probability = probability2 }, new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖", Probability = probability3 } }); if (this.ChkOpen.Checked) { if (string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text) || string.IsNullOrEmpty(this.txtPrize6.Text)) { this.ShowMsg("开启四五六名必须填写", false); return; } if (!int.TryParse(this.txtPrize4Num.Text, out num2) || !int.TryParse(this.txtPrize5Num.Text, out num2) || !int.TryParse(this.txtPrize6Num.Text, out num2)) { this.ShowMsg("奖品数量必须为数字!", false); return; } decimal probability4 = System.Convert.ToDecimal(this.txtProbability4.Text); decimal probability5 = System.Convert.ToDecimal(this.txtProbability5.Text); decimal probability6 = System.Convert.ToDecimal(this.txtProbability6.Text); list.AddRange(new System.Collections.Generic.List <PrizeSetting> { new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖", Probability = probability4 }, new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖", Probability = probability5 }, new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖", Probability = probability6 } }); } lotteryActivityInfo.PrizeSettingList = list; if (VShopHelper.UpdateLotteryActivity(lotteryActivityInfo)) { this.imgPic.ImageUrl = text; base.Response.Redirect("ManageLotteryActivity.aspx?type=" + this.type, true); } return; } this.ShowMsg("奖品数量必须为数字!", false); }
private void btnSubmit_Click(object sender, EventArgs e) { TextReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as TextReplyInfo; if ((!string.IsNullOrEmpty(this.txtKeys.Text) && (reply.Keys != this.txtKeys.Text.Trim())) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim(), this.wid)) { this.ShowMsg("关键字重复!", false); } else { reply.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { reply.Keys = this.txtKeys.Text.Trim(); } else { reply.Keys = string.Empty; } reply.Text = this.fcContent.Text.Trim(); reply.MatchType = this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal; reply.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { reply.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { reply.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { reply.ReplyType |= ReplyType.NoMatch; } if (reply.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else if (ReplyHelper.UpdateReply(reply)) { this.ShowMsg("修改成功", true); } else { this.ShowMsg("修改失败", false); } } }
protected void btnUpdateActivity_Click(object sender, EventArgs e) { if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); } else if (!this.calendarOpenDate.SelectedDate.HasValue) { this.ShowMsg("请选择抽奖开始时间", false); } else if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择抽奖结束时间", false); } else if (this.calendarStartDate.SelectedDate.Value.CompareTo(this.calendarOpenDate.SelectedDate.Value) > 0) { this.ShowMsg("报名开始日期不能晚于抽奖开始时间!", false); } else if (this.calendarOpenDate.SelectedDate.Value.CompareTo(this.calendarEndDate.SelectedDate.Value) >= 0) { this.ShowMsg("抽奖开始时间不能晚于活动结束时间!", false); } else { string uploadedImageUrl = this.uploader1.UploadedImageUrl; if (string.IsNullOrEmpty(uploadedImageUrl)) { this.ShowMsg("请上传封面图片", false); } else { string str2 = string.Empty; for (int i = 0; i < this.cbList.Items.Count; i++) { if (this.cbList.Items[i].Selected) { str2 = str2 + "," + this.cbList.Items[i].Value; } } if (string.IsNullOrEmpty(str2)) { this.ShowMsg("请选择活动会员等级", false); } else { LotteryTicketInfo lotteryTicket = VShopHelper.GetLotteryTicket(this.activityid); if ((lotteryTicket.ActivityKey != this.txtKeyword.Text.Trim()) && ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim(), this.wid)) { this.ShowMsg("关键字重复!", false); } else { int num2; lotteryTicket.GradeIds = str2; lotteryTicket.MinValue = Convert.ToInt32(this.txtMinValue.Text); lotteryTicket.InvitationCode = this.txtCode.Text.Trim(); lotteryTicket.ActivityName = this.txtActiveName.Text; lotteryTicket.ActivityKey = this.txtKeyword.Text; lotteryTicket.ActivityDesc = this.txtdesc.Text; lotteryTicket.ActivityPic = uploadedImageUrl; lotteryTicket.StartTime = this.calendarStartDate.SelectedDate.Value; lotteryTicket.OpenTime = this.calendarOpenDate.SelectedDate.Value.AddHours((double)this.ddlHours.SelectedIndex); lotteryTicket.EndTime = this.calendarEndDate.SelectedDate.Value; if ((int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2)) && int.TryParse(this.txtPrize3Num.Text, out num2)) { lotteryTicket.PrizeSettingList.Clear(); PrizeSetting item = new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖" }; lotteryTicket.PrizeSettingList.Add(item); PrizeSetting setting2 = new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖" }; lotteryTicket.PrizeSettingList.Add(setting2); PrizeSetting setting3 = new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖" }; lotteryTicket.PrizeSettingList.Add(setting3); } else { this.ShowMsg("奖品数量必须为数字!", false); return; } if (this.ChkOpen.Checked) { if ((string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text)) || string.IsNullOrEmpty(this.txtPrize6.Text)) { this.ShowMsg("开启四五六名必须填写", false); return; } if ((int.TryParse(this.txtPrize4Num.Text, out num2) && int.TryParse(this.txtPrize5Num.Text, out num2)) && int.TryParse(this.txtPrize6Num.Text, out num2)) { PrizeSetting setting4 = new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖" }; lotteryTicket.PrizeSettingList.Add(setting4); PrizeSetting setting5 = new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖" }; lotteryTicket.PrizeSettingList.Add(setting5); PrizeSetting setting6 = new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖" }; lotteryTicket.PrizeSettingList.Add(setting6); } else { this.ShowMsg("奖品数量必须为数字!", false); return; } } if (VShopHelper.UpdateLotteryTicket(lotteryTicket)) { base.Response.Redirect("ManageLotteryTicket.aspx"); } } } } } }
protected void btnCreate_Click(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(this.Tbtitle.Text) && !string.IsNullOrEmpty(this.Tbdescription.Text) && !string.IsNullOrEmpty(this.hdpic.Value)) { if (!string.IsNullOrEmpty(this.txtKeys.Text) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { NewsReplyInfo reply = new NewsReplyInfo { IsDisable = !this.radDisable.SelectedValue }; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { reply.Keys = this.txtKeys.Text.Trim(); } if (this.chkKeys.Checked && string.IsNullOrWhiteSpace(this.txtKeys.Text)) { this.ShowMsg("你选择了关键字回复,必须填写关键字!", false); } else { reply.MatchType = (this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal); reply.MessageType = MessageType.News; if (this.chkKeys.Checked) { reply.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { reply.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { reply.ReplyType |= ReplyType.NoMatch; } if (reply.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else { if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); } else { if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); } else { if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); } else { if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); } else { NewsMsgInfo item = new NewsMsgInfo { Reply = reply, Content = this.fkContent.Text, Description = System.Web.HttpUtility.HtmlEncode(this.Tbdescription.Text), PicUrl = this.hdpic.Value, Title = System.Web.HttpUtility.HtmlEncode(this.Tbtitle.Text), Url = this.TbUrl.Text.Trim() }; reply.NewsMsg = new System.Collections.Generic.List <NewsMsgInfo>(); reply.NewsMsg.Add(item); if (ReplyHelper.SaveReply(reply)) { this.ShowMsg("添加成功", true); } else { this.ShowMsg("添加失败", false); } } } } } } } } } else { this.ShowMsg("您填写的信息不完整!", false); } }
protected void btnUpdateActivity_Click(object sender, System.EventArgs e) { if (VShopHelper.GetLotteryActivityInfo(this.activityid).ActivityKey != this.txtKeyword.Text.Trim() && ReplyHelper.HasReplyKey(this.txtKeyword.Text.Trim())) { this.ShowMsg("关键字重复!", false); } else { string imageUrl = string.Empty; if (this.fileUpload.HasFile) { try { imageUrl = VShopHelper.UploadTopicImage(this.fileUpload.PostedFile); goto IL_D9; } catch { this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false); return; } } if (string.IsNullOrEmpty(this.imgPic.ImageUrl)) { this.ShowMsg("您没有选择上传的图片文件!", false); return; } imageUrl = this.imgPic.ImageUrl; IL_D9: if (!this.calendarStartDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动开始时间", false); } else { if (!this.calendarEndDate.SelectedDate.HasValue) { this.ShowMsg("请选择活动结束时间", false); } else { int num; if (!int.TryParse(this.txtMaxNum.Text, out num) || num.ToString() != this.txtMaxNum.Text) { this.ShowMsg("可抽奖次数必须是整数", false); } else { LotteryActivityInfo info = new LotteryActivityInfo { ActivityName = this.txtActiveName.Text, ActivityId = this.activityid, ActivityType = this.type, ActivityKey = this.txtKeyword.Text, ActivityDesc = this.txtdesc.Text, ActivityPic = imageUrl, StartTime = this.calendarStartDate.SelectedDate.Value, EndTime = this.calendarEndDate.SelectedDate.Value, MaxNum = System.Convert.ToInt32(this.txtMaxNum.Text) }; System.Collections.Generic.List <PrizeSetting> list = new System.Collections.Generic.List <PrizeSetting>(); int num2; if (int.TryParse(this.txtPrize1Num.Text, out num2) && int.TryParse(this.txtPrize2Num.Text, out num2) && int.TryParse(this.txtPrize3Num.Text, out num2)) { decimal num3 = System.Convert.ToDecimal(this.txtProbability1.Text); decimal num4 = System.Convert.ToDecimal(this.txtProbability2.Text); decimal num5 = System.Convert.ToDecimal(this.txtProbability3.Text); System.Collections.Generic.List <PrizeSetting> collection = new System.Collections.Generic.List <PrizeSetting>(); PrizeSetting item = new PrizeSetting { PrizeName = this.txtPrize1.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize1Num.Text), PrizeLevel = "一等奖", Probability = num3 }; collection.Add(item); PrizeSetting setting2 = new PrizeSetting { PrizeName = this.txtPrize2.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize2Num.Text), PrizeLevel = "二等奖", Probability = num4 }; collection.Add(setting2); PrizeSetting setting3 = new PrizeSetting { PrizeName = this.txtPrize3.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize3Num.Text), PrizeLevel = "三等奖", Probability = num5 }; collection.Add(setting3); list.AddRange(collection); if (this.ChkOpen.Checked) { if (string.IsNullOrEmpty(this.txtPrize4.Text) || string.IsNullOrEmpty(this.txtPrize5.Text) || string.IsNullOrEmpty(this.txtPrize6.Text)) { this.ShowMsg("开启四五六名必须填写", false); return; } if (!int.TryParse(this.txtPrize4Num.Text, out num2) || !int.TryParse(this.txtPrize5Num.Text, out num2) || !int.TryParse(this.txtPrize6Num.Text, out num2)) { this.ShowMsg("奖品数量必须为数字!", false); return; } decimal num6 = System.Convert.ToDecimal(this.txtProbability4.Text); decimal num7 = System.Convert.ToDecimal(this.txtProbability5.Text); decimal num8 = System.Convert.ToDecimal(this.txtProbability6.Text); System.Collections.Generic.List <PrizeSetting> list2 = new System.Collections.Generic.List <PrizeSetting>(); PrizeSetting setting4 = new PrizeSetting { PrizeName = this.txtPrize4.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize4Num.Text), PrizeLevel = "四等奖", Probability = num6 }; list2.Add(setting4); PrizeSetting setting5 = new PrizeSetting { PrizeName = this.txtPrize5.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize5Num.Text), PrizeLevel = "五等奖", Probability = num7 }; list2.Add(setting5); PrizeSetting setting6 = new PrizeSetting { PrizeName = this.txtPrize6.Text, PrizeNum = System.Convert.ToInt32(this.txtPrize6Num.Text), PrizeLevel = "六等奖", Probability = num8 }; list2.Add(setting6); list.AddRange(list2); } info.PrizeSettingList = list; if (VShopHelper.UpdateLotteryActivity(info)) { this.imgPic.ImageUrl = imageUrl; base.Response.Redirect("ManageLotteryActivity.aspx?type=" + this.type, true); } } else { this.ShowMsg("奖品数量必须为数字!", false); } } } } } }
protected void btnCreate_Click(object sender, EventArgs e) { if ((string.IsNullOrEmpty(this.Tbtitle.Text) || string.IsNullOrEmpty(this.Tbdescription.Text)) || string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("您填写的信息不完整!", false); } else { NewsReplyInfo reply = ReplyHelper.GetReply(base.GetUrlIntParam("id")) as NewsReplyInfo; if (((reply == null) || (reply.NewsMsg == null)) || (reply.NewsMsg.Count == 0)) { base.GotoResourceNotFound(); } else if ((!string.IsNullOrEmpty(this.txtKeys.Text) && (reply.Keys != this.txtKeys.Text.Trim())) && ReplyHelper.HasReplyKey(this.txtKeys.Text.Trim(), this.wid)) { this.ShowMsg("关键字重复!", false); } else { reply.IsDisable = !this.radDisable.SelectedValue; if (this.chkKeys.Checked && !string.IsNullOrWhiteSpace(this.txtKeys.Text)) { reply.Keys = this.txtKeys.Text.Trim(); } else { reply.Keys = string.Empty; } reply.MatchType = this.radMatch.SelectedValue ? MatchType.Like : MatchType.Equal; reply.ReplyType = ReplyType.None; if (this.chkKeys.Checked) { reply.ReplyType |= ReplyType.Keys; } if (this.chkSub.Checked) { reply.ReplyType |= ReplyType.Subscribe; } if (this.chkNo.Checked) { reply.ReplyType |= ReplyType.NoMatch; } if (reply.ReplyType == ReplyType.None) { this.ShowMsg("请选择回复类型", false); } else if (string.IsNullOrEmpty(this.Tbtitle.Text)) { this.ShowMsg("请输入标题", false); } else if (string.IsNullOrEmpty(this.hdpic.Value)) { this.ShowMsg("请上传封面图", false); } else if (string.IsNullOrEmpty(this.Tbdescription.Text)) { this.ShowMsg("请输入摘要", false); } else if (string.IsNullOrEmpty(this.fkContent.Text) && string.IsNullOrEmpty(this.TbUrl.Text)) { this.ShowMsg("请输入内容或自定义链接", false); } else { reply.NewsMsg[0].Content = this.fkContent.Text; reply.NewsMsg[0].Description = this.Tbdescription.Text; reply.NewsMsg[0].PicUrl = this.hdpic.Value; reply.NewsMsg[0].Title = this.Tbtitle.Text; reply.NewsMsg[0].Url = this.TbUrl.Text; if (ReplyHelper.UpdateReply(reply)) { this.ShowMsg("修改成功", true); } else { this.ShowMsg("修改失败", false); } } } } }