Esempio n. 1
0
        public JsonResult workshopreco(string zipCode, string selection)
        {
            List <ResultWorkshop> workshop = null;

            Workshop workShop = new Workshop();

            var b = (dynamic)null;

            try
            {
                workshop = workShop.loadWorkshopreco(Convert.ToInt32(zipCode), Convert.ToInt32(selection));

                b = new Framework.Libraies.ResulUserWorkShop {
                    workshop = workshop, zipcode = Convert.ToInt32(null), firstName = null, lastName = null, address = null, email = null, mobile = null
                };
                if (b != null)
                {
                    return(Json(new { error = false, noError = 0, b, JsonRequestBehavior.AllowGet }));
                }
                else
                {
                    return(Json(new { error = true, msg = "No workshops in the area" }));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 2
0
        public ActionResult Step2()

        {
            string path = Request.Url.AbsolutePath;

            ViewBag.ReturnUrl = path;

            List <ResulUserWorkShop> list     = null;
            List <ResultWorkshop>    workshop = null;

            Workshop workShop = new Workshop();

            var b = (dynamic)null;

            try
            {
                string idUser = System.Web.HttpContext.Current.Session["SessionUser"] as String;

                if (idUser == null || idUser == "")
                {
                    string codeZip = zip;

                    if (codeZip != null)
                    {
                        workshop = workShop.loadWorkshopAddress(Convert.ToInt32(codeZip));

                        b = new Framework.Libraies.ResulUserWorkShop {
                            workshop = workshop, zipcode = Convert.ToInt32(null), firstName = null, lastName = null, address = null, email = null, mobile = null
                        };
                    }
                    else
                    {
                        b = new Framework.Libraies.ResulUserWorkShop {
                            workshop = workshop, zipcode = Convert.ToInt32(null), firstName = null, lastName = null, address = null, email = null, mobile = null
                        };
                    }
                }
                else
                {
                    Users        users        = new Users();
                    ShoppingCart shoppingCart = new ShoppingCart();

                    //Actualizar la cookie por el idUser
                    var usercookie = Security.GetIdUser(this);
                    shoppingCart.UpdateShoppingCart(idUser, usercookie);

                    list = users.infoStep2(idUser);

                    if (list != null)
                    {
                        foreach (var item in list)
                        {
                            b = new Framework.Libraies.ResulUserWorkShop {
                                workshop = item.workshop, zipcode = item.zipcode, firstName = item.firstName, lastName = item.lastName, address = item.address, email = item.email, mobile = item.mobile
                            };
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(View(b));
        }