protected void Shops_OnSelectedIndexChanged(object sender, EventArgs e) { ChangeShop.Visible = true; searchPanel.Visible = true; Products.Visible = true; shopSelectDiv.Visible = false; List <BLProduct> productsCart = (List <BLProduct>)Session["productsCart"]; bool toChangeShop = true; if (productsCart != null && productsCart.Count > 0) { //massage to delete all products in cart /* bool ToDelete= */ Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "Confirm()", true); string isConfirmString = isConfirm.Value; if (isConfirmString == "1") { Session["productsCart"] = null; toChangeShop = false; } isConfirm.Value = "0"; //DialogResult dialogResult = MessageBox.Show("Sure", "Some Title", MessageBoxButtons.YesNo); //if (dialogResult == DialogResult.Yes) //{ // //do something //} //else if (dialogResult == DialogResult.No) //{ // //do something else //} } if (toChangeShop) { int shopId = int.Parse(Shops.SelectedValue);//get shop id if (shopId == -1) { Products.ProductsCollections = BLProduct.GetAllProducts(""); } else { shopName.Text = BlShop.GetShopById(shopId).ShopName; //set data source List <BLProduct> products = BLProduct.GetAllProductsByShopId(shopId, ""); if (products != null && products.Count > 0) { Products.ProductsCollections = products; } else { Products.ProductsCollections = null; } } } }
protected void productOrder_OnSelectedIndexChanged(object sender, EventArgs e) { string stringOrderBy = productOrder.SelectedValue; //get stringOrderBy int orderBy = TurnOrderByToInt(stringOrderBy); //turn to int int shopId = int.Parse(Shops.SelectedValue); //get shop id string condition = BLProduct.setOrderBy(orderBy); //get condition by order by int List <BLProduct> products = null; if (shopId == -1) { //set data source if no shop selected products = BLProduct.GetAllProducts(condition); Products.ProductsCollections = products; } else { //set data source products = BLProduct.GetAllProductsByShopId(shopId, condition); Products.ProductsCollections = products; } }
protected void productOrder_OnSelectedIndexChanged(object sender, EventArgs e) { string stringOrderBy = productOrder.SelectedValue; //get stringOrderBy int orderBy = TurnOrderByToInt(stringOrderBy); //turn to int int shopId = ((BlShopManager)Session["user"]).ShopId; //get shop id string condition = BLProduct.setOrderBy(orderBy); //get condition by order by int List <BLProduct> products = null; if (shopId == -1) { //set data source if no shop selected products = BLProduct.GetAllProducts(condition); UpdateData(products); } else { //set data source products = BLProduct.GetAllProductsByShopId(shopId, condition); UpdateData(products); } }