Exemplo n.º 1
0
        //ajax calls this function which will return json object
        public JsonResult GetProducts(string Department_Name
                                      , string Cost
                                      , string xFor
                                      , string Department_ID
                                      , string Description
                                      , string Last_Sold
                                      , string Price
                                      , string Product_ID
                                      , string Shelf_Life
                                      , string Unit
                                      )
        {
            productModel myproducts = new productModel();

            myproducts.Department_Name = Department_Name;
            myproducts.Cost            = Cost;
            myproducts.Department_ID   = Department_ID;
            myproducts.Description     = Description;
            myproducts.Last_Sold       = Last_Sold;
            myproducts.Price           = Price;
            myproducts.Product_ID      = Product_ID;
            myproducts.Shelf_Life      = Shelf_Life;
            myproducts.Unit            = Unit;
            myproducts.xFor            = xFor;

            productList resultData = products.getProducts(myproducts);

            return(Json(new { result = resultData }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult clearFilter()
        {
            int               subID    = listEngine.getSubcategoryID();
            productList       newPD    = new productList(new unitOfWork(new KEY_TeamMVCEntities()));
            List <tblProduct> displays = newPD.getUOW().getProductRepo().Find(e => e.ProductSubCategoryID == subID).ToList();

            newPD.setDisplayList(displays);
            newPD.setSubcategoryID(subID);
            TempData["outputList"] = newPD;
            return(RedirectToAction("list", "Product"));
        }
Exemplo n.º 3
0
 public ActionResult list()
 {
     listEngine = TempData["outputList"] as productList;
     if (listEngine.getSubcategoryID() != 0)
     {
         listEngine.setPropertyList(listEngine.getSubcategoryID());
         listEngine.setSubcategoryName();
         productList = listEngine.getProductsList();
     }
     return(View(listEngine));
 }
Exemplo n.º 4
0
        public ActionResult filter(FormCollection fc)
        {
            productList newPD = new productList(new unitOfWork(new KEY_TeamMVCEntities()));

            newPD.setSubcategoryID(listEngine.getSubcategoryID());
            int    startYear;
            string syear = fc.GetValue("startYear").AttemptedValue;

            if (fc.GetValue("startYear").AttemptedValue != "" && Convert.ToInt32(fc.GetValue("startYear").AttemptedValue) != 0)
            {
                startYear = Convert.ToInt32(fc.GetValue("startYear").AttemptedValue);
            }
            else
            {
                startYear = 0;
            }
            int endYear;// = Convert.ToInt32(fc.GetValue("endYear").AttemptedValue);

            if (fc.GetValue("endYear").AttemptedValue != "" && Convert.ToInt32(fc.GetValue("endYear").AttemptedValue) != 0)
            {
                endYear = Convert.ToInt32(fc.GetValue("endYear").AttemptedValue);
            }
            else
            {
                endYear = 0;
            }
            List <string> propertyList = listEngine.getFilterProperties();

            if (startYear != 0 && endYear != 0 && endYear >= startYear)
            {
                newPD.tsfilter.Add("ModelYear", new int[] { startYear, endYear });
            }
            for (int i = 1; i <= propertyList.Count; i++)
            {
                newPD.tsfilter.Add(propertyList[i - 1], new int[] { Convert.ToInt32(fc.GetValue("minAmount_" + i.ToString()).AttemptedValue), Convert.ToInt32(fc.GetValue("maxAmount_" + i.ToString()).AttemptedValue) });
            }
            newPD.setDisplayList(newPD.getProductsByFilter(newPD.getSubcategoryID(), (Dictionary <string, int[]>)newPD.tsfilter));
            TempData["outputList"] = newPD;
            return(RedirectToAction("list", "Product"));
        }
Exemplo n.º 5
0
 id = _ordersDb.AddOrder(new Order(productList, customer));