protected void Page_Load(object sender, EventArgs e)
        {
            InventoryLogic i = new InventoryLogic();

            if (!IsPostBack)
            {
//-------loading the dropdown list with catagoryName--------------------------------------------------------------------//

                cList = InventoryLogic.GetCatalogue();
                CatalogueCategory cat = new CatalogueCategory();
                cat.CatalogueName = "All";
                cat.CategoryID    = "All";
                cList.Add(cat);

                DdlCatagory.DataTextField  = "CatalogueName";
                DdlCatagory.DataValueField = "CatalogueName";

                DdlCatagory.DataSource = cList;
                DdlCatagory.DataBind();
                ControlVisibleFalse();

//-----------------Loads all inventory items when the page loads for the first time------------------------------------//
                GridBind();
                DdlCatagory.SelectedValue = "All";
            }
        }
//---------------------------------------search button click event.---------------------------------------------------//
        protected void Btnsearch_Click(object sender, EventArgs e)
        {
//----------retrieve all the items under the selected category from the inventory list------Category<=>All-------------//
            TxtSearch.Text = string.Empty;
            if (DdlCatagory.SelectedValue != "All" && DdlUIS.SelectedValue == "0")
            {
                iList           = InventoryLogic.GetInventoryByCatagory(DdlCatagory.SelectedItem.Text);
                Session["list"] = iList;
                ControlVisibleTrue();

                LblReorderQtyD.Text = Convert.ToString(iList[0].ReorderQty);
                LblReorderD.Text    = Convert.ToString(iList[0].ReorderLevel);

                LblIdD.Text      = iList[0].CategoryID;
                LblCatNameD.Text = InventoryLogic.GetCatalogue(DdlCatagory.SelectedItem.Text).CatalogueName;

                DatagridBind(iList);

                LblMsg.Text = "*Showing result for category" + " " + DdlCatagory.SelectedItem.Text;
            }
//-----filter the inventory list based on  selected category and stock level---Category<=>stockSeleted------------------//
            else if (DdlCatagory.SelectedValue != "All" && DdlUIS.SelectedValue != "0" && DdlUIS.SelectedValue != "1")
            {
                string category = DdlCatagory.SelectedItem.Text;

                int uis = Convert.ToInt32(DdlUIS.SelectedValue);
                iList           = InventoryLogic.GetInventoryByCategoryNQuantity(category, uis);
                Session["list"] = iList;

                DatagridBind(iList);

                LblMsg.Text = "*Showing result for category" + " " + DdlCatagory.SelectedItem.Text + " " + " ," + "stock qunatity" + " " + DdlUIS.SelectedItem.Text;
            }
            //----------------------based on category and selected stock level-----Category<=>ReorderLevel------------------------//
            else if (DdlCatagory.SelectedValue != "All" && DdlUIS.SelectedValue == "1")
            {
                string category = DdlCatagory.SelectedItem.Text;
                iList           = InventoryLogic.GetInventoryByCategorybelowReorder(category);
                Session["list"] = iList;
                DatagridBind(iList);

                LblMsg.Text = "*Showing result for category" + " " + DdlCatagory.SelectedItem.Text + " " + ",stock less than reorder level";
            }
//-------------------all inventory  items below the selected stock level------All<=>ReorderLevel-----------------------//
            else if (DdlCatagory.SelectedValue == "All" && DdlUIS.SelectedValue == "1")
            {
                string category = DdlCatagory.SelectedItem.Text;
                iList           = InventoryLogic.GetAllInventorybelowReorder();
                Session["list"] = iList;
                DatagridBind(iList);

                LblMsg.Text = "*Showing result for inventory items" + " " + ",stock less than" + DdlUIS.SelectedValue;
            }
//---------get all the inventory items(All<=>All combination)----------------------------------------------------------//
            else if (DdlCatagory.SelectedValue == "All" && DdlUIS.SelectedValue == "0")
            {
                GridBind();
                LblMsg.Text = "*Showing result for All inventory items";
            }
//-----Get inventory items below the selected stock level--------All<=>StockSelected------------------------------------//
            else if (DdlCatagory.SelectedValue == "All" && DdlUIS.SelectedValue != "0" && DdlUIS.SelectedValue != "1")
            {
                int stock = Convert.ToInt32(DdlUIS.SelectedValue);
                iList           = InventoryLogic.GetAllInventorybelowStock(stock);
                Session["list"] = iList;
                DatagridBind(iList);

                LblMsg.Text = "*Showing result for All inventory items,stock less than" + " " + DdlUIS.SelectedValue;
            }
        }