Example #1
0
        public void TC_RemoveProductFromBasket()
        {
            test = extent.CreateTest("Test Case to remove item from Basket");

            var homePage   = new home(driver);
            var loginPage  = new login(driver);
            var basketPage = new basket(driver);


            //Login to Amazon
            test.Log(Status.Info, "Login to Amamzon website");
            Assert.IsTrue(homePage.verifyHomePage("Sign in"), "Amamzon home page is unavailable");
            homePage.clickOnSignIn();
            loginPage.setUser_email(ConfigurationManager.AppSettings.Get("email"));
            loginPage.clickOnContinue();
            loginPage.setUser_password(ConfigurationManager.AppSettings.Get("password"));
            loginPage.clickOnSubmit();
            Assert.IsTrue(homePage.verifyHomePage(ConfigurationManager.AppSettings.Get("user")), "User is not logged in");
            test.Log(Status.Info, "Login successfull");

            //Remove product from Basket
            basketPage.clickOnBasket();
            Assert.IsTrue(basketPage.verifyBasketPage(), "Unable to navigate to Basket page");
            test.Log(Status.Info, "Navigated to Shopping Basket");
            basketPage.removeProductsFromBasket();
            test.Log(Status.Info, "All products removed from Basket");
        }
Example #2
0
        public ActionResult Sepet(FormCollection frm)
        {//Slider verileri listesi gonderıcek
            basket bskt = new basket();
            int    x    = Convert.ToInt32(frm["product.Id"]);

            if (datas.baskets.Where(n => n.pid == x && n.uid == user.Id).FirstOrDefault() != null)
            {
                datas.baskets.Where(n => n.pid == x && n.uid == user.Id).FirstOrDefault().adet++;
            }
            else
            {
                bskt.pid  = Convert.ToInt32(frm["product.Id"]);
                bskt.uid  = user.Id;
                bskt.adet = Convert.ToInt32(frm["adet"]);
                product pro = datas.products.Where(n => n.Id == bskt.pid).FirstOrDefault();
                bskt.date  = DateTime.Now;
                bskt.price = Convert.ToInt32(pro.price * bskt.adet);
                bskt.onay  = 2;
                bskt.odeme = 2;
                int a = datas.baskets.Max(n => n.basketId);
                int b = datas.baskets.Max(n => n.uid);
                if (b == user.Id)
                {
                    bskt.basketId = a;
                }
                else
                {
                    bskt.basketId = (a + 1);
                }

                datas.baskets.Add(bskt);
            }
            datas.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public List <basket> getBasket(string sessionID)
        {
            List <basket> B = new List <basket>();

            using (SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DbStore"].ToString()))
            {
                string sSQL = "SELECT * FROM TempOrder WHERE SessionID ='" + sessionID + "'";
                using (SqlCommand cmd = new SqlCommand(sSQL, con))
                {
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        basket b = new basket();
                        b.Author    = reader["Author"].ToString().Trim();
                        b.Price     = decimal.Parse(reader["Price"].ToString());
                        b.SessionID = reader["SessionID"].ToString().Trim();
                        b.Title     = reader["Title"].ToString().Trim();
                        B.Add(b);
                    }
                    cmd.Connection.Close();
                }
            }
            return(B);
        }
Example #4
0
        public async Task <IHttpActionResult> PutUnicornBasket(Guid id, basket unicornBasket)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            if (id != unicornBasket.basket_id)
            {
                return(this.BadRequest());
            }

            this.unishopEntitiesContext.SetModified(unicornBasket);

            try
            {
                await this.unishopEntitiesContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!this.UnicornBasketExists(id))
                {
                    return(this.NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(this.StatusCode(HttpStatusCode.NoContent));
        }
Example #5
0
        public ActionResult BasketDelete(int id)
        {
            basket basket = models.baskets.FirstOrDefault(x => x.basket_id == id);

            models.baskets.Remove(basket);
            models.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            basket basket = db.baskets.Find(id);

            db.baskets.Remove(basket);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #7
0
 // Update is called once per frame
 void Update()
 {
     if (transform.position.y < bottomY)
     {
         Destroy(this.gameObject);
         basket apScript = Camera.main.GetComponent <basket>();
         apScript.AppleDestroyed();
     }
 }
Example #8
0
 public ActionResult Edit([Bind(Include = "id,client_id")] basket basket)
 {
     if (ModelState.IsValid)
     {
         db.Entry(basket).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.client_id = new SelectList(db.clients, "id", "firstname", basket.client_id);
     return(View(basket));
 }
Example #9
0
        public ActionResult BasketAdd(int id, basket b)
        {
            product product = models.products.FirstOrDefault(x => x.product_id == id);
            user    user    = models.users.FirstOrDefault(x => x.username == User.Identity.Name);

            b.user_id     = user.users_id;
            b.product_id  = product.product_id;
            b.total_price = Convert.ToInt32(product.price);
            models.baskets.Add(b);
            models.SaveChanges();
            return(RedirectToAction("Index", "RestaurantUser", new { @id = product.restaurant_id }));
        }
Example #10
0
        public ActionResult Create([Bind(Include = "id,client_id")] basket basket)
        {
            if (ModelState.IsValid)
            {
                db.baskets.Add(basket);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.client_id = new SelectList(db.clients, "id", "firstname", basket.client_id);
            return(View(basket));
        }
Example #11
0
        public async Task <IHttpActionResult> PostUnicornBasket(basket unicornBasket)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }

            unicornBasket.basket_id = Guid.NewGuid();
            this.unishopEntitiesContext.baskets.Add(unicornBasket);
            await this.unishopEntitiesContext.SaveChangesAsync();

            return(this.CreatedAtRoute("DefaultApi", new { id = unicornBasket.basket_id }, unicornBasket));
        }
Example #12
0
        public async Task <IHttpActionResult> DeleteUnicornBasket(Guid id)
        {
            basket unicornBasket = await this.unishopEntitiesContext.baskets.FindAsync(id);

            if (unicornBasket == null)
            {
                return(this.NotFound());
            }

            this.unishopEntitiesContext.baskets.Remove(unicornBasket);
            await this.unishopEntitiesContext.SaveChangesAsync();

            return(this.Ok(unicornBasket));
        }
Example #13
0
        // GET: baskets/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            basket basket = db.baskets.Find(id);

            if (basket == null)
            {
                return(HttpNotFound());
            }
            return(View(basket));
        }
Example #14
0
        // GET: baskets/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            basket basket = db.baskets.Find(id);

            if (basket == null)
            {
                return(HttpNotFound());
            }
            ViewBag.client_id = new SelectList(db.clients, "id", "firstname", basket.client_id);
            return(View(basket));
        }
Example #15
0
        public void PostUnicornBasketSuccessTest()
        {
            this.GivenUnishopDbContext();
            this.GivenBasketController();

            var basket = new basket {
                basket_id = Guid.NewGuid()
            };
            var result = this.basketController.PostUnicornBasket(basket).GetAwaiter().GetResult();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(CreatedAtRouteNegotiatedContentResult <basket>));
            var confirmed_result = result as CreatedAtRouteNegotiatedContentResult <basket>;

            Assert.AreEqual(confirmed_result.RouteName, "DefaultApi");
            Assert.AreEqual(confirmed_result.RouteValues["id"], confirmed_result.Content.basket_id);
            Assert.AreEqual(confirmed_result.Content.basket_id, basket.basket_id);
        }
Example #16
0
        public ActionResult odemeyap(int id)
        {
            if (ModelState.IsValid)
            {
                List <basket> bsk  = datas.baskets.Where(u => u.basketId == id && u.odeme == 2).ToList();
                basket        bask = datas.baskets.Where(u => u.basketId == id && u.odeme == 2).FirstOrDefault();
                foreach (var item in bsk)
                {
                    item.odeme = 1;
                }
                //product pro = datas.products.Where(x => x.Id == bask.pid).FirstOrDefault();
                //pro.stockStatus = pro.stockStatus - 1;
                datas.stockStatus.Remove(datas.stockStatus.Where(s => s.pId == bask.pid).FirstOrDefault());

                datas.SaveChanges();
                return(RedirectToAction("basket"));
            }
            return(View());
        }
        public ActionResult getBasket()
        {
            string sessionID = Session["id"].ToString();

            ServiceBooks.BookStoreServiceClient client = new ServiceBooks.BookStoreServiceClient();
            var           chart = client.getBasket(sessionID);
            List <basket> B     = new List <basket>();

            foreach (var item in chart)
            {
                basket b = new basket();
                b.Author    = item.Author;
                b.Price     = item.Price;
                b.SessionID = item.SessionID;
                b.Title     = item.Title;
                B.Add(b);
            }
            return(PartialView("_basket", B));
        }
        private void btnSiparisOlustur_Click(object sender, EventArgs e)
        {
            MarketOtomasyonEntities db      = new MarketOtomasyonEntities();
            FormSiparisOnay         sprOnay = new FormSiparisOnay();

            sprOnay.txtToplamTutar.Text = nToplam.Value.ToString("0.00");
            sepetList.ForEach(x => sprOnay.lstUrunSiparisOnay.Items.Add(x));
            foreach (var item in sepetList)
            {
                var sepetim = new basket()
                {
                    ProductId   = item.ProductID,
                    ProductName = item.ProductName,
                    Quantity    = item.Quantity,
                    SalesPrice  = item.SalesPrice
                };
                db.baskets.Add(sepetim);
                db.SaveChanges();
            }
            sprOnay.Show();
        }
Example #19
0
        public void TC_AddProductToBasket([Values("ipad", "iphone")] string products)
        {
            test = extent.CreateTest("Test Case to Search " + products);

            var    homePage          = new home();
            var    loginPage         = new login(driver);
            var    searchPage        = new searchResults(driver);
            var    productDetailPage = new productDetail(driver);
            var    basketPage        = new basket(driver);
            string productNameCaptured;

            //Login to Amazon
            test.Log(Status.Info, "Login to Amamzon website");
            //Assert.IsTrue(homePage.verifyHomePage("Sign in"), "Amamzon home page is unavailable");
            AllClassesObjects aco = new AllClassesObjects();

            Assert.IsTrue(aco.homePage.verifyHomePage("Sign in"), "Amamzon home page is unavailable");
            homePage.clickOnSignIn();
            loginPage.setUser_email(ConfigurationManager.AppSettings.Get("email"));
            loginPage.clickOnContinue();
            loginPage.setUser_password(ConfigurationManager.AppSettings.Get("password"));
            loginPage.clickOnSubmit();
            Assert.IsTrue(homePage.verifyHomePage(ConfigurationManager.AppSettings.Get("user")), "User is not logged in");
            test.Log(Status.Info, "Login successfull");

            //Search the product in Amazon
            homePage.setSearch_Product(products);
            homePage.clickOnSearchBtn();
            productNameCaptured = searchPage.getFirstProductName();
            searchPage.verifyProductLandPage(products);
            test.Log(Status.Info, "The first product name from search list: " + productNameCaptured);
            searchPage.clickOnFirstProduct();

            //Add product to cart
            Assert.IsTrue(productDetailPage.verifyProduct(productNameCaptured), "Failed to verify the product: " + productNameCaptured);
            productDetailPage.clickOnAddToCartBtn();
            Assert.IsTrue(basketPage.verifyProductAddedToCart(), "Failed to add product to basket");
            test.Log(Status.Info, "Successfully added product to Basket");
        }
Example #20
0
 void Start()
 {
     p = playerToTrack.GetComponent <basket>();
 }
 public void Pickup(basket b)
 {
     b.AddScore(scoreValue);
     Destroy();
 }