Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key = Request.Params["key"];
            if (!string.IsNullOrEmpty(key))
            {

                db = new lafien_products_dbEntities();

                product = db.Products.Where(x => x.ProductID.ToUpper() == key.ToUpper()).FirstOrDefault();

                if (product == null)
                {
                    var tmp = db.ProductOwnerReferences.Where(x => x.RefProductID.ToUpper() == key.ToUpper()).FirstOrDefault();
                    if (tmp != null)
                    {
                        product = tmp.Product;
                        mess = key + " reference to " + product.ProductName;
                        noResult = false;
                    }
                }
                else
                {
                    noResult = false;
                }

                if (noResult == false)
                {
                    productCat = db.ProductCategories.Where(x => x.Active == true).ToList();
                }

            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key = Request.Params["key"];

            if (!string.IsNullOrEmpty(key))
            {
                db = new lafien_products_dbEntities();

                product = db.Products.Where(x => x.ProductID.ToUpper() == key.ToUpper()).FirstOrDefault();

                if (product == null)
                {
                    var tmp = db.ProductOwnerReferences.Where(x => x.RefProductID.ToUpper() == key.ToUpper()).FirstOrDefault();
                    if (tmp != null)
                    {
                        product  = tmp.Product;
                        mess     = key + " reference to " + product.ProductName;
                        noResult = false;
                    }
                }
                else
                {
                    noResult = false;
                }


                if (noResult == false)
                {
                    productCat = db.ProductCategories.Where(x => x.Active == true).ToList();
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new lafien_products_dbEntities();

            carCats = db.CarCategories.Where(x => x.CatLevel == 0).OrderBy(x => x.CatName).ToList();
            ddlBrand.DataSource = carCats;
            ddlBrand.DataTextField = "CatName";
            ddlBrand.DataValueField = "CatID";
            ddlBrand.DataBind();
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new lafien_products_dbEntities();

            carCats                 = db.CarCategories.Where(x => x.CatLevel == 0).OrderBy(x => x.CatName).ToList();
            ddlBrand.DataSource     = carCats;
            ddlBrand.DataTextField  = "CatName";
            ddlBrand.DataValueField = "CatID";
            ddlBrand.DataBind();
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key = Request.Params["key"];

            if (!string.IsNullOrEmpty(key))
            {
                db = new lafien_products_dbEntities();

                string[] tmps = key.Trim().Split('$');

                string[]   tmpClass = tmps[0].TrimEnd(";".ToCharArray()).Split(';');
                List <int> carCats  = new List <int>();
                for (int i = 0; i < tmpClass.Length; i++)
                {
                    int tmpValue = 0;
                    if (Int32.TryParse(tmpClass[i], out tmpValue))
                    {
                        carCats.Add(tmpValue);
                    }
                }


                string[]   tmpY     = tmps[1].TrimEnd(";".ToCharArray()).Split(';');
                List <int> carYears = new List <int>();
                for (int i = 0; i < tmpY.Length; i++)
                {
                    int tmpValue = 0;
                    if (Int32.TryParse(tmpY[i], out tmpValue))
                    {
                        carYears.Add(tmpValue);
                    }
                }


                string[] tmpEngine = tmps[2].TrimEnd(";".ToCharArray()).Split(';');



                string[] tmpBody = tmps[3].TrimEnd(";".ToCharArray()).Split(';');



                cars = db.Cars.Where(x => carCats.Contains(x.CarCatID) && ((x.FromDate.Year <= carYears.Max() && x.ToDate == null) || (x.ToDate.Year >= carYears.Min() && x.FromDate.Year <= carYears.Max()))).ToList();

                if (tmpEngine.Length > 0)
                {
                    if (!string.IsNullOrEmpty(tmpEngine[0]))
                    {
                        cars = cars.Where(x => tmpEngine.Contains(x.Engine)).ToList();
                    }
                }

                if (tmpBody.Length > 0)
                {
                    if (!string.IsNullOrEmpty(tmpBody[0]))
                    {
                        cars = cars.Where(x => tmpBody.Contains(x.Body)).ToList();
                    }
                }



                if (cars.Count == 0)
                {
                    noResult = true;
                }
                else
                {
                    noResult = false;
                }


                if (noResult == false)
                {
                    productCat = db.ProductCategories.Where(x => x.Active == true).ToList();
                }
            }
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key = Request.Params["key"];
            if (!string.IsNullOrEmpty(key))
            {

                db = new lafien_products_dbEntities();

                string[] tmps = key.Trim().Split('$');

                string[] tmpClass = tmps[0].TrimEnd(";".ToCharArray()).Split(';');
                List<int> carCats = new List<int>();
                for (int i = 0; i < tmpClass.Length; i++)
                {
                    int tmpValue = 0;
                    if (Int32.TryParse(tmpClass[i], out tmpValue))
                        carCats.Add(tmpValue);
                }

                string[] tmpY = tmps[1].TrimEnd(";".ToCharArray()).Split(';');
                List<int> carYears = new List<int>();
                for (int i = 0; i < tmpY.Length; i++)
                {
                    int tmpValue = 0;
                    if (Int32.TryParse(tmpY[i], out tmpValue))
                        carYears.Add(tmpValue);
                }

                string[] tmpEngine = tmps[2].TrimEnd(";".ToCharArray()).Split(';');

                string[] tmpBody = tmps[3].TrimEnd(";".ToCharArray()).Split(';');

                cars = db.Cars.Where(x => carCats.Contains(x.CarCatID) && ((x.FromDate.Year <= carYears.Max() && x.ToDate == null) || (x.ToDate.Year >= carYears.Min() && x.FromDate.Year <= carYears.Max()))).ToList();

                if (tmpEngine.Length > 0)
                    if (!string.IsNullOrEmpty(tmpEngine[0]))
                    {
                        cars = cars.Where(x => tmpEngine.Contains(x.Engine)).ToList();
                    }

                if (tmpBody.Length > 0)
                    if (!string.IsNullOrEmpty(tmpBody[0]))
                    {
                        cars = cars.Where(x => tmpBody.Contains(x.Body)).ToList();
                    }

                if (cars.Count == 0)
                {
                    noResult = true;
                }
                else
                {
                    noResult = false;
                }

                if (noResult == false)
                {
                    productCat = db.ProductCategories.Where(x => x.Active == true).ToList();
                }

            }
        }