Exemplo n.º 1
0
        public ActionResult Quote(CurvedDoorQuoteModel model)
        {
            var curvedDoor = new CurvedDoor();

            curvedDoor.Color           = DbSession.Get <ColorLocal>(model.ColorId);
            curvedDoor.GlassSystem     = DbSession.Get <GlassSystemLocal>(model.GlassId);
            curvedDoor.CurvedDoorModel = DbSession.Get <CurvedDoorModelLocal>(model.TypeId);

            if (curvedDoor.Color == null || curvedDoor.GlassSystem == null || curvedDoor.CurvedDoorModel == null)
            {
                return(RedirectToAction("quote"));
            }

            curvedDoor.Length = model.Length ?? 0;
            curvedDoor.Height = model.Height ?? 0;
            curvedDoor.Width  = model.Width ?? 0;
            curvedDoor.Depth  = model.Depth ?? 0;

            Session[SessionKeys.LAST_QUOTE] = new CurvedDoorQuoteModel(curvedDoor);

            var line = new QuoteLine();

            line.Name        = curvedDoor.Name;
            line.Price       = curvedDoor.SilverSellingPrice;
            line.BronzePrice = curvedDoor.BronzeSellingPrice;
            line.GoldPrice   = curvedDoor.GoldSellingPrice;

            line.ProductDetails = curvedDoor;
            Session[SessionKeys.PENDING_QUOTE_LINE] = line;
            return(RedirectToAction("create-quote", "customer", new { areas = AreaKind }));
        }
Exemplo n.º 2
0
        public ActionResult Quote(string id)
        {
            if (String.IsNullOrWhiteSpace(id))
            {
                var page = DbSession.Get <StandardPage>(new Guid("5e518d44-d714-46c3-a1fb-a2e700d785e7"));
                ViewBag.Body = page.Body;
                ViewBag.Name = page.Name;
                PageHeader   = page;
                return(View(DbSession.QueryOver <CurvedDoorModelLocal>()
                            .Where(m => m.CurvedDoorSystem.ID == DEFAULT_SYSTEM_ID)
                            .OrderBy(m => m.SType1)
                            .Asc
                            .Cacheable()
                            .CacheMode(CacheMode.Normal)
                            .List()));
            }


            CurvedDoorQuoteModel viewModel;

            var fromSession = HttpContext.GetSessionValue <CurvedDoorQuoteModel>(SessionKeys.LAST_QUOTE);

            if (fromSession != null && String.Equals(fromSession.CurvedDoorModelShortName, id.Trim(), StringComparison.OrdinalIgnoreCase))
            {
                viewModel = fromSession;
            }
            else
            {
                var model = DbSession.QueryOver <CurvedDoorModelLocal>()
                            .Where(m => m.CurvedDoorSystem.ID == DEFAULT_SYSTEM_ID && m.ShortName_En == id)
                            .Cacheable()
                            .CacheMode(CacheMode.Normal)
                            .SingleOrDefault();

                if (model == null)
                {
                    return(HttpNotFound());
                }

                viewModel = new CurvedDoorQuoteModel(model);
            }

            PageHeader = viewModel;

            return(View("Model", viewModel));
        }
Exemplo n.º 3
0
        public ActionResult AmendQuote(Guid?id)
        {
            Quote quote;

            if (!id.HasValue ||
                (quote = DbSession.Get <Quote>(id.Value)) == null ||
                quote.FirstLine == null)
            {
                return(HttpNotFound());
            }
            var cpd = quote.FirstLine.ProductDetails as CurvedDoor;

            if (cpd == null || cpd.CurvedDoorModel == null)
            {
                return(HttpNotFound());
            }
            var viewmodel = new CurvedDoorQuoteModel(cpd);

            return(View("Model", viewmodel));
        }