public void Initialize <T>()
 {
     using (var conn = _iconn.GetConnection())
     {
         conn.CreateTable <T>();
     }
 }
        public IEnumerable <Product> GetFavorites()
        {
            var db = _sqlite.GetConnection(DBNAME);

            db.CreateTable <Product>();

            return(db.Table <Product>());
        }
Beispiel #3
0
        public Place GetPlace(int id)
        {
            using (var connection = SQLite.GetConnection())
            {
                var list = connection.Query <SQLitePlace>("SELECT * FROM SQLitePlace WHERE Id = ?", id);

                if (list == null || list.Count == 0)
                {
                    throw new NotFoundPlaceException(string.Format("Not found place with id: {0} in local database.", id));
                }

                return(FromSQLitePlaceToPlace(list.FirstOrDefault()));
            }
        }
Beispiel #4
0
        private void PrepareDatabase()
        {
            ISQLite db = null;

            using (var scope = Container.BeginLifetimeScope())
                db = scope.Resolve <ISQLite>();

            if (db == null)
            {
                return;
            }

            db.GetConnection().CreateTable <ClienteModel>();
            db.GetConnection().DeleteAll <ClienteModel>();
        }
Beispiel #5
0
 public StatsService(ISQLite dbservices, IEventServices eventServices, ITimeServices timeServices)
 {
     this.dbservices = dbservices;
     Connection      = dbservices.GetConnection();
     EventServices   = eventServices;
     TimeServices    = timeServices;
 }
 public SQLiteIncidentService()
 {
     localdb = DependencyService.Get<ISQLite> ();
     using(var conn = localdb.GetConnection ()) {
         conn.CreateTable<Incident> ();
     }
 }
Beispiel #7
0
        public UserService(ISlackRestClient restClient, ISQLite sqlite)
        {
            _restClient = restClient;
            _database   = sqlite.GetConnection();

            _database.CreateTable <User>();
            _database.CreateTable <UserProfile>();
        }
Beispiel #8
0
 public AddRunnerPageViewModel(ISQLite sQLite, IRunnerServices RunnerServices, INavigationService navigationService)
 {
     SqlServices         = sQLite;
     NavigationService   = navigationService;
     this.RunnerServices = RunnerServices;
     Connection          = SqlServices.GetConnection();
     SaveRunnerCommand   = new DelegateCommand(SaveRunnerMethod);
 }
Beispiel #9
0
        public UserService(ISlackRestClient restClient, ISQLite sqlite)
        {
            _restClient = restClient;
            _database = sqlite.GetConnection();

            _database.CreateTable<User>();
            _database.CreateTable<UserProfile>();
        }
 public SQLiteRatingRepository(ISQLite sqlLite)
 {
     _sqlLite = sqlLite;
     //TESTING
     DropTable();
     //TESTING
     CreateTable();
     DataSet = _sqlLite.GetConnection().Table<Rating>();
 }
 public SQLiteCommentRepository(ISQLite sqlLite)
 {
     _sqlLite = sqlLite;
     //TESTING
     DropTable();
     //TESTING
     CreateTable();
     DataSet = _sqlLite.GetConnection().Table<Comment>();
 }
        public SQLiteSavedUserRepository(ISQLite sqlLite)
        {
            _sqlLite = sqlLite;
            //TESTING
//            _sqlLite.DeleteDatabase();
            //TESTING
            CreateTable();
            DataSet = _sqlLite.GetConnection().Table<SavedUser>();
        }
Beispiel #13
0
        public DatabaseService(ISQLite sqlite)
        {
            _sqlite = sqlite;

            var connection = _sqlite.GetConnection();

            UpdateDatabase(connection);

            _connection = _sqlite.GetAsyncConnection();
        }
Beispiel #14
0
 public RunnerPageViewModel(ISQLite dbservices, IRunnerServices runnerServices, INavigationService navigationService)
 {
     NavigationService = navigationService;
     NavigateToAddRunnerPageCommand = new DelegateCommand(NavigateToAddRunnerPage);
     NavigateToStatsCommand         = new DelegateCommand <Runner>(NavigateToStatsMethod);
     SqlServices    = dbservices;
     RunnerServices = runnerServices;
     Connection     = SqlServices.GetConnection();
     IsBusy         = true;
 }
Beispiel #15
0
        public UnitOfWork(ISQLite sqlite)
        {
            DB = sqlite.GetConnection();

            _AlunoRepository = new GenericRepository <Aluno, long>(DB, DBLocker);

            lock (DBLocker) {
                DB.CreateTable <Aluno>();
            }
        }
        public BaseRepository(ISQLite sqlite, IEventAggregator eventAggregator)
        {
            _connection      = sqlite.GetConnection();
            _asyncConnection = sqlite.GetAsyncConnection();
            _eventAggregator = eventAggregator;

            CreateTableIfNonExistent();

            _eventAggregator.GetEvent <LogoutEvent>().Subscribe(async() => await RemoveAllAsync());
        }
Beispiel #17
0
        public DbContext(ISQLite connection)
        {
            _connection = connection.GetConnection();

            Token        = new DbSet <AuthToken>(_connection);
            Client       = new DbSet <Client>(_connection);
            UsageItem    = new DbSet <UsageItem>(_connection);
            Location     = new DbSet <Location>(_connection);
            User         = new DbSet <User>(_connection);
            UserTask     = new DbSet <UserTask>(_connection);
            UserTaskTime = new DbSet <UserTaskTime>(_connection);
        }
Beispiel #18
0
 public MainPageViewModel(INavigationService navigationService, ISQLite dbservices, IEventServices eventServices, IPdfServices pdfServices)
     : base(navigationService)
 {
     Title = "Main Menu";
     NavigateToRunnerPageCommand = new DelegateCommand(NavigateToRunnerPage);
     DeleteAllCommand            = new DelegateCommand(DeleteAllMethod);
     NavigateToEventsPageCommand = new DelegateCommand(NavigateToEventsPage);
     this.navigationService      = navigationService;
     this.dbservices             = dbservices;
     Connection = dbservices.GetConnection();
     dbservices.CreateTables(Connection);
     this.EventServices = eventServices;
     GetNotRanEvents();
 }
Beispiel #19
0
 public void OpenConnection()
 {
     _connection = _sqlite.GetConnection();
 }
Beispiel #20
0
 public SQLiteConnection GetConnection()
 {
     return(_sqlite.GetConnection());
 }
Beispiel #21
0
        //private static object _locker = new object();

        public AppDatabase(ISQLite sqlLite)
        {
            SqlLiteAsyncConnection = sqlLite.GetConnection();
        }
 // start implement
 public SQLiteNhanVienStore(ISQLite db)
 {
     _connection = db.GetConnection();
     _connection.CreateTableAsync <NhanVien>();
 }
Beispiel #23
0
 public TransactionScope(ISQLite SQLite)
 {
     _dataBase    = SQLite.GetConnection();
     _savePointId = BeginTransaction();
 }
Beispiel #24
0
 public ClienteService(ISQLite sqlite)
 {
     _conn = sqlite.GetConnection();
 }
        public IList <Property> GetAll()
        {
            var con = Database.GetConnection();

            return(con.Query <Property> ("SELECT * FROM Properties", new object[] { }));
        }
 protected BaseSQLite()
 {
     iSQLite = Locator.Current.GetService <ISQLite>();
     db      = iSQLite.GetConnection();
 }
Beispiel #27
0
        public IList <ListEntry> GetByDate(DateTime date)
        {
            var con = Database.GetConnection();

            return(con.Query <ListEntry> ("SELECT * FROM ListEntries WHERE Date = ?", new object[] { date.ToString("yyyy-MM-dd 00:00:00.000") }));
        }
Beispiel #28
0
 public RunnerServices(ISQLite dbservices, ITimeServices timeServices)
 {
     this.dbservices   = dbservices;
     this.Connection   = dbservices.GetConnection();
     this.TimeServices = timeServices;
 }
Beispiel #29
0
 public ActivityRepository(ISQLite sqlite)
 {
     _db = sqlite.GetConnection();
     _db.CreateTable <Activity>();
     _db.CreateTable <ActivityPosition>();
 }
Beispiel #30
0
 public ContactDatabase(ISQLite sqLite)
 {
     _database = sqLite.GetConnection();
 }
Beispiel #31
0
 public LocalRepository(ISQLite sql)
 {
     _sql        = sql;
     _connection = _sql.GetConnection();
 }
 private SQLiteConnection GetConnection()
 {
     return(conMngr.GetConnection());
 }
 public UserRepository()
 {
     _sqlite = Resolver.Resolve<ISQLite>();
     _connection = _sqlite.GetConnection();
     _connection.CreateTable<User>();
 }
 public SqLiteService(ISQLite sqlLite) : base(sqlLite.GetConnection())
 {
 }
Beispiel #35
0
 public TimeServices(ISQLite dbservices)
 {
     this.dbservices = dbservices;
     this.Connection = dbservices.GetConnection();
 }