/// Delete Procedure Data Controller

        public bool DeleteStock(stockModel removingStock)
        {
            DbCommand sp_deletect2Stock = db.GetStoredProcCommand("sp_deletect2Stock");

            db.AddInParameter(sp_deletect2Stock, "@stockID", SqlDbType.Int, removingStock.stockID);

            return(false);
        }
        ///Update Procedure Data Controller

        public bool UpdateStock(stockModel currentStock)
        {
            DbCommand sp_updatect2Stock = db.GetStoredProcCommand("sp_updatect2Stock");

            db.AddInParameter(sp_updatect2Stock, "@stockID", SqlDbType.Int, currentStock.stockID);
            db.AddInParameter(sp_updatect2Stock, "@categoryIDFK", SqlDbType.Int, currentStock.category);
            db.AddInParameter(sp_updatect2Stock, "@stockQuantity", SqlDbType.Int, currentStock.stockQuantity);
            db.AddInParameter(sp_updatect2Stock, "@locationCode", SqlDbType.VarChar, currentStock.locationCode);

            return(false);
        }
        public bool placeOrderByStockId(int id)
        {
            bool success = false;

            using (var context = new dbContext())
            {
                stockModel Stock = context.Stocks.SingleOrDefault(r => r.id == id);
                driver.Navigate().GoToUrl(Stock.url);

                //Thread.Sleep(10000);
                //string css = "div.sort-list:first-child .view-all";
                //IWebElement ViewAll = driver.FindElement(By.CssSelector(css));
                //ViewAll.Click();

                //css = ".products li:nth-child(" + Stock.countId + ") div";
                //IWebElement product = driver.FindElement(By.CssSelector(css));
                //product.Click();

                string      css   = "ul li:first-child div";
                IWebElement color = driver.FindElement(By.CssSelector(css));
                color.Click();
                ((IJavaScriptExecutor)driver).ExecuteScript("$('.chosen :nth(1)').attr('selected', true)");
                ((IJavaScriptExecutor)driver).ExecuteScript(" $('.add-button button').click()");
                Thread.Sleep(3000);
                string returnMessage = (string)((IJavaScriptExecutor)driver).ExecuteScript("return  $('.errors div:nth(2)').text()");
                if (returnMessage == "We're sorry, the selected item does not have 1 item in stock. Please try again.")
                {
                    success = false;

                    using (var contexts = new dbContext())
                    {
                        Stock.inStock = false;
                        contexts.Stocks.Attach(Stock);
                        var entry = contexts.Entry(Stock);
                        entry.Property(e => e.inStock).IsModified = true;
                        // other changed properties
                        contexts.SaveChanges();
                    }
                }
                if (returnMessage != "We're sorry, the selected item does not have 1 item in stock. Please try again.")
                {
                    success = true;
                }
            }

            return(success);
        }
        ///Create Procedure Data Controller

        public int createStock(stockModel currentStock)
        {
            int success;

            DbCommand sp_createct2Stock = db.GetStoredProcCommand("sp_createct2Stock");

            sp_createct2Stock.Connection = db.CreateConnection();
            sp_createct2Stock.Connection.Open();

            db.AddInParameter(sp_createct2Stock, "@categoryIDFK", SqlDbType.Int, currentStock.category);
            db.AddInParameter(sp_createct2Stock, "@stockQuantity", SqlDbType.Int, currentStock.stockQuantity);
            db.AddInParameter(sp_createct2Stock, "@locationCode", SqlDbType.VarChar, currentStock.locationCode);

            success = sp_createct2Stock.ExecuteNonQuery();

            return(success);
        }