public ActionResult News() { //--------------轮播区数据5条最新数据----------- ViewBag.RedLight = SeeNewsBll.LoadEntities(n => n.Type == "7").AsNoTracking().OrderByDescending(n => n.Intime) .Take(5).ToList(); //------------------5条置顶区------------------------ ViewBag.FiveStick = SeeNewsBll.LoadEntities(n => n.Type == "10").AsNoTracking().OrderByDescending(n => n.Intime) .Take(6).ToList(); ViewBag.NewGame = GetAllNews("1"); ViewBag.HotGame = GetAllNews("2"); ViewBag.Industry = GetAllNews("3"); ViewBag.SeeNewsNewGame = SeeNewsBll.LoadEntities(n => n.Type == "1").AsNoTracking().OrderByDescending(n => n.Intime).Take(1).ToList(); ViewBag.SeeNewsHotGame = SeeNewsBll.LoadEntities(n => n.Type == "2").AsNoTracking().OrderByDescending(n => n.Intime).Take(1).ToList(); ViewBag.SeeNewsIndustry = SeeNewsBll.LoadEntities(n => n.Type == "3").AsNoTracking().OrderByDescending(n => n.Intime).Take(1).ToList(); ViewBag.NewsNewGameMsg = NewsBll.GetNewAllMsgImg("1"); //1:新游在线(看新闻6条中是最后一条的一天数据) ViewBag.NewsHotGameMsg = NewsBll.GetNewAllMsgImg("2"); //2热游动态 ViewBag.NewsIndustryMsg = NewsBll.GetNewAllMsgImg("3"); //2热游动态 ViewBag.NewestNewsPC = GetNewestNewsPC(); //获取最新的资讯15条(pc主机) ViewBag.NewsPcMsgImg = NewsBll.GetAllNewsPcMsg("1"); //板块推荐 留言数 ViewBag.DirectSeeding = TwoSeeNewsImg("5"); //2、2张带图的推荐位---直播热点 ViewBag.MobileGame = TwoSeeNewsImg("6"); //2、2张带图的推荐位---手游 ViewBag.DirectRec = NewsBll.GetAllTypeNews("1", "5", 5); //直播版块最新5条数据 ViewBag.MobileRec = NewsBll.GetAllTypeNews("1", "6", 5); //手游版块最新5条数据 //-------------------娱乐八卦读取-------------------------- ViewBag.HappNews = NewsBll.GetAllHappyNews(); return(View()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDrop(); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { string title = ""; int status = 2; int type = Convert.ToInt32(Request.QueryString["id"]); dropNewsType.SelectedValue = type.ToString(); DataTable dt = NewsBll.getNews(title, status, type); if (dt.Rows.Count > 0) { AspNetPager1.RecordCount = dt.Rows.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dt.DefaultView; pds.PageSize = AspNetPager1.PageSize; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; dgNews.DataSource = pds; dgNews.DataBind(); } else { dgNews.DataSource = null; dgNews.DataBind(); } } else { BindData(); } } }
public ActionResult NewsDetail(int id) { ViewData.Model = GetNewsDetails(id); #region 一篇、下一篇 //-上一篇、下一篇 //用pre和next变量分别存放上一篇文章和下一篇文章的id号 int pre = 0, next = 0, i = 0, j; //计算总记录数 int num = NewsBll.LoadEntities(n => n.Id > 0).Count(); int[] a = new int[num]; var query = NewsBll.LoadEntities(n => true).Select(n => n.Id).ToArray(); //将所有的文章id号全部放入一个数组中 foreach (var item in query) { a[i] = Convert.ToInt32(item); i++; } //循环,获取上一篇和下一篇文章的ID号,分别放入变量pre和next中 for (j = 0; j < num; j++) { if (a[j] == id) { if (j != 0) { pre = a[j - 1]; //上一篇id } if (j != num - 1) { next = a[j + 1]; //下一篇文章id } } } //获取上一篇文章的标题 if (pre == 0) { ViewBag.preTitle = "没有了"; ViewBag.pre = id; } else { ViewBag.preTitle = NewsBll.LoadEntities(n => n.Id == pre).Single().Title; ViewBag.pre = pre; } //获取下一篇文章的标题 if (next == 0) { ViewBag.nextTitle = "没有了"; ViewBag.next = id; } else { ViewBag.nextTitle = NewsBll.LoadEntities(n => n.Id == next).Single().Title; ViewBag.next = next; } #endregion ViewBag.SameKeys = NewsBll.TheSameKeyWords(id); return(View()); }
public ActionResult CpyNewsEdit(int id) { var currentCpy = GetCurrentUser(); ViewData.Model = NewsBll.LoadEntities(n => n.Id == id && n.CompanyId == currentCpy.Id).FirstOrDefault(); return(View()); }
protected void Page_Load(object sender, EventArgs e) { BindView(); int id; if (!IsPostBack) { try { if (Request.QueryString["newsid"] != null) { id = Convert.ToInt32(Request.QueryString["newsid"].ToString()); if (NewsBll.delete(id) == 1) { BindView(); Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('删除失败!');</script>"); } } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } } }
public void BindData() { string title = txtTitle.Text.Trim(); int status = Convert.ToInt32(dropStatus.SelectedValue); int type = 0; if (dropNewsType.SelectedItem.Text != "显示全部") { type = Convert.ToInt32(dropNewsType.SelectedValue); } DataTable dt = NewsBll.getNews(title, status, type); if (dt.Rows.Count > 0) { AspNetPager1.RecordCount = dt.Rows.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dt.DefaultView; pds.PageSize = AspNetPager1.PageSize; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; dgNews.DataSource = pds; dgNews.DataBind(); } else { dgNews.DataSource = null; dgNews.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { #region 绑定NewsStr NewsBll newsbll = new NewsBll(); List <Model.Category> categoryList = new CategoryBll().GetModelList("");//通过NewsId表的CategoryId找到Category表的对应的Url string categoryId = ConfigurationManager.AppSettings["NewsCategoryId"]; Category category = categoryList.Single(o => o.CategoryId == Convert.ToInt32(categoryId)); List <Model.News> newsList = newsbll.GetModelList("Status=1"); //可显示的所有新闻 newsList = newsList.OrderByDescending(o => o.UpdateDate).ToList(); //按更新时间倒序排列 StringBuilder sb = new StringBuilder(); //html字符串拼接 sb.Append("<div class='topic'>"); sb.AppendFormat("<div class='TopicTitle'>{0} News</div>", category.Name); sb.Append("<div class='TopicMore'>"); sb.AppendFormat("<a href='{0}'><img src='images/more.png'></a>", category.Url); sb.Append("</div>"); sb.Append("<div class='HeightTab clearfix'></div>"); sb.Append("<ul></ul>"); sb.Append("</div>"); sb.Append("<table id='MBlockTable' width='100%' border='0' cellspacing='0' cellpadding='0'>"); sb.Append("<tbody>"); foreach (Model.News item in newsList) { sb.Append("<tr>"); sb.AppendFormat("<td width='75%'>· <a href='{0}' target='_blank' title='{1}'>{1}</a></td>", "/newsPage/newsContent.aspx?newsid=" + item.NewsId, item.Title); sb.AppendFormat("<td width='25%'><span>{0}</span></td>", item.UpdateDate.ToShortDateString()); sb.Append("</tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); NewsStr = sb.ToString();//给前台变量赋值 #endregion }
public ActionResult FunNews() { int pageSize = int.Parse(Request["pageSize"] ?? "30"); int pageIndex = int.Parse(Request["pageIndex"] ?? "1"); int total = 0; int type = (short)NewsType.HappyNews; string t = type.ToString(); ViewData["HappyNews"] = NewsBll.GetMoreNews(pageSize, pageIndex, out total, t).Select(n => new NewsViewModel() { Id = n.Id, Type = n.Type, InTime = n.InTime, ViewNum = n.ViewNum, Title = n.Title, EditTitle = n.EditTitle, Msg = n.Msg, MsgNum = n.MsgNum, Memo = n.Memo }).ToList(); ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["Total"] = total; return(View()); }
public ActionResult NewsSearchResult(string key) { int pageSize = int.Parse(Request["pageSize"] ?? "15"); int pageIndex = int.Parse(Request["pageIndex"] ?? "1"); int total = 0; var list = NewsBll.GetSearchNews(pageSize, pageIndex, out total, key).Select(n => new NewsViewModel() { Id = n.Id, Type = n.Type, InTime = n.InTime, ViewNum = n.ViewNum,//浏览量 EditTitle = n.EditTitle, Title = n.Title, Msg = n.Msg, MsgNum = n.MsgNum,//留言数 Memo = n.Memo }).ToList(); TempData["SearchTitle"] = key; ViewData["SearchResult"] = list; ViewData["pageIndex"] = pageIndex; ViewData["pageSize"] = pageSize; ViewData["Total"] = total; return(View()); }
protected void Page_Load(object sender, EventArgs e) { int newsid; if (!IsPostBack) { flag = true; if (Request.QueryString["newsid"] != null) { newsid = Convert.ToInt32(Request.QueryString["newsid"].ToString()); SqlDataReader dt = NewsBll.read(newsid); dt.Read(); if (dt != null) { txtTitle.Text = dt[1].ToString().Trim(); txtTime.Text = string.Format("{0:yyyy-MM-dd hh:mm}", dt[2]); txtContent.Text = dt[3].ToString(); //txtClass.Text=dt[6].ToString(); string img1 = dt[4].ToString().Trim(); } BingNC(); //显示总共多少评论 Label1.Text = News_CommentaryBll.news_allncnum(newsid).ToString(); } } }
//修改新闻 protected void UpdateNews_Click(object sender, EventArgs e) { News news = new News(); news.News_ID1 = Convert.ToInt32(Request.QueryString["newsid"].ToString()); news.News_Title1 = txtTitle.Text.Trim(); news.News_Time1 = DateTime.Parse(DateTime.Now.ToShortDateString().ToString()); news.News_Conentent1 = txtContent.Text; news.News_Num1 = int.Parse(txtNum.Text.Trim()); news.News_Img1 = @"~/Img_News/" + FileUpload1.PostedFile.FileName; news.News_Class1 = DropDownList_Class.SelectedItem.Text.Trim(); try { if (NewsBll.Updatenews(news) == 1) { Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('修改成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(object), "alert", "<script>alert('修改失败!');</script>"); } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } }
public ActionResult GetIndexTopData() { try { NewsBll nbll = new NewsBll(); ProductBll productbll = new ProductBll(); DataSet priceset = productbll.getPriceFile("", "", "", 1, 5); DataTable pricedt = priceset.Tables[0]; //首页价格走势数据 DataTable newdt = nbll.GetNews(1, 5, 8); //首页热点资讯新闻数据(顶部) DataTable btnewdt = nbll.GetNews(1, 4, 8); //首页热点资讯新闻数据(底部) DataTable newggdt = nbll.GetNews(1, 5, 7); //首页平台公告新闻数据 DataTable yyaldt = nbll.GetNews(1, 3, 3); //首页案例数据 DataTable slhqdt = nbll.GetNews(1, 8, 2); //首页塑料行情 DataTable manufacturerdt = productbll.GetManufacturer(); //首页厂家信息 DataTable pdfdt = bll.GetListPDF(8); //认证报告数据 DataTable productdt = bll.GetProductList(8); //物性报告产品数据 List <pdflist> pdflist = Comm.ToDataList <pdflist>(pdfdt); List <tempproduct> prolist = Comm.ToDataList <tempproduct>(productdt); List <parminfo> typelist = cbll.listparminfo("", "", "0"); List <News> listnew = Comm.ToDataList <News>(newdt); List <News> yyallistnew = Comm.ToDataList <News>(yyaldt); List <News> slhqlistnew = Comm.ToDataList <News>(slhqdt); List <News> btlistnew = Comm.ToDataList <News>(btnewdt); List <News> gglistnew = Comm.ToDataList <News>(newggdt); List <Prices> pricelist = Comm.ToDataList <Prices>(pricedt); List <Manufacturer> mlist = Comm.ToDataList <Manufacturer>(manufacturerdt); DataTable dt = productbll.GetAnnotationList(16, 1, "", 0); var annotationlist = Comm.ToDataList <Annotation>(dt); string username = string.Empty; string userimg = string.Empty; if (AccountData != null) { username = AccountData.UserName; userimg = AccountData.HeadImage; } var returndata = new { newdata = listnew, yyaldata = yyallistnew, slhqldata = slhqlistnew, btnewdata = btlistnew, newggdata = gglistnew, pricedata = pricelist, manufacturerdata = mlist, annotationdata = annotationlist, typelistdata = typelist, pdfdata = pdflist, prodata = prolist, usname = username, usimg = userimg }; return(Json(Common.ToJsonResult("Success", "获取成功", returndata), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(Common.ToJsonResult("Fail", "获取失败", ex.Message), JsonRequestBehavior.AllowGet)); } }
protected void AddNews_Click(object sender, EventArgs e) { News news = new News(); news.News_Title1 = txtTitle.Text.Trim(); news.News_Time1 = DateTime.Now; news.News_Conentent1 = txtContent.Text; news.News_Num1 = int.Parse(txtNum.Text.Trim()); news.News_Img1 = @"~/Img_News/" + FileUpload1.PostedFile.FileName; news.News_Class1 = DropDownList_Class.SelectedItem.Text; try { if (NewsBll.Addnews(news) == 1) { txtContent.Text = ""; txtTitle.Text = ""; txtNum.Text = ""; Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('添加成功!');</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(typeof(object), "alert", "<script>alert('添加失败!');</script>"); } } catch (Exception ex) { Response.Write("错误原因:" + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { string newid = Request["newid"].ToString(); //System.Diagnostics.Debug.WriteLine(newid); NewsBll nb = new NewsBll(); newsId = nb.GetNews(int.Parse(newid)); }
//绑定首页三个新闻分区的数据 protected void bindLuandou() { DataTable ld = NewsBll.luandouTop5(); if (ld != null) { News_luandou.DataSource = ld; News_luandou.DataBind(); } }
protected void bindZatan() { DataTable zt = NewsBll.zatanTop5(); if (zt != null) { News_zatan.DataSource = zt; News_zatan.DataBind(); } }
protected void bindBanben() { DataTable bb = NewsBll.banbenTop5(); if (bb != null) { News_banben.DataSource = bb; News_banben.DataBind(); } }
//绑定卡组信息数据 protected void Bindkazu() { DataTable kz = NewsBll.kazu(); if (kz != null) { kazu.DataSource = kz; kazu.DataBind(); } }
public ActionResult _RightRaiders() { //当前月份排行榜最高的十条数据 ViewData["CurrentMonthTopTen"] = UserRaidersBll.GetNewestRaiders(); //右侧数据 var otherController = DependencyResolver.Current.GetService <NewsInfoController>(); ViewData["ViewTopNews"] = NewsBll.GetAllPageViewTopNews(); ViewBag.NewsetGameDemo = GameDemoBll.GetNewestGameDemo(); return(PartialView("_RightRaiders")); }
public ActionResult CpyNewsDel(int id) { if (NewsBll.NewsDelete(id)) { return(Content("ok")); } else { return(Content("no")); } }
public static NewsEntity FromNewsBll(NewsBll newsBll) { return(new NewsEntity { PartitionKey = NewsEntity.BuildPartitionkey(newsBll.City, newsBll.Date), RowKey = NewsEntity.BuildRowKey(newsBll.Id), Title = newsBll.Title, Content = newsBll.Content, Author = newsBll.Author }); }
//新游在线 热游、产业:1,2,3 private List <FrontNews> GetAllNews(string type) { List <FrontNews> list = NewsBll.LoadEntities(n => n.Type == type && n.State == "1").Select(n => new FrontNews() { Id = n.Id, Title = n.Title, EditTitle = n.EditTitle, InTime = n.InTime }).AsNoTracking().OrderByDescending(n => n.InTime).Take(6).ToList(); return(list); }
/// <summary> /// 新闻评论的数据加载 /// </summary> /// <returns></returns> public ActionResult LoadNewsLeaveMsg() { int newsId = int.Parse(Request["newsId"]); int pageIndex = int.Parse(Request["pageIndex"] ?? "1"); int pageSize = int.Parse(Request["pageSize"] ?? "20"); int total = 0; var msg = LeaveMsgBll.LoadEntities(m => true); var news = NewsBll.LoadEntities(n => n.Id > 0).Select(n => new { n.Id }); var user = PersonalUserBll.LoadEntities(u => u.Id > 0).Select(u => new { u.UName, u.Id, u.Head }); //-------------请求发布的评论---------------------------------- var data = from m in msg join u in user on m.PersonalUserId equals u.Id into um from umi in um.DefaultIfEmpty() join n in news on m.NewsId equals n.Id where m.NewsId == newsId where m.ReplyId == null || m.ReplyId == 0 select new Publish() { Id = m.Id, Msg = m.Msg, City = m.City, UserName = umi != null ? umi.UName : "" + m.Id + "" + "爽赞网友", //用户名 UserNameImg = umi.Head != null ? ("/Content/Img/" + umi.Head) : null, //用户头像 InTime = m.InTime, Tip = m.Tip == null ? 0 : m.Tip, Stamp = m.Stamp == null ? 0 : m.Stamp, }; var alldata = data.AsNoTracking().OrderByDescending(d => d.InTime).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList(); total = data.Count(); List <Publish> list = WebHelper.ToListTimeSpan(alldata); //-------------------------- //回复的数据--------------------------------------------- string pubStrNav = LaomaPager.ShowPageNavigate(pageSize, pageIndex, total); //回复的数据 var replyData = LeaveMsgBll.GetNewsLeaveMsgData(newsId).Select(n => new Reply { SelfId = n.SelfId, ReplyId = n.ReplyId, ReplyContent = n.ReplyContent, ReplyCity = n.ReplyCity, ReplyName = n.ReplyName, ReplyUserImg = n.ReplyUserImg, //用户头像 ReplyInTime = n.ReplyInTime, ReplyTip = n.ReplyTip, ReplyStamp = n.ReplyStamp, }).ToList(); List <Reply> replyList = WebHelper.ToReplyStrTimeSpan(replyData); var result = new { Data = list, replyData = replyList, PubStrNav = pubStrNav, Total = total }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public List <FrontNews> GetNewestNewsPC() { List <FrontNews> list = NewsBll.LoadEntities(n => n.Type == "4" && n.State == "1") .Select(n => new FrontNews() { Id = n.Id, Title = n.Title, EditTitle = n.EditTitle, InTime = n.InTime }).OrderByDescending(n => n.InTime).Take(15).AsNoTracking().ToList(); return(list); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //NewsClass = Request.QueryString["classname"].ToString(); DataTable ld = NewsBll.luandou(); NewsLD.DataSource = ld; NewsLD.DataBind(); if (ld != null) { News_ClassName.Text = ld.Rows[0][6].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //NewsClass = Request.QueryString["classname"].ToString(); DataTable bb = NewsBll.banben(); NewsBB.DataSource = bb; NewsBB.DataBind(); if (bb != null) { News_ClassName3.Text = bb.Rows[0][6].ToString(); } } }
public async Task <bool> IsAuthorOf(string city, DateTime date, Guid id, string author) { try { // TODO: test NewsBll news = await this.GetNews(city, date, id); return(string.Equals(news.Author, author)); } catch (AzureXStoreException) { throw new RepositoryException("The news is not in the database."); } }
public ActionResult _RightNews() { //---------------资讯排行--------------------- ViewData["ViewTopNews"] = NewsBll.GetAllPageViewTopNews(); //---------------精彩图文------------------------ ViewBag.WonderfulSeeNews = WonderfulTxtImgBll.LoadEntities(n => true).OrderByDescending(n => n.InTime) .Take(4).AsNoTracking().ToList(); //----------------最赞攻略------------------------ ViewBag.NewestRaiders = UserRaidersBll.GetMostGreatRaiders(); //----------------最新福利-------------- ViewBag.NewsetGameDemo = GameDemoBll.GetNewestGameDemo(); return(PartialView("_RightNews")); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //NewsClass = Request.QueryString["classname"].ToString(); DataTable zt = NewsBll.zatan(); NewsLD.DataSource = zt; NewsLD.DataBind(); if (zt != null) { News_ClassName2.Text = zt.Rows[0][6].ToString(); } } }
/// <summary> /// 获取新闻列表 /// </summary> /// <param name="pageSize"></param> /// <param name="id"></param> /// <param name="pageindex"></param> /// <param name="recordCount"></param> /// <returns></returns> private static List <Model.News> GetNewsList(int pageSize, string id, string pageindex, ref int recordCount) { string newsin = string.Empty; List <Model.Category> categoryList = new CategoryBll().GetModelList("Status=1"); List <int> inList = categoryList.FindAll(o => o.IdPath.StartsWith(categoryList.SingleOrDefault(p => p.CategoryId == Convert.ToInt32(id)).IdPath)).Select(o => o.CategoryId).ToList(); foreach (int item in inList) { newsin += (item.ToString() + ','); } newsin = newsin.TrimEnd(','); List <Model.News> list = new NewsBll().GetPage(Convert.ToInt32(pageindex), pageSize, "UpdateDate desc", out recordCount, "CategoryId in(" + newsin + ")"); return(list); }