Пример #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
    public static List <NewsSortInfo> ReadList(string whereStr)
    {
        List <NewsSortInfo> list        = new List <NewsSortInfo>();
        Database            database    = new Database();
        DataView            defaultView = database.RunProc("select * from NewsSort " + whereStr).Tables[0].DefaultView;

        for (int i = 0; i < defaultView.Count; i++)
        {
            list.Add(NewsSortInfo.Read(int.Parse(defaultView[i]["id"].ToString())));
        }
        database.Dispose();
        return(list);
    }
Пример #3
0
    public static NewsSortInfo Read(int id)
    {
        NewsSortInfo    result          = null;
        Database        database        = new Database();
        MySqlDataReader mySqlDataReader = database.RunProcGetReader("select * from NewsSort where id=" + id);

        while (mySqlDataReader.Read())
        {
            result = new NewsSortInfo(int.Parse(mySqlDataReader.GetValue(0).ToString()), mySqlDataReader.GetValue(1).ToString(), int.Parse(mySqlDataReader.GetValue(2).ToString()));
        }
        mySqlDataReader.Close();
        database.Dispose();
        return(result);
    }