public void Insert() { var db = PosDb.Connect(); db.Insert(this); db.Close(); }
public static List <T> Get_All() { var db = PosDb.Connect(); var records = db.Table <T>().ToList(); db.Close(); return(records); }
public static T Get(int id) { var db = PosDb.Connect(); T records = db.Find <T>(id); db.Close(); return(records); }
private static List <Sell> Get_Sells_From_Last_N_Days(int days) { DateTime dias = DateTime.Now.AddDays(days); var db = PosDb.Connect(); List <Sell> sells = db.Table <Sell>().Where(sell => sell.Timestamp > dias).ToList(); db.Close(); return(sells); }
protected override void OnStart() { var db = PosDb.Connect(); db.CreateTable <Product>(); db.CreateTable <Client>(); db.CreateTable <Sell>(); db.Close(); }
public void Update() { var db = PosDb.Connect(); try { db.Update(this); } catch { Console.WriteLine("No record to update"); } finally { db.Close(); } }