/// <summary> /// 判断是否登录,显示登录框 /// </summary> public void IsLogin() { try { //判断是否登录 if (LoginModel.IsLoginAll()) { //隐藏登录注册框 index_Dvlogin.Visible = false; index_mNotice.Style.Add("height", "240px"); index_mNotice.Style.Add("padding-top", "10px;"); } else { index_mNotice.Attributes.Remove("style"); } //公告 List <Hi.Model.SYS_NewsNotice> ListNes = new Hi.BLL.SYS_NewsNotice().GetList(" top 6 ID,NewsTitle,CreateDate ", " dr=0 and NewsType=2 and IsEnabled=1 ", " createdate desc "); Rpt_News.DataSource = ListNes; Rpt_News.DataBind(); //行业新闻 List <Hi.Model.SYS_NewsNotice> ListNes1 = new Hi.BLL.SYS_NewsNotice().GetList(" top 6 ID,NewsTitle,CreateDate ", " dr=0 and NewsType in(1,3) and IsEnabled=1 ", " createdate desc "); Rpt_News1.DataSource = ListNes1; Rpt_News1.DataBind(); } catch (Exception) { Session.Clear(); Session.Abandon(); Response.Redirect(ConfigurationManager.AppSettings["WebDomainName"].ToString()); } }
public void Databind() { if (KeyID != 0) { Hi.Model.SYS_NewsNotice NewsNotice = new Hi.BLL.SYS_NewsNotice().GetModel(KeyID); try { txtNewsTitle.Value = NewsNotice.NewsTitle; this.textNewsInfo.Text = NewsNotice.NewsInfo; this.textKeywords.Value = NewsNotice.KeyWords; content7.Text = NewsNotice.NewsContents; //是否启用 int status = NewsNotice.IsEnabled; this.rdoStatus1.Checked = (status != 1); this.rdoStatus0.Checked = (status == 1); //是否置顶 int istop = NewsNotice.IsTop; this.Radio4.Checked = (istop != 1); this.Radio3.Checked = (istop == 1); //类型 1:新闻 2:公告 3:资讯 int newstype = NewsNotice.NewsType; this.Radio1.Checked = (newstype == 1); this.Radio2.Checked = (newstype == 2); this.Radio5.Checked = (newstype == 3); this.Radio6.Checked = (newstype == 4); } catch (Exception ex) { } } }
public void GetNewsList() { List <Hi.Model.SYS_NewsNotice> AllNewNotice = null; if (HttpRuntime.Cache.Get("AllNewNotice") == null) { AllNewNotice = new Hi.BLL.SYS_NewsNotice().QueryGroupNew("top 3 id,NewsType,NewsTitle,createdate"); HttpRuntime.Cache.Insert("AllNewNotice", AllNewNotice, null, DateTime.Now.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration); } else { AllNewNotice = HttpRuntime.Cache["AllNewNotice"] as List <Hi.Model.SYS_NewsNotice>; } //行业新闻 List <Hi.Model.SYS_NewsNotice> LANewsNotice = AllNewNotice.Where(T => T.NewsType == 1).ToList(); this.Rpt_News_1.DataSource = LANewsNotice; this.Rpt_News_1.DataBind(); // 小陌咨询 List <Hi.Model.SYS_NewsNotice> NewsList2 = AllNewNotice.Where(T => T.NewsType == 3).ToList(); this.Rpt_News_2.DataSource = NewsList2; this.Rpt_News_2.DataBind(); // List <Hi.Model.SYS_NewsNotice> NewsList4 = AllNewNotice.Where(T => T.NewsType == 4).ToList(); this.Rpt_News_4.DataSource = NewsList4; this.Rpt_News_4.DataBind(); }
public void Bind() { int pageCount = 0; int Counts = 0; //每页显示的数据设置 if (this.txtPageSize.Value.ToString() != "") { if (this.txtPageSize.Value.Trim().Length >= 5) { Pager.PageSize = 20; this.txtPageSize.Value = "20"; } else { Pager.PageSize = this.txtPageSize.Value.Trim().ToInt(0); } } List <Hi.Model.SYS_NewsNotice> LANewsNotice = new Hi.BLL.SYS_NewsNotice().GetList(Pager.PageSize, Pager.CurrentPageIndex, "CreateDate", true, SearchWhere(), out pageCount, out Counts); this.Rpt_Distribute.DataSource = LANewsNotice; this.Rpt_Distribute.DataBind(); Pager.RecordCount = Counts; page = Pager.CurrentPageIndex.ToString(); }
/// <summary> /// 新闻公告 /// </summary> /// <returns></returns> public void NewsBind() { List <Hi.Model.SYS_NewsNotice> l = new Hi.BLL.SYS_NewsNotice().GetList("top 4 *", "isnull(dr,0)=0 and isenabled=1 ", "CreateDate desc,IsTop desc"); rptNews.DataSource = l; rptNews.DataBind(); }
public void BindNewsList() { int pageCount = 0; int Counts = 0; List <Hi.Model.SYS_NewsNotice> NewLsit = new Hi.BLL.SYS_NewsNotice().GetList(Pager_List.PageSize, Pager_List.CurrentPageIndex, "CreateDate", true, " and isnull(dr,0)=0 " + SqlWhrere() + " ", out pageCount, out Counts); Rpt_News.DataSource = NewLsit; Rpt_News.DataBind(); Pager_List.RecordCount = Counts; Pager_List.TextBeforePageIndexBox = "<i class='tf2'>共" + Pager_List.PageCount + "页</i> <span class='tf2'>到第:</span>"; page = Pager_List.CurrentPageIndex.ToString(); }
public void DataBinds() { if (KeyID != 0) { Hi.Model.SYS_NewsNotice NewsNotice = new Hi.BLL.SYS_NewsNotice().GetModel(KeyID); //lblnewstitle.InnerText = NewsNotice.NewsTitle; title = NewsNotice.NewsTitle; //lblcontent.InnerText = NewsNotice.NewsContents; if (NewsNotice.KeyWords != null) { this.lblKeywords.Text = NewsNotice.KeyWords; } if (NewsNotice.NewsInfo.Length < 100) { lblNewsInfo.Text = NewsNotice.NewsInfo; } else { lblNewsInfo.Text = NewsNotice.NewsInfo.Substring(0, 100) + "...."; } string pat = "<[^<>]+>"; Regex regex = new Regex(pat, RegexOptions.None); content = regex.Replace(NewsNotice.NewsContents, ""); lblstate.InnerText = NewsNotice.IsEnabled == 1 ? "发布" : "非发布"; lblistop.InnerText = NewsNotice.IsTop == 1 ? "置顶" : "非置顶"; newstype = NewsNotice.NewsType; if (newstype == 1) { lblnewtype.InnerHtml = "新闻"; } else if (newstype == 2) { lblnewtype.InnerHtml = "公告"; } else if (newstype == 2) { lblnewtype.InnerHtml = "资讯"; } else { lblnewtype.InnerHtml = "生意经"; } content7.Text = NewsNotice.NewsContents; } else { Response.Write("信息不存在。"); Response.End(); } }
protected void btn_Del(object sender, EventArgs e) { Hi.Model.SYS_NewsNotice NewsNotice = new Hi.BLL.SYS_NewsNotice().GetModel(KeyID); if (NewsNotice != null) { NewsNotice.dr = 1; NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; if (new Hi.BLL.SYS_NewsNotice().Update(NewsNotice)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='NewsList.aspx'; }"); Response.Redirect("NewsList.aspx"); } } }
public int[] Count(int page, string type) { if (type == "s") { List <Hi.Model.SYS_NewsNotice> List = new Hi.BLL.SYS_NewsNotice().GetList("NewsTitle,NewsContents,NewsType", " isnull(dr,0)=0 and id=" + page + " ", ""); string preSql = " ID < " + page + " and NewsType='" + List[0].NewsType + "'"; List <Hi.Model.SYS_NewsNotice> ListNews = new Hi.BLL.SYS_NewsNotice().GetList("top 1 *", preSql, " ID desc"); int[] intarr = new int[2]; intarr[0] = ListNews.Count; if (intarr[0] > 0) { intarr[1] = ListNews[0].ID; } else { intarr[1] = page; } return(intarr); } else { List <Hi.Model.SYS_NewsNotice> List = new Hi.BLL.SYS_NewsNotice().GetList("NewsTitle,NewsContents,NewsType", " isnull(dr,0)=0 and id=" + page + " ", ""); string nextSql = " ID > " + page + " and NewsType='" + List[0].NewsType + "'"; List <Hi.Model.SYS_NewsNotice> ListNews = new Hi.BLL.SYS_NewsNotice().GetList("top 1 *", nextSql, " ID ASC"); int[] intarr = new int[2]; intarr[0] = ListNews.Count; if (intarr[0] > 0) { intarr[1] = ListNews[0].ID; } else { intarr[1] = page; } return(intarr); } }
public void DataBindInfo() { List <Hi.Model.SYS_NewsNotice> ListNews = new Hi.BLL.SYS_NewsNotice().GetList("KeyWords,NewsTitle,NewsContents,NewsType,CreateDate", " isnull(dr,0)=0 and id=" + Request["Newsid"] + " ", ""); if (ListNews.Count > 0) { HNewsTitle.InnerText = ListNews[0].NewsTitle; title = ListNews[0].NewsTitle; DivNewsContens.InnerHtml = ListNews[0].NewsContents; mKeyword.Content = ListNews[0].KeyWords; DivDateTime.InnerHtml = "发布日期:" + Convert.ToDateTime(ListNews[0].CreateDate).ToString("yyyy-MM-dd"); switch (ListNews[0].NewsType.ToString()) { case "1": LiNews_1.Attributes["class"] = "flbt hover"; Inewstext.InnerText = "行业新闻"; break; case "3": LiNews_3.Attributes["class"] = "flbt hover"; Inewstext.InnerText = "资讯"; break; case "4": LiNews_4.Attributes["class"] = "flbt hover"; Inewstext.InnerText = "生意经"; break; case "2": LiNews_2.Attributes["class"] = "flbt hover"; Inewstext.InnerText = "公告"; break; } } }
/// <summary> /// 判断是否登录,显示登录框 /// </summary> public void IsLogin() { try { //判断是否登录 if (LoginModel.IsLoginAll()) { //隐藏登录注册框 index_Dvlogin.Visible = false; index_mNotice.Style.Add("height", "240px"); index_mNotice.Style.Add("padding-top", "10px;"); } else { index_mNotice.Attributes.Remove("style"); } //绑定最新入驻的企业 string sqlcomp = string.Format(@"select top 10 CompName,ShortName from BD_Company where BD_Company.dr='0' and BD_Company.AuditState=2 and BD_Company.IsEnabled=1 order by ID desc "); DataTable ListComp = new Hi.BLL.BD_Goods().GoodsAttr(sqlcomp);//数据源 Rpt_comps.DataSource = ListComp; Rpt_comps.DataBind(); //公告 List <Hi.Model.SYS_NewsNotice> ListNes = new Hi.BLL.SYS_NewsNotice().GetList(" top 6 ID,NewsTitle,CreateDate ", " dr=0 and NewsType=2 and IsEnabled=1 ", " createdate desc "); Rpt_News.DataSource = ListNes; Rpt_News.DataBind(); } catch (Exception) { Session.Clear(); Session.Abandon(); Response.Redirect(ConfigurationManager.AppSettings["WebDomainName"].ToString()); } }
protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Common.NoHTML(txtNewsTitle.Value.Trim()))) { JScript.AlertMsg(this, "消息标题不能为空!"); return; } Hi.Model.SYS_NewsNotice NewsNotice = null; if (KeyID != 0) { NewsNotice = new Hi.BLL.SYS_NewsNotice().GetModel(KeyID); NewsNotice.NewsTitle = Common.NoHTML(txtNewsTitle.Value.Trim());//去除非法字符 NewsNotice.NewsInfo = Common.NoHTML(textNewsInfo.Text.Trim()); NewsNotice.KeyWords = Common.NoHTML(textKeywords.Value.Trim()); NewsNotice.NewsContents = content7.Text.Trim(); //是否启用 if (this.rdoStatus1.Checked) { NewsNotice.IsEnabled = 0; } else { NewsNotice.IsEnabled = 1; } //是否置顶 if (this.Radio3.Checked) { NewsNotice.IsTop = 1; } else { NewsNotice.IsTop = 0; } //类别 if (this.Radio1.Checked) { NewsNotice.NewsType = 1; } else if (this.Radio2.Checked) { NewsNotice.NewsType = 2; } else if (this.Radio5.Checked) { NewsNotice.NewsType = 3; } else { NewsNotice.NewsType = 4; } NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; if (new Hi.BLL.SYS_NewsNotice().Update(NewsNotice)) { //JScript.AlertMsgMo(this, "操作成功", "function(){ window.location.href='NewsInfo.aspx?KeyID=" + KeyID + "'; }"); Response.Redirect("NewsInfo.aspx?KeyID=" + KeyID); } } else { NewsNotice = new Hi.Model.SYS_NewsNotice(); NewsNotice.NewsTitle = Common.NoHTML(txtNewsTitle.Value.Trim());//去除非法字符 NewsNotice.NewsInfo = Common.NoHTML(textNewsInfo.Text.Trim()); NewsNotice.KeyWords = Common.NoHTML(textKeywords.Value.Trim()); NewsNotice.NewsContents = content7.Text.Trim(); //是否启用 if (this.rdoStatus1.Checked) { NewsNotice.IsEnabled = 0; } else { NewsNotice.IsEnabled = 1; } //是否置顶 if (this.Radio3.Checked) { NewsNotice.IsTop = 1; } else { NewsNotice.IsTop = 0; } //类别 if (this.Radio1.Checked) { NewsNotice.NewsType = 1; } else if (this.Radio2.Checked) { NewsNotice.NewsType = 2; } else if (this.Radio5.Checked) { NewsNotice.NewsType = 3; } else { NewsNotice.NewsType = 4; } //标准参数 NewsNotice.CreateDate = DateTime.Now; NewsNotice.CreateUserID = UserID; NewsNotice.ts = DateTime.Now; NewsNotice.modifyuser = UserID; int newsrid = 0; newsrid = new Hi.BLL.SYS_NewsNotice().Add(NewsNotice); if (newsrid > 0) { Response.Redirect("NewsInfo.aspx?KeyID=" + newsrid); } } }