private bool saveData() { try { foreach (ListViewRow.LvRow_MenuOutstanding a in listOrder) { Control.Class_Transaction dataTransaction = new Control.Class_Transaction { IDMenu = a.id.ToString(), kategori = a.kategori, namaMenu = a.namaMenu, hargaBeli = a.hargaBeli, hargaJual = a.hargaJual, jmlItem = a.jmlItem, totalHarga = a.hargaJual * a.jmlItem }; dbOutstanding.insertIntoTable(dataTransaction); } dbOutstanding.removeTable(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool insertIntoTable(Control.Class_Transaction data) { try { using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "POS.db"))) { connection.Insert(data); return(true); } } catch (Exception ex) { throw new Exception(ex.Message); } }