Ejemplo n.º 1
0
        private void GetBooksBought()
        {
            ELibraryDocumentBL docBL     = new ELibraryDocumentBL();
            UserDetails        userObj   = (UserDetails)Session["UserObj"];
            List <int>         docIDList = docBL.GetDocumentsBoughtBL(userObj.UserID);

            gvPurchased.DataSource = null;
            if (docIDList != null)
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("Title", typeof(string)));
                dt.Columns.Add(new DataColumn("Author", typeof(string)));
                dt.Columns.Add(new DataColumn("Description", typeof(string)));
                dt.Columns.Add(new DataColumn("Price", typeof(string)));

                foreach (int docId in docIDList)
                {
                    DocumentDetails doc = docBL.GetDocumentByID(docId);
                    DataRow         dr  = dt.NewRow();
                    dr["Title"]       = doc.Title;
                    dr["Author"]      = doc.Author;
                    dr["Description"] = doc.DocumentDescription;
                    dr["Price"]       = doc.Price;
                    dt.Rows.Add(dr);
                }
                gvPurchased.DataSource = dt;
                gvPurchased.DataBind();
            }
        }