Ejemplo n.º 1
0
 public JsonResult GetNextColorNumber(int colorID)
 {
     try
     {
         return(Json(PolishModel.getNextColorNumber(colorID)));
     }
     catch (Exception ex)
     {
         return(Json(ex.Message));
     }
 }
Ejemplo n.º 2
0
 public ActionResult Details(PolishModel polish)
 {
     using (var db = new PolishWarehouseEntities())
     {
         try
         {
             polish.Save();
             TempData["Messages"] = "Polish Saved!";
         }
         catch (Exception ex)
         {
             TempData["Errors"] = "Error: " + ex.Message;
         }
         return(RedirectToAction("Details"));
     }
 }
Ejemplo n.º 3
0
        public ActionResult Details(int?id)
        {
            ViewBag.PrimaryColors   = PolishModel.getPrimaryColors().OrderBy(c => c.Name);
            ViewBag.SecondaryColors = PolishModel.getSecondaryColors().OrderBy(c => c.Name);
            ViewBag.GlitterColors   = PolishModel.getGlitterColors().OrderBy(c => c.Name);
            ViewBag.Brands          = PolishModel.getBrands().OrderBy(c => c.Name);
            ViewBag.PolishTypes     = PolishModel.getPolishTypes().OrderBy(c => c.Name);

            if (id.HasValue)
            {
                return(View(new PolishModel(id.Value)));
            }
            else
            {
                return(View(new PolishModel()));
            }
        }
Ejemplo n.º 4
0
        public ActionResult UploadFile(HttpPostedFileBase file)
        {
            if (file.ContentLength > 0)
            {
                try
                {
                    //Do stuff with the file
                    PolishModel.processCSV(file);
                }
                catch (Exception ex)
                {
                    TempData["Errors"] = "Error: " + ex.Message;
                    return(RedirectToAction("Import"));
                }
            }

            TempData["Messages"] = "File Uploaded!";
            return(RedirectToAction("Import"));
        }
Ejemplo n.º 5
0
        public JsonResult GetPolishQuickInfo(string colorName)
        {
            try
            {
                using (var db = new PolishWarehouseEntities())
                {
                    var c = db.Colors.Where(b => b.Name == colorName).SingleOrDefault();
                    if (c == null)
                    {
                        throw new Exception("Color Doesn't exist!");
                    }

                    return(Json(new { id = c.ID, number = PolishModel.getNextColorNumber(c.ID) }));
                }
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
        }
Ejemplo n.º 6
0
        public JsonResult DetailsAsync(int id)
        {
            var model = new PolishModel(id, false);

            return(Json(model));
        }
Ejemplo n.º 7
0
 public ActionResult Public()
 {
     ViewBag.PolishTypes = PolishModel.getPolishTypes().OrderBy(c => c.Name);
     return(Index());
 }