public void InsertCompany()
        {
            string       sqlNewCompany    = SqlNewCompanyString();
            TsqlNonQuery insertNewCompany = new TsqlNonQuery("New Company", sqlNewCompany);

            CompanyList.companies.Add(this);
        }
Example #2
0
        /// <summary>
        /// Insert this product into the DB and the programs product list.
        /// </summary>
        public void InsertProduct()
        {
            string       sqlNewProduct    = SqlNewProductString();
            TsqlNonQuery insertNewProduct = new TsqlNonQuery("New Product", sqlNewProduct);

            ProductList.products.Add(this); // add self to current list.
        }
Example #3
0
        /// <summary>
        /// Update the stock level of a product.
        /// </summary>
        /// <param name="change">The change in stock level. Negative for sale, positive for order recieved</param>
        public void UpdateStockLevel(string change)
        {
            if (!Int32.TryParse(change, out int c))
            {
                //ToDO: create breakpoint
            }

            string       sqlUpdateStock = SqlUpdateStock(c);
            TsqlNonQuery UpdateStock    = new TsqlNonQuery("Update Stock Levels", sqlUpdateStock);
        }
Example #4
0
        /// <summary>
        /// Creates a new sale adds it and the item lines to the DB at he conclusion of the sale.
        /// </summary>
        public void InsertSale()
        {
            foreach (NewItemLine i in items)
            {
                saleTotal += i.LineCost;
            }

            string       sqlNewSaleString = NewSaleInsertString();
            TsqlNonQuery insertNewSale    = new TsqlNonQuery("New Sale Line", sqlNewSaleString);

            foreach (NewItemLine i in items)
            {
                string       sqlItemLineString = NewItemInsertString(i);
                TsqlNonQuery insertItemLine    = new TsqlNonQuery("New Item Line", sqlItemLineString);
            }
        }