Пример #1
0
        public void Insert()
        {
            var db = PosDb.Connect();

            db.Insert(this);
            db.Close();
        }
Пример #2
0
        public static List <T> Get_All()
        {
            var db      = PosDb.Connect();
            var records = db.Table <T>().ToList();

            db.Close();
            return(records);
        }
Пример #3
0
        public static T Get(int id)
        {
            var db      = PosDb.Connect();
            T   records = db.Find <T>(id);

            db.Close();
            return(records);
        }
Пример #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);
        }
Пример #5
0
        protected override void OnStart()
        {
            var db = PosDb.Connect();

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

            db.Close();
        }
Пример #6
0
        public void Update()
        {
            var db = PosDb.Connect();

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