Esempio n. 1
0
        public SqlitefUI(String productTableName, string addProductToMainTransactionTableName, string addProductToTransactionTableName, string databaseLocation)
        {
            sqlite = new SQLiteConnection(databaseLocation);
            DataTable TableWithProducts = InteractWithDatabase.SelectQuery($"Select * From {productTableName}", sqlite);

            this.productTableName = productTableName;
            this.addProductToTransactionTableName = addProductToTransactionTableName;
            this.addProductToTransactionTableName = mainBuyTransactionTableName;
            productList     = new ListOfProducts(InteractWithDatabase.ProductTableToListOfProducts(TableWithProducts), this);
            transactionList = new ListOfTransactions(null);
        }
Esempio n. 2
0
 /// <summary>
 /// Add main transaction to transaction table
 /// </summary>
 /// <param name="iD"></param>
 /// <param name="productName"></param>
 /// <param name="typeOfProduct"></param>
 /// <param name="typeOfUnit"></param>
 public void AddMainBuyTransactionToTransactionTable(int iD, DateTime date, decimal price, string comment, string place)
 {
     //Write the new product to table
     InteractWithDatabase.SelectQuery($"INSERT INTO {mainBuyTransactionTableName} VALUES({iD},'{place}','{comment}','{price}, '{date}')", sqlite);
 }
Esempio n. 3
0
 /// <summary>
 /// Add product to list of products
 /// </summary>
 /// <param name="iD"></param>
 /// <param name="productName"></param>
 /// <param name="typeOfProduct"></param>
 /// <param name="typeOfUnit"></param>
 public void AddProductToProductTable(int iD, string productName, string typeOfProduct, string typeOfUnit)
 {
     //Write the new product to table
     InteractWithDatabase.SelectQuery($"INSERT INTO {productTableName} VALUES({iD},'{productName}','{typeOfProduct}','{typeOfUnit}')", sqlite);
 }
Esempio n. 4
0
 /// <summary>
 /// Add product to main transaction table
 /// </summary>
 /// <param name="iD"></param>
 /// <param name="productName"></param>
 /// <param name="typeOfProduct"></param>
 /// <param name="typeOfUnit"></param>
 public void AddProductToMainBuyTransactionTable(int productID, int transactionID, string productName, int amountOfProduct, string typeOfProduct, decimal discountAmount, decimal price, string comment, decimal amountOfUnitInProduct)
 {
     //Write the new product to table
     InteractWithDatabase.SelectQuery($"INSERT INTO {addProductToTransactionTableName} VALUES({productID},{transactionID},'{comment}',{price},{amountOfProduct},{amountOfUnitInProduct},{discountAmount},'{productName}','{typeOfProduct}')", sqlite);
 }