示例#1
0
        /// <summary>
        /// 根据参数bookID,获取图书详细信息
        /// </summary>
        /// <param name="topicID">图书ID</param>
        public void LoadData(int bookID)
        {
            Database db = new Database();                       //实例化一个Database类

            string sql = "";

            sql = "Select * from [Book] where BookID = " + bookID;

            DataRow dr = db.GetDataRow(sql);            //利用Database类的GetDataRow方法查询用户数据

            //根据查询得到的数据,对成员赋值
            if (dr != null)
            {
                this._bookId      = GetSafeData.ValidateDataRow_N(dr, "BookID");
                this._bookName    = GetSafeData.ValidateDataRow_S(dr, "BookName");
                this._categoryId  = GetSafeData.ValidateDataRow_N(dr, "CategoryId");
                this._price       = GetSafeData.ValidateDataRow_F(dr, "Price");
                this._publisher   = GetSafeData.ValidateDataRow_S(dr, "Publisher");
                this._publishDate = GetSafeData.ValidateDataRow_T(dr, "PublishDate");
                this._author      = GetSafeData.ValidateDataRow_S(dr, "Author");
                this._pageNum     = GetSafeData.ValidateDataRow_N(dr, "PageNum");
                this._pictureUrl  = GetSafeData.ValidateDataRow_S(dr, "PictureUrl");
                this._description = GetSafeData.ValidateDataRow_S(dr, "Description");
                this._saleCount   = GetSafeData.ValidateDataRow_N(dr, "SaleCount");

                this._exist = true;
            }
            else
            {
                this._exist = false;
            }
        }
    /// <summary>
    /// 查询
    /// </summary>
    /// <param name="logSource">日志来源</param>
    /// <param name="day">日期</param>
    private void Query(string logSource, DateTime day)
    {
        MyEventsLog log   = new MyEventsLog(logSource);
        DataTable   dtAll = log.ReadLog();

        DataTable dtQueryDay = new DataTable();

        dtQueryDay = dtAll.Clone();
        foreach (DataRow row in dtAll.Rows)
        {
            if (GetSafeData.ValidateDataRow_T(row, "TimeGenerated").Date == day.Date)
            {
                dtQueryDay.ImportRow(row);
            }
        }

        GV.DataSource = dtQueryDay;
        GV.DataBind();
        labelPage.Text = "查询结果(第" + (GV.PageIndex + 1).ToString() + "页 共" + GV.PageCount.ToString() + "页)";

        ViewState.Add("selRzlx", selRzlx.Value);
        ViewState.Add("selDate", selDate.SelectedValue);
    }
示例#3
0
        public void Docload(int docID)  //加载稿件信息
        {
            string   sql = "select * from document where docID=" + SQLString.GetQuotedString(Convert.ToString(docID));
            Database db  = new Database();
            DataRow  dr  = db.GetDataRow(sql);

            if (dr != null)
            {
                this._docID         = GetSafeData.ValidateDataRow_N(dr, "docID");
                this._docTime       = GetSafeData.ValidateDataRow_T(dr, "docTime");
                this._docTitle      = GetSafeData.ValidateDataRow_S(dr, "docTitle");
                this._docTitleEn    = GetSafeData.ValidateDataRow_S(dr, "docTitleEn");
                this._docAbstract   = GetSafeData.ValidateDataRow_S(dr, "docAbstract");
                this._docAbstractEn = GetSafeData.ValidateDataRow_S(dr, "docAbstractEn");
                this._docKeywords   = GetSafeData.ValidateDataRow_S(dr, "docKeywords");
                this._docKeywordsEn = GetSafeData.ValidateDataRow_S(dr, "docKeywordsEn");
                this._docLetters    = GetSafeData.ValidateDataRow_N(dr, "docLetters");
                this._docAuthor     = GetSafeData.ValidateDataRow_S(dr, "docAuthor");
                this._docColumnID   = GetSafeData.ValidateDataRow_S(dr, "docColumnID");
                this._authorID      = GetSafeData.ValidateDataRow_S(dr, "authorID");
                this._docState      = GetSafeData.ValidateDataRow_S(dr, "docState");
                this._docReason     = GetSafeData.ValidateDataRow_S(dr, "docReason");
            }
        }