void _newsServices_OnGetNewsListCompleted(object sender, GetEntityListEventArgs <SAAS.Platform.Model.NewsModel> e) { if (e.Error == null) { try { var result = e.Result; if (result.Count > 0) { foreach (var item in e.Result) { NewsShow newsview = new NewsShow(); newsview.LoadNewsDetails(item.NEWSID); string titel = ""; switch (item.NEWSTYPEID) { case "0": titel = "新 闻"; break; case "1": titel = "动 态"; break; default: break; } var host = ProgramManager.ShowProgram(titel, string.Empty, item.NEWSID, newsview, true, true, null); } } } catch (Exception) { } } }
/// <summary> /// 转换 /// </summary> /// <param name="arg"></param> /// <returns></returns> private NewsShow GetNewsListTran(IDataReader arg) { NewsShow newsShow = new NewsShow(); newsShow.Href = DataRecord.GetString(arg, "Href"); newsShow.Title = DataRecord.GetString(arg, "Title"); return(newsShow); }
protected void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (IsSafe(Request.QueryString["id"], 2) == false) { Response.Write("非法参数,<a href=BlogIndex.aspx>点此返回</a>"); Response.End(); } string ST_dns = ConfigurationSettings.AppSettings["conStr"]; string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + ""; //最新推荐文章 string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_id desc"; ST_myConn = new SqlConnection(ST_dns); SqlDataAdapter ST_myCmd = new SqlDataAdapter(ST_sql, ST_myConn); SqlDataAdapter ST_classCmd = new SqlDataAdapter("select ST_c_id,ST_c_name from ST_class", ST_myConn); SqlDataAdapter ST_cmdCmd = new SqlDataAdapter(ST_cmd_sql, ST_myConn); DataSet ST_ds = new DataSet(); ST_myCmd.Fill(ST_ds, "新闻查看"); DataSet ST_classds = new DataSet(); ST_classCmd.Fill(ST_classds, "类别列表"); DataSet ST_cmdds = new DataSet(); ST_cmdCmd.Fill(ST_cmdds, "推荐文章"); NewsShow.DataSource = ST_ds.Tables[0]; NewsShow.DataBind(); ClassList.DataSource = new DataView(ST_classds.Tables[0]); ClassList.DataBind(); CmdList.DataSource = new DataView(ST_cmdds.Tables[0]); CmdList.DataBind(); //调用ST_UpdateHit()方法 ST_UpdateHit(); if (Request.Cookies["colors"] != null) { string ST_test = Request.Cookies["colors"].Value; String[] ST_colorList = ST_test.Split(new char[] { ',' }); ST_bgcolor = ST_colorList[0]; ST_tcolor = ST_colorList[1]; } else { ST_bgcolor = "#FFDE94"; ST_tcolor = "#efe3ce"; } Page.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + ""; conn.Open(); SqlDataAdapter da = new SqlDataAdapter(ST_sql, conn); DataSet ds = new DataSet(); da.Fill(ds); NewsShow.DataSource = ds.Tables[0]; NewsShow.DataBind(); ST_UpdateHit(); } }
public JsonResult GetPost(string id) { using (MinhThanhEntities db = new MinhThanhEntities()) { if (id != null) { int idPost; if (int.TryParse(id, out idPost)) { NewsShow model = new NewsShow(); model.Post = db.Posts.Where(p => p.id == idPost).FirstOrDefault(); model.CategoryPost = ( from cp in db.CategoryPosts where cp.id == model.Post.idCategory select new AltCategoryPost() { id = cp.id, description = cp.description, title = cp.title, alias = cp.alias, imageBanner = cp.imageBanner } ).FirstOrDefault(); model.LastPosts = ( from p in db.Posts where p.idCategory == model.CategoryPost.id && p.id != model.Post.id && p.published == true orderby p.timePublished descending select new AltPost() { id = p.id, title = p.title, alias = p.alias, description = p.description, image = p.image, timePublished = p.timePublished } ).ToList(); return(Json(model, JsonRequestBehavior.AllowGet)); } } return(null); } }
protected void Page_Load(object sender, EventArgs e) { // 在此处放置用户代码以初始化页面 if (IsSafe(Request.QueryString["id"], 2) == false) { Response.Write("错误页面,<a href=BlogIndex.aspx>点此返回</a>"); Response.End(); } string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + ""; //最新推荐文章 string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_id desc"; string sqlstr = "select ST_c_id,ST_c_name from ST_class"; DataSet ST_ds = myobj.GetDataSet(ST_sql, "ST_news"); DataSet ST_classds = myobj.GetDataSet(sqlstr, "ST_class"); DataSet ST_cmdds = myobj.GetDataSet(ST_cmd_sql, "ST_news"); NewsShow.DataSource = ST_ds.Tables[0]; NewsShow.DataBind(); ClassList.DataSource = new DataView(ST_classds.Tables[0]); ClassList.DataBind(); CmdList.DataSource = new DataView(ST_cmdds.Tables[0]); CmdList.DataBind(); //调用ST_UpdateHit()方法 ST_UpdateHit(); if (Request.Cookies["colors"] != null) { string ST_test = Request.Cookies["colors"].Value; String[] ST_colorList = ST_test.Split(new[] { ',' }); ST_bgcolor = ST_colorList[0]; ST_tcolor = ST_colorList[1]; } else { ST_bgcolor = "#FFFFFF"; ST_tcolor = "#cccccc"; } Page.DataBind(); }
void tblRollnews_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { T_PF_NEWS news = ((sender as TextBlock).DataContext as NewsModel).DataContent as T_PF_NEWS; NewsShow newsview = new NewsShow(); newsview.LoadNewsDetails(news.NEWSID); string titel = ""; switch (news.NEWSTYPEID) { case "0": titel = "新 闻"; break; case "1": titel = "动 态"; break; case "2": titel = "公 告"; break; case "3": titel = "通 知"; break; default: break; } System.Windows.Controls.Window.Show(titel, "", news.NEWSID, true, true, newsview, null); }