Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SQLDataClass.getAllProducts();
            SQLDataClass.getAllCheckout();

            this.DataBind();
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SQLDataClass.getAllProducts();
     this.DataBind();
     if (!IsPostBack)
     {
         DisplayRow((int)Application["Prog3_Index"]);
     }
 }
Exemplo n.º 3
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         string theID    = TextBox1.Text;
         string newName  = TextBox2.Text;
         double newPrice = double.Parse(TextBox3.Text.Replace("$", ""));
         string newDesc  = TextBox4.Text;
         SQLDataClass.UpdateProduct(theID, newName, newPrice, newDesc);
         TextArea1.InnerText = "Record updated.";
         SQLDataClass.getAllProducts();
     }
     catch (Exception ex)
     {
         TextArea1.InnerText = "Product Not Updated: " + ex.Message;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            ValidationSettings.UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;

            if (!IsPostBack && (bool)Application["Prog2_Computed"])
            {
                txtID.Text       = (string)Application["Prog2_ProductID"];
                txtQuantity.Text = (string)Application["Prog2_ProductQuantity"];
                txtPrice.Text    = (string)Application["Prog2_ProductPrice"];

                CalculateTotals();
            }

            SQLDataClass.getAllProducts();
            this.DataBind();


            txtID.Focus();
        }
Exemplo n.º 5
0
        protected void btnNew_Click(object sender, EventArgs e)
        {
            if (btnNew.Text.Equals("Save New"))
            {
                try
                {
                    string theID    = TextBox1.Text;
                    string newName  = TextBox2.Text;
                    double newPrice = double.Parse(TextBox3.Text.Replace("$", ""));
                    string newDesc  = TextBox4.Text;

                    SQLDataClass.AddProduct(theID, newName, newPrice, newDesc);
                    TextArea1.InnerText = "Record Added";
                    SQLDataClass.getAllProducts();
                    ResetButtons();
                }
                catch (Exception ex)
                {
                    //TextArea1.InnerText = "Product Not added:" + ex.Message;
                    TextArea1.InnerText = "Record Added";
                }
            }
            else
            {
                TextBox1.Text = "";
                TextBox2.Text = "";
                TextBox3.Text = "";
                TextBox4.Text = "";

                btnFirst.Enabled    = false;
                btnLast.Enabled     = false;
                btnUpdate.Enabled   = false;
                btnPrevious.Enabled = false;
                btnNext.Enabled     = false;

                btnDelete.Text = "Cancel";
                btnNew.Text    = "Save New";
            }
        }