Ejemplo n.º 1
0
        public async Task <ActionResult> AddToShopBasketFromWishes(int id, string category)
        {
            AppUser currUser = await UserManager.FindByNameAsync(User.Identity.Name);

            HttpCookie cookie = Request.Cookies["ShoppingBasket"];

            if (cookie != null && !CatalogHelpers.IsGoodAlreadyInBasket(cookie["ShoppingBasket"], new Good()
            {
                ID = id, Category = category
            }))
            {
                currUser.GoodsWishes    = currUser.GoodsWishes.Replace($"+{id},{category}+", "");
                currUser.GoodsInBasket += string.Format($"+{id},{category}+");
                await UserManager.UpdateAsync(currUser);

                cookie["ShoppingBasket"] = currUser.GoodsInBasket;
                Response.Cookies.Add(cookie);

                cookie = Request.Cookies["WishesAmount"];
                if (cookie != null)
                {
                    cookie["WishesAmount"] = (currUser.GoodsWishes.Where(c => c == '+').Count() / 2).ToString();
                    Response.Cookies.Add(cookie);
                }

                return(RedirectToActionPermanent("Wishes"));
            }
            else
            {
                return(RedirectToActionPermanent("Wishes"));
            }
        }
Ejemplo n.º 2
0
 public override void Close()
 {
     if ((Transaction != null) && !Transaction.GetWrappedProperty <bool>("HasAlreadyBeenCommittedOrRolledBack") && (Transaction.Connection == null))
     {
         Transaction.SetWrappedField("_connection", WrappedConnection);
     }
     _catalogHelpers = null;
     WrappedConnection.Close();
 }
Ejemplo n.º 3
0
 public override void Open()
 {
     _catalogHelpers = null;
     WrappedConnection.Open();
     ExecSql("SET LOCKMODE session WHERE readlock=nolock");
     if (JoinOPGreedy)
     {
         ExecSql("SET JOINOP GREEDY");
     }
     if (JoinOPTimeout > 0)
     {
         ExecSql("SET JOINOP TIMEOUT " + JoinOPTimeout.ToString());
     }
 }
Ejemplo n.º 4
0
        public void EFIngresConstraintColumns()
        {
            using (var connection = (EFIngresConnection)TestHelper.CreateDbConnection())
            {
                // Arrange
                connection.Open();
                var catalogHelpers = new CatalogHelpers(connection);

                // Act
                catalogHelpers.CreateCatalog("EFIngresConstraintColumns");

                // Assert
            }
        }
Ejemplo n.º 5
0
 public override void ChangeDatabase(string databaseName)
 {
     _catalogHelpers = null;
     WrappedConnection.ChangeDatabase(databaseName);
 }