protected ActionResult ProductBase(ProductLookupModel model, string id)
        {
            if (id != null)
            {
                var prodQry = from p in PrdnDBContext.Products
                              where p.ProdCD == id
                              select p;

                if (!String.IsNullOrWhiteSpace(model.ProdTypeCD))
                {
                    prodQry = from p in prodQry
                              where p.ProdTypeCD == model.ProdTypeCD
                              select p;
                }

                var prod = (from p in prodQry
                            select new {
                                p.ProdCD,
                                p.ProdTypeCD
                            }).FirstOrDefault();

                if (prod != null) {
                    model.ProdCD = prod.ProdCD;
                    model.ProdTypeCD = prod.ProdTypeCD;
                }
            }

            if (String.IsNullOrWhiteSpace(model.ProdTypeCD))
            {
                model.ProdTypeCD = PrdnDataHelper.LeatherProdTypeCd;
            }

            return View(model);
        }
Esempio n. 2
0
 public ActionResult Product(string id)
 {
     ProductLookupModel model = new ProductLookupModel
     {
         ProdTypeList = GetProdTypeList()
     };
     return ProductBase(model, id);
 }
        protected ProductLookupModel ProductSubViews(string prodCD, string parentProdCD, IProductCostViewModel product = null)
        {
            List<ProdOptDefn> prodOptions = ProdOptDefn.ProdOptions(prodCD, parentProdCD);
            List<ProdImageInfo> prodImageInfoSet = IsisDbContext.ProdImageInfoSet(prodCD);

            ProductLookupModel model = new ProductLookupModel
            {
                OptsPartial = RenderPartialView("CharCompOpts", prodOptions),
                ImgSetPartial = RenderPartialView("ProdImageInfoSet", prodImageInfoSet)
            };

            if (product != null)
            {
                model.ProdTypeCD = product.ProdTypeCD;
                model.ProdTypeDescr = product.ProdTypeDescr;
                model.ProdCD = product.ProdCD;
                model.ProdDescr = product.ProdDescr;
                model.ParentProdCD = product.ParentProdCD;
                model.Cost = product.Cost;
            }

            return model;
        }