// IMAGE URL UPLOAD TO DB protected void btnSubmit_Click(object sender, EventArgs e) { //itemcat = CategoryList.SelectedValue.ToString(); itemcat = CategoryList.SelectedItem.Text; itemname = iNameBox.Text; itemqty = qtyList.SelectedValue.ToString(); itempprice = pPriceBox.Text; itemrprice = rPriceBox.Text; itemnote = notebox.Text; itemimg = imgurl.Text; CsItem nitem = new CsItem(itemnum, itemcat, itemname, itempprice, itemrprice, itemnote, itemimg, itemqty,itemdate); try { ConnectionClass.RegisterItem(nitem); ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('New Item Registered!');</script>"); ClearTextBoxes(Page); CategoryList.ClearSelection(); testimg.ImageUrl = ""; } catch { ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('Error!');</script>"); } }
protected void SearchButton_Click(object sender, EventArgs e) { string id = IDText.Text; SqlConnection con = new SqlConnection("Server=tcp:ljagervidb.database.windows.net,1433;Initial Catalog=group11projectDB;Persist Security Info=False;User ID=rootroot;Password=Root1234;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"); con.Open(); SqlCommand cmd = new SqlCommand(@"SELECT * FROM Product WHERE productID=@ID and isDeleted=0", con); cmd.Parameters.Add(new SqlParameter("ID", id)); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { IDLabel.Text = reader[0].ToString(); NameText.Text = reader[1].ToString(); CategoryList.ClearSelection(); CategoryList.Items.FindByValue(reader[2].ToString()).Selected = true; ImageText.Text = reader[3].ToString(); DescriptionText.Text = reader[4].ToString(); PriceText.Text = reader[5].ToString(); } } else { MessageLabel.Text = "Product does not exist"; IDLabel.Text = ""; } }
protected void DeleteButton_Click(object sender, EventArgs e) { string id = IDLabel.Text; if (id.Equals("")) { MessageLabel.Text = "Please use Search button first"; } else { SqlConnection con = new SqlConnection("Server=tcp:ljagervidb.database.windows.net,1433;Initial Catalog=group11projectDB;Persist Security Info=False;User ID=rootroot;Password=Root1234;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"); con.Open(); SqlCommand cmd = new SqlCommand(@"UPDATE Product SET isDeleted=1 WHERE productID=@ID AND isDeleted=0", con); cmd.Parameters.Add(new SqlParameter("ID", id)); cmd.ExecuteNonQuery(); con.Close(); IDLabel.Text = ""; NameText.Text = ""; CategoryList.ClearSelection(); CategoryList.Items.FindByValue("-Select-").Selected = true; ImageText.Text = ""; DescriptionText.Text = ""; PriceText.Text = ""; MessageLabel.Text = "Successfully removed Product from the Shop"; } }
protected void Clear_Click(object sender, EventArgs e) { CategoryList.ClearSelection(); SupplierList.ClearSelection(); ProductList.ClearSelection(); Message.DataSource = null; Message.DataBind(); }
protected void Clear(object sender, EventArgs e) { ID.Text = ""; Name.Text = ""; UnitPrice.Text = ""; Discontinued.Checked = false; CategoryList.ClearSelection(); SupplierList.ClearSelection(); }
protected void Clear_Click(object sender, EventArgs e) { ID.Text = ""; FirstName.Text = ""; LastName.Text = ""; Age.Text = ""; Gender.Text = ""; AlbertaHealthCareNumber.Text = ""; MedicalAlertDetails.Text = ""; CategoryList.ClearSelection(); SupplierList.ClearSelection(); }
protected void Clear(object sender, EventArgs e) { ID.Text = ""; Name.Text = ""; QuantityPerUnit.Text = ""; UnitPrice.Text = ""; UnitsInStock.Text = ""; UnitsOnOrder.Text = ""; ReorderLevel.Text = ""; Discontinued.Checked = false; CategoryList.ClearSelection(); SupplierList.ClearSelection(); }
protected void Clear_Click(object sender, EventArgs e) { ProductID.Text = ""; ProductName.Text = ""; QuantityPerUnit.Text = ""; UnitPrice.Text = ""; UnitsInStock.Text = ""; UnitsOnOrder.Text = ""; ReorderLevel.Text = ""; Discontinued.Checked = false; SupplierList.ClearSelection(); CategoryList.ClearSelection(); //optionally ProductList.ClearSelection(); }
//-----------------------------------------METHODS------------------------------------------------------------------ //----------------------------------DATA GRID--------------------------------------------------------------------- public void refreshCategories() { this.CategoryList.Rows.Clear(); List <object>[] rs; string[] columns = { "strCategCode", "strCategName" }; rs = dbConnect.Select("Select * from tblCategory where boolCategIsDel = false;", columns); for (int i = 0; i < rs[0].Count; i++) { this.CategoryList.Rows.Add(rs[0].ElementAt(i).ToString(), rs[1].ElementAt(i).ToString()); } //clear selection CategoryList.ClearSelection(); }
protected void Clear_Click(object sender, EventArgs e) { CategoryList.ClearSelection(); CategoryProductList.DataSource = null; CategoryProductList.DataBind(); }
protected void Clear_Click(object sender, EventArgs e) { CategoryList.ClearSelection(); }