コード例 #1
0
    public void BindData()
    {
        NewsInfo newsInfo = NewsInfo.Read(int.Parse(base.Request["id"]));

        this.lb_newsTitle.Text   = newsInfo.Title;
        this.lb_newsDate.Text    = newsInfo.AddDate.ToString();
        this.lb_newsContent.Text = newsInfo.Conent;
        NewsSortInfo newsSortInfo = NewsSortInfo.Read(newsInfo.SortId);

        this.lb_newscate.Text = newsSortInfo.SortName;
    }
コード例 #2
0
ファイル: NewsInfo.cs プロジェクト: wuliuhuifeng/vs2013double
    public static List <NewsInfo> ReadList(string whereStr)
    {
        List <NewsInfo> list        = new List <NewsInfo>();
        Database        database    = new Database();
        DataView        defaultView = database.RunProc("select * from News " + whereStr).Tables[0].DefaultView;

        for (int i = 0; i < defaultView.Count; i++)
        {
            list.Add(NewsInfo.Read(int.Parse(defaultView[i]["id"].ToString())));
        }
        database.Dispose();
        return(list);
    }
コード例 #3
0
    protected void bt_add_Click(object sender, EventArgs e)
    {
        if (base.Request.QueryString["id"] != null)
        {
            NewsInfo newsInfo = NewsInfo.Read(int.Parse(base.Request.QueryString["id"]));
            newsInfo.Title    = this.biaoti.Value;
            newsInfo.TitleRed = (this.cb_titleRed.Checked ? 1 : 0);
            newsInfo.IsTop    = (this.cb_isTop.Checked ? 1 : 0);
            newsInfo.Conent   = this.content.Value;
            newsInfo.Update();
            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('修改成功!');", true);
            return;
        }
        NewsInfo newsInfo2 = new NewsInfo(0, int.Parse(this.lei.Value), this.biaoti.Value, this.cb_titleRed.Checked ? 1 : 0, this.content.Value, DateTime.Now, this.cb_isTop.Checked ? 1 : 0);

        newsInfo2.Insert();
        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "Ok", "alert('添加成功!');", true);
    }
コード例 #4
0
 public void BindData()
 {
     this.lei.DataSource     = this.db.RunProcGetDataView("select * from newsSort order by xuhao");
     this.lei.DataTextField  = "sortName";
     this.lei.DataValueField = "id";
     this.lei.DataBind();
     if (base.Request.QueryString["id"] != null)
     {
         NewsInfo newsInfo = NewsInfo.Read(int.Parse(base.Request.QueryString["id"]));
         this.lei.Value           = newsInfo.SortId.ToString();
         this.biaoti.Value        = newsInfo.Title;
         this.cb_titleRed.Checked = (newsInfo.TitleRed == 1);
         this.cb_isTop.Checked    = (newsInfo.IsTop == 1);
         this.content.Value       = newsInfo.Conent;
         this.lb_t.Text           = "修改文章";
         this.bt_add.Text         = "提交修改";
     }
     if (base.Request.QueryString["id"] != null && base.Request.QueryString["action"] != null && base.Request.QueryString["action"] == "delete")
     {
         NewsInfo.Delete(int.Parse(base.Request["id"]));
         base.Response.Redirect("NewsList.aspx");
     }
 }