Example #1
0
        private async void checkinoutSwitch_Clicked(object sender, EventArgs e)
        {
            var swtchChecInoChecOut = "Automatic";

            if (checkinoutSwitch.IsToggled)
            {
                swtchChecInoChecOut = "CheckIn";
            }
            else
            {
                swtchChecInoChecOut = "CheckOut";
            }

            using (var datos = new Controllers.DataAccess())
            {
                var listitemsSource = datos.GetFirst <Models.Configuracion>();
                var Configuracion   = new Models.Configuracion();
                Configuracion = new Models.Configuracion
                {
                    IdConfiguracion   = listitemsSource.IdConfiguracion,
                    FechaRegistro     = listitemsSource.FechaRegistro,
                    FechaModificacion = System.DateTime.Now,
                    CheckInorCheckout = swtchChecInoChecOut
                };
                datos.Update <Models.Configuracion>(Configuracion);
            }

            registraUbicacion(swtchChecInoChecOut);
            return;
        }
        public static void InsertarConfiguracion(Models.Configuracion configuracion)
        {
            using (var db = new SQLiteConnection(_baseDatos))
            {
                var existente = db.Table <Models.Configuracion>()
                                .Where(c => c.Clave == configuracion.Clave)
                                .FirstOrDefault();

                if (existente != null)
                {
                    db.Delete <Models.Configuracion>(existente);
                }

                db.Insert(configuracion);
            }
        }