Beispiel #1
0
 private void AddNews()
 {
     R_News r = new R_News();
     r.News_Tital = NewsTitle.Text.Trim();
     r.Sort_ID = Convert.ToInt32(News_Sort.SelectedValue);
     r.News_Content = NewsContent.Value;
     r.User_ID = Convert.ToInt32(Request.Cookies["user"]["ID"]);
     r.News_Reading = reading.Checked == true ? 1 : 0;
     r.News_ImageBool = imageCheck.Checked == true ? 1 : 0;
     r.News_Images = imageCheck.Checked == true ? Img_Url.Value.Trim() : "";
     B_News b = new B_News();
     if (b.addNews(r))
     {
         NewsTitle.Text = "";
         Img_Url.Value = "";
         News_Sort.SelectedIndex = 0;
         NewsContent.Value = "";
         ll_ts.Text = "添加成功!";
         //Response.Redirect("Default.aspx");
     }
     else
     {
         ll_ts.Text = "添加失败!";
     }
 }
Beispiel #2
0
 private void pageLode()
 {
     B_News b = new B_News();
     DataTable dt = b.getNewsByID(id).Tables[0];
     NewsTitle = dt.Rows[0]["News_Tital"].ToString();
     SiteContent.Value = dt.Rows[0]["News_Content"].ToString();
 }
Beispiel #3
0
 private void pageLode()
 {
     if (Request.QueryString["action"] != null)
     {
         if(userType == 1||userType == 0)
         {
             if ((Request.QueryString["action"].Equals("cancel") && Request.QueryString["id"] != null))
             {
                 int id = Convert.ToInt32(Request.QueryString["id"]);
                 B_News b = new B_News();
                 if (b.CancelNewsReading(id, 0))
                 {
                     Response.Redirect("index.aspx");
                 }
                 else
                 {
                     Response.Write("<script>alert('取消失败!')</script>");
                 }
             }
         }
         else
         {
             Response.Write("<script>alert('用户权限不足!')</script>");
         }
     }
     bindData();
 }
Beispiel #4
0
 /// <summary>
 /// 根据ID获取数据
 /// </summary>
 /// <param name="id"></param>
 private void getDataByID(int id)
 {
     B_News b = new B_News();
     DataTable dt = b.getNewsByID(id).Tables[0];
     NewsTitle.Text = dt.Rows[0]["News_Tital"].ToString();
     NewsContent.Value = dt.Rows[0]["News_Content"].ToString();
 }
Beispiel #5
0
 private void bindData()
 {
     B_Index b = new B_Index();
     Links.InnerHtml = b.getLinks();
     B_InforData bf = new B_InforData();
     hotNews.InnerHtml = bf.getHotNews();
     bindNews();
     B_News bn = new B_News();
     webInfor.InnerHtml = bn.getWebInfor().Tables[0].Rows[0]["News_Content"].ToString();
 }
Beispiel #6
0
 private void bindNewsData()
 {
     AspNetPager1.PageSize = Convert.ToInt32(page_rows.SelectedValue);
     B_News b = new B_News();
     //绑定文章表格数据
     DataSet ds = b.getNewsData();
     PagedDataSource ps = new PagedDataSource();
     ps.DataSource = ds.Tables[0].DefaultView;
     AspNetPager1.RecordCount = ps.Count;
     ps.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
     ps.AllowPaging = true;
     ps.PageSize = AspNetPager1.PageSize;
     R_News.DataSource = ps;
     R_News.DataBind();
 }
Beispiel #7
0
    private void bindData()
    {
        AspNetPager1.PageSize = 10;
        B_News b = new B_News();
        DataSet ds = b.getDataByReading();
        PagedDataSource ps = new PagedDataSource();
        ps.DataSource = ds.Tables[0].DefaultView;
        AspNetPager1.RecordCount = ps.Count;
        ps.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        ps.AllowPaging = true;
        ps.PageSize = AspNetPager1.PageSize;
        R_Reading.DataSource = ps;
        R_Reading.DataBind();

        about.InnerHtml = b.getAbout().Tables[0].Rows[0]["News_Content"].ToString() ;
    }
Beispiel #8
0
 private void editNews()
 {
     R_News r = new R_News();
     r.News_Tital = NewsTitle.Text.Trim();
     r.Sort_ID = 8;
     r.News_Content = NewsContent.Value;
     r.User_ID = Convert.ToInt32(Request.Cookies["user"]["ID"]);
     r.ID = id;
     r.News_Reading = 0;
     r.News_ImageBool = 0;
     r.News_Images = "";
     B_News b = new B_News();
     if (b.editNews(r))
     {
         Response.Redirect("../index.aspx");
     }
     else
     {
         ll_ts.Text = "修改失败!";
     }
 }
Beispiel #9
0
 private void editNews()
 {
     R_News r = new R_News();
     r.News_Tital = NewsTitle;
     r.Sort_ID = 8;
     r.News_Content = SiteContent.Value;
     r.User_ID = Convert.ToInt32(Request.Cookies["user"]["ID"]);
     r.ID = id;
     r.News_Reading = 0;
     r.News_ImageBool = 0;
     r.News_Images = "";
     B_News b = new B_News();
     if (b.editNews(r))
     {
         Response.Write("<script>alert('更新成功')</script>");
     }
     else
     {
         ll_ts.Text = "修改失败!";
     }
 }
Beispiel #10
0
    private void bindData()
    {
        B_Index b = new B_Index();
        Links.InnerHtml = b.getLinks();
        Reading.InnerHtml = b.getDataByReading();
        Latestnews.InnerHtml = b.getLatestnews();
        hotNews.InnerHtml = b.getHotNews();
        imageBox.InnerHtml = b.getDataByImg();
        icoBox.InnerHtml = b.getIcoBox();
        demo1.InnerHtml = b.getImgList();

        _Marknews.InnerHtml = b.getMarknews();
        _AgricultTech.InnerHtml = b.getAgricultTech();
        _Supply_Infor.InnerHtml = b.getSupply_demandInfor();

        _PolicyLaws.InnerHtml = b.getPolicyLaws();
        _NYKJ.InnerHtml = b.getNYKJ();
        _Economicnews.InnerHtml = b.getEconomicnews();

        B_News bn=new B_News();
        webInfor.InnerHtml = bn.getWebInfor().Tables[0].Rows[0]["News_Content"].ToString();
    }
Beispiel #11
0
 private void bindData()
 {
     B_InforData bf=new B_InforData();
     thisCP.NavigateUrl = bf.getCpByID(id)["Sort_Value"].ToString() + ".aspx";
     thisCP.Text = bf.getCpByID(id)["Sort_Name"].ToString();
     dataTableByID.InnerHtml = bf.getInforByID(id);
     GetIP g = new GetIP();
     R_Read r = new R_Read();
     r.News_ID = id;
     r.Read_IP = g.GetRealIP();
     r.Read_Time = DateTime.Now.Date;
     B_News bn = new B_News();
     webInfor.InnerHtml = bn.getWebInfor().Tables[0].Rows[0]["News_Content"].ToString();
     B_Index bi=new B_Index();
     try
     {
         bi.searchRead(r);
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Beispiel #12
0
    /// <summary>
    ///  获取新闻分类
    /// </summary>
    private void getSort()
    {
        B_News b = new B_News();
        //绑定文章分类列表数据
        DataSet ds = b.getNews_Sort();

        foreach (DataRow r in ds.Tables[0].Rows)
        {
            string t = r["Sort_Name"].ToString();
            string v = r["ID"].ToString();
            ListItem l = new ListItem(t, v);//初始化ListItem的值
            News_Sort.Items.Add(l);
        }
    }
Beispiel #13
0
 /// <summary>
 /// 根据ID获取数据
 /// </summary>
 /// <param name="id"></param>
 private void getDataByID(int id)
 {
     B_News b = new B_News();
     DataTable dt = b.getNewsByID(id).Tables[0];
     NewsTitle.Text = dt.Rows[0]["News_Tital"].ToString();
     News_Sort.Enabled = false;
     reading.Checked = Convert.ToBoolean(Convert.IsDBNull(dt.Rows[0]["News_Reading"]) == false ? dt.Rows[0]["News_Reading"] : 0);
     imageCheck.Checked = Convert.ToBoolean(Convert.IsDBNull(dt.Rows[0]["News_ImageBool"]) == false ? dt.Rows[0]["News_ImageBool"] : 0);
     Img_Url.Value = dt.Rows[0]["News_Images"].ToString();
     News_Sort.SelectedValue = dt.Rows[0]["Sort_ID"].ToString();
     NewsContent.Value = dt.Rows[0]["News_Content"].ToString();
 }
Beispiel #14
0
    private void pageLode()
    {
        if (Request.QueryString["action"] != null )
        {
            if (userType == 0 || userType == 1)
            {
                if (Request.QueryString["id"] != null)
                {
                    B_News b = new B_News();
                    if (b.deleteByNewsID(Convert.ToInt32(Request.QueryString["id"])))
                    {
                        Response.Redirect("Default.aspx");
                    }
                    else
                    {
                        Response.Write("<sciput>alert('删除失败')</sciput>");
                    }
                }

                //if (Request.QueryString["action"].Equals("deleteIDs") && Request.QueryString["ids"] != null)
                //{
                //    B_News b = new B_News();
                //    string[] ids=Request.QueryString["ids"].Split(',');
                //    int count = 0;
                //    foreach (string id in ids)
                //    {
                //        if (b.deleteByNewsID(Convert.ToInt32(id)))
                //        {
                //            count++;
                //        }
                //        else
                //        {

                //        }
                //    }
                //    Response.Write(count);
                //}
            }
            else
            {
                Response.Write("<script>alert('用户权限不足,不能删除!')</script>");
            }
        }
        bindNews_Sort();
        bindNewsData();
    }
Beispiel #15
0
 private void bindData()
 {
     B_News bn = new B_News();
     about.InnerHtml = bn.getAbout().Tables[0].Rows[0]["News_Content"].ToString();
     webInfor.InnerHtml = bn.getWebInfor().Tables[0].Rows[0]["News_Content"].ToString();
 }