protected void Page_Load(object sender, EventArgs e)
        {
            using (var db = new bigshopeEntities())
            {
                var query = db.showBrands();
                DLBrnd.DataSource = query;
                DLBrnd.DataBind();

                var qury = db.showProcessor();
                DLProc.DataSource = qury;
                DLProc.DataBind();

                var qry = db.showGen();
                DLGen.DataSource = qry;
                DLGen.DataBind();
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (Request.QueryString["brnd_id"] != null)
            {
                using (var db = new bigshopeEntities())
                {
                    int brnd_id = Convert.ToInt32(Request.QueryString["brnd_id"]);
                    var qryBrnd = db.showProdByBrnds(brnd_id);
                    RP.DataSource = qryBrnd;
                    RP.DataBind();
                }
            }

            else if (Request.QueryString["proc_id"] != null)
            {
                using (var db = new bigshopeEntities())
                {
                    int proc_id = Convert.ToInt32(Request.QueryString["proc_id"]);
                    var qryProc = db.showProdByProc(proc_id);
                    RP.DataSource = qryProc;
                    RP.DataBind();
                }
            }

            else if (Request.QueryString["gen_id"] != null)
            {
                using (var db = new bigshopeEntities())
                {
                    int gen_id = Convert.ToInt32(Request.QueryString["gen_id"]);
                    var qryGen = db.showProdByProc(gen_id);
                    RP.DataSource = qryGen;
                    RP.DataBind();
                }
            }

            else if (Request.QueryString["search"] != null)
            {
                using (var db = new bigshopeEntities())
                {
                    var qrySrch = db.searchProducts(Request.QueryString["search"].ToString());
                    RP.DataSource = qrySrch;
                    RP.DataBind();
                }
            }

            else
            {
                using (var db = new bigshopeEntities())
                {
                    var query = db.showProducts();
                    RP.DataSource = query;
                    RP.DataBind();

                    var queryBrnd = db.showBrands();
                    DLBrnd.DataSource = queryBrnd;
                    DLBrnd.DataBind();

                    var quryProc = db.showProcessor();
                    DLProc.DataSource = quryProc;
                    DLProc.DataBind();

                    var qryGen = db.showGen();
                    DLGen.DataSource = qryGen;
                    DLGen.DataBind();
                }
            }
        }