Exemplo n.º 1
0
        public void Insert()
        {
            var db = PosDb.Connect();

            db.Insert(this);
            db.Close();
        }
Exemplo n.º 2
0
        public static List <T> Get_All()
        {
            var db      = PosDb.Connect();
            var records = db.Table <T>().ToList();

            db.Close();
            return(records);
        }
Exemplo n.º 3
0
        public static T Get(int id)
        {
            var db      = PosDb.Connect();
            T   records = db.Find <T>(id);

            db.Close();
            return(records);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        protected override void OnStart()
        {
            var db = PosDb.Connect();

            db.CreateTable <Product>();
            db.CreateTable <Client>();
            db.CreateTable <Sell>();

            db.Close();
        }
Exemplo n.º 6
0
        public void Update()
        {
            var db = PosDb.Connect();

            try
            {
                db.Update(this);
            }
            catch
            {
                Console.WriteLine("No record to update");
            }
            finally
            {
                db.Close();
            }
        }