Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <ClassBook> books = DataUtilityClass.SelectAllBooks();

            BuildHTMLTable(books);
            BuildBooksDropDown(books);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int       id;
            ClassBook book;

            if (int.TryParse(Request.QueryString["bookid"], out id))
            {
                book = DataUtilityClass.SelectBookByID(id);
                if (book != null)
                {
                    TBCategory.Text    = book.Category;
                    TBPrice.Text       = "$ " + book.Price.ToString();
                    TBPublishDate.Text = book.PublishDate;
                    TBSaleDate.Text    = book.SaleDate;
                    TBTitle.Text       = book.Title;
                }
                else
                {
                    Response.Redirect("displayall.aspx");
                }
            }
            else
            {
                Response.Redirect("displayall.aspx");
            }
        }
Esempio n. 3
0
 protected void BtnSave_Click(object sender, EventArgs e)
 {
     if (ValidateFields())
     {
         //String saleDate = "";
         //var d = CalSaleDate.SelectedDate;
         String saleDate = Convert.ToDateTime(CalSaleDate.SelectedDate).ToString("MM/dd/yyyy");
         DataUtilityClass.InsertBook(new ClassBook(TBTitle.Text, TBPublishDate.Text, Convert.ToDecimal(TBPrice.Text), saleDate, DDCategory.SelectedItem.ToString()));
         Response.Redirect("displayall.aspx");
     }
 }