예제 #1
0
        static void Main(string[] args)
        {
            Framework.Users        user     = new Framework.Users();
            Framework.Articles     articles = new Framework.Articles();
            Framework.Workshop     work     = new Framework.Workshop();
            Framework.Orders       orders   = new Framework.Orders();
            Framework.ShoppingCart shoppin  = new Framework.ShoppingCart();


            //Console.WriteLine(shoppin.LoadPointsPerUser("3f619083-b218-41e8-8693-1a93ecd82fdff"));
            //List<Framework.Libraies.ResultPurchaseOrder> product = null;
            ////product = orders.loadOrderPast("3f619083-b218-41e8-8693-1a93ecd82fdf");

            //foreach (var item in product)
            //{
            //    Console.WriteLine("ProductImage: " + item.ProductImage);
            //    Console.WriteLine("IdOrderDetail: " + item.IdOrderDetail);
            //    Console.WriteLine("ProductName: " + item.ProductName);
            //    Console.WriteLine("Price: " + item.Price);
            //    Console.WriteLine("Quantity: " + item.Quantity);
            //    Console.WriteLine("DeliveredDate: " + item.DeliveredDate);
            //    Console.WriteLine("TotalPrice1: " + item.TotalPrice1 + "\n");
            //}
            Uri uriAddress1 = new Uri("C:/Productos/DekkOnline20022018/DekkOnlineMVC/Content/Uploads/Photo/0d3410419f314dbeb0ff579bd4fdd59d.png");

            Console.WriteLine("The parts are {0}, {1}, {2}", uriAddress1.Segments[0], uriAddress1.Segments[1], uriAddress1.Segments[4]);
            Console.ReadLine();
        }
예제 #2
0
        public async Task <ActionResult> _LoginForm(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var usr = db.AspNetUsers.Where(s => s.Email == model.usuEmail).FirstOrDefault();

            if (usr == null)
            {
                ModelState.AddModelError(constClass.error, "El usuario o la contraseña son incorrectas.");
                return(PartialView("Account/_LoginForm", model));
            }
            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            try
            {
                var result = await SignInManager.PasswordSignInAsync(model.usuEmail, model.usuPassword, model.RememberMe, shouldLockout : false);

                switch (result)
                {
                case SignInStatus.Success:
                    Users user = new Users();
                    Framework.ShoppingCart shoppingCart = new Framework.ShoppingCart();
                    string isUser = user.IdUser(model.usuEmail);
                    System.Web.HttpContext.Current.Session["SessionUser"] = isUser;
                    var usercookie = Security.GetIdUser(this);
                    if (usercookie != null || usercookie != "" || usercookie.Length < 1)
                    {
                        bool updateCookieDelevery = shoppingCart.updateDeleveryType(isUser, usercookie);
                    }
                    if (returnUrl != "")
                    {
                        model.scriptJS = "document.location.replace('" + returnUrl + "');";
                    }
                    else
                    {
                        model.scriptJS = "document.location.replace('" + Url.Action("Index", "Home") + "');";
                    }
                    return(PartialView("Account/_LoginForm", model));

                //return RedirectToLocal(returnUrl);
                case SignInStatus.LockedOut:
                    return(View("Lockout"));

                case SignInStatus.RequiresVerification:
                    return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

                case SignInStatus.Failure:
                default:
                    ModelState.AddModelError(constClass.error, "El usuario o la contraseña son incorrectas.");
                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }