private NewsMsgInfo ReaderBindNewsRelpy(IDataReader dataReader) { NewsMsgInfo info = new NewsMsgInfo(); object obj2 = dataReader["MsgID"]; if ((obj2 != null) && (obj2 != DBNull.Value)) { info.Id = (int) obj2; } obj2 = dataReader["Title"]; if ((obj2 != null) && (obj2 != DBNull.Value)) { info.Title = dataReader["Title"].ToString(); } obj2 = dataReader["ImageUrl"]; if ((obj2 != null) && (obj2 != DBNull.Value)) { info.PicUrl = dataReader["ImageUrl"].ToString(); } obj2 = dataReader["Url"]; if ((obj2 != null) && (obj2 != DBNull.Value)) { info.Url = dataReader["Url"].ToString(); } obj2 = dataReader["Description"]; if ((obj2 != null) && (obj2 != DBNull.Value)) { info.Description = dataReader["Description"].ToString(); } obj2 = dataReader["Content"]; if ((obj2 != null) && (obj2 != DBNull.Value)) { info.Content = dataReader["Content"].ToString(); } return info; }
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 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 = HttpUtility.HtmlEncode(this.Tbdescription.Text), PicUrl = this.hdpic.Value, Title = HttpUtility.HtmlEncode(this.Tbtitle.Text), Url = this.TbUrl.Text.Trim() }; reply.NewsMsg = new List<NewsMsgInfo>(); reply.NewsMsg.Add(item); if (ReplyHelper.SaveReply(reply)) { this.ShowMsg("添加成功", true); } else { this.ShowMsg("添加失败", false); } } } } } else { this.ShowMsg("您填写的信息不完整!", false); } }