Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string val = Request.QueryString["ISBN"];
            if (val != null)
            {
                bookItem = new Book();
                bbl      = new BookBusinesslogic();
                bl       = new BusinessLogic();

                bookItem = bbl.GetBookDetails(val);

                txtISBN.Text = val;

                Image2.Width    = 150;
                Image2.Height   = 150;
                Image2.ImageUrl = "images/" + val + ".jpg";

                List <string> cat = bl.GetCategoryList();
                for (int i = 0; i < cat.Count; i++)
                {
                    ddlistCat.Items.Add(cat[i]);
                }
                string catName = bbl.GetCategory(bookItem.CategoryID).CategoryName.ToString();
                ddlistCat.ClearSelection();
                ddlistCat.SelectedValue = catName;

                txtTitle.Text   = bookItem.Title;
                txtAuthor.Text  = bookItem.Author;
                txtPrice.Text   = bookItem.Price.ToString();
                bookStock.Value = bookItem.Stock.ToString();
            }
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int key = Convert.ToInt32(Request.QueryString[0].ToString());

        bl = new BusinessLogic();
        bookBusinessLogic = new BookBusinesslogic();
        List <Book> lstBook;

        lstBook = bl.GetBooksByCategoryID(key);
        Category cat = bookBusinessLogic.GetCategory(key);

        Label1.Text = cat.CategoryName;
        try
        {
            if (Session["userType"] == null || Session["userType"].Equals("Customer"))
            {
                bl.imageAssignForCustomer(lstBook, PlaceHolder1);
            }
            else if (Session["userType"].Equals("Admin"))
            {
                bl.imageAssign(lstBook, PlaceHolder1);
            }
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(Page.GetType(),
                                               "MessageBox",
                                               "<script language='javascript'>alert('" + ex.Message + "');</script>");
        }
    }