Beispiel #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);
        }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }