private void Awake()
 {
     if (defaultAccess == null)
     {
         defaultAccess = new SQLiteAccess(dbFilePath);
     }
 }
Example #2
0
        public void ExecuteComandWOReturnTest()
        {
            SQLiteAccess sqlLiteAccess = SQLiteAccess.Instance;
            int          res           = sqlLiteAccess.ExecuteComandWOReturn("INSERT INTO client(id, nom, prenom, date_arrivee, telephone_fixe, telephone_portable) VALUES(2, 'DORR', 'Alexis', 672278400, '0123456789', '0123456789');");

            Assert.AreEqual(res, 1);
        }
Example #3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Controller objects
            automation = new Automation();
            navigation = new Navigation();
            htmlDoc    = new HTMLDoc();
            dataGrid   = new Controller.DataGrid();
            webMiner   = new WebMiner();
            rnd        = new Random();

            // Layered prediction
            statisticalPrediction = new StatisticalPrediction();
            uIComponent           = new UIContexter();
            userRule = new UserRule();

            // Model Objects
            browserData = new BrowserData();
            dBAccess    = new SQLiteAccess();
            formData    = new FormData();

            // View objects
            //browserView = new BrowserView();

            Application.Run(formNavi = new FormNavi());
        }
Example #4
0
        public void ExecuteCommandWReturnTest()
        {
            SQLiteAccess     sqlLiteAccess = SQLiteAccess.Instance;
            SQLiteDataReader reader        = sqlLiteAccess.ExecuteCommandWReturn("SELECT * FROM client;");

            Assert.AreEqual(1, reader.StepCount);
        }
Example #5
0
 public List <UserRequest> GetRequestsUsersFromDatabases()
 {
     try
     {
         var usersRequests = new List <UserRequest>();
         foreach (string connectionString in SQLiteAccess.GetConnections())
         {
             IList <IDictionary <String, object> > dic = SQLiteAccess.Select("SELECT ID, REQUESTS FROM USERS WHERE ENABLED = 1", connectionString);
             foreach (IDictionary <String, object> row in dic)
             {
                 int id    = Convert.ToInt32(row["ID"]);
                 int value = Convert.ToInt32(row["REQUESTS"]);
                 if (usersRequests.Any(x => x.id == id))
                 {
                     usersRequests.Where(x => x.id == id).ToList().ForEach(s => s.value += value);
                 }
                 else
                 {
                     var userRequest = new UserRequest();
                     userRequest.id    = id;
                     userRequest.value = value;
                     usersRequests.Add(userRequest);
                 }
             }
         }
         return(usersRequests);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
        private void CleanRequests()
        {
            var query = "";

            query = $@"UPDATE USERS SET BLOCKED = 'false', REQUESTS = 0";
            SQLiteAccess.ExecuteQuery(query);
        }
        public void SetUpTest()
        {
            if (File.Exists(TestDataBaseName))
            {
                File.Delete(TestDataBaseName);
            }

            access = new SQLiteAccess
            {
                DataBaseName = TestDataBaseName
            };
        }
Example #8
0
 public void UsersCleaning()
 {
     try
     {
         var query = $@"UPDATE USERS SET BLOCKED = 'false', REQUESTS = 0";
         SQLiteAccess.ExecuteQuery(query);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #9
0
 public void SaveUserTotalRequests(User user)
 {
     try
     {
         SQLiteConnection.ClearAllPools();
         var query = $@"UPDATE USERS SET TOTAL_REQUESTS = {user.totalRequests} WHERE ID = {user.id}";
         SQLiteAccess.ExecuteQuery(query);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #10
0
 public User GetById(int id)
 {
     try
     {
         SQLiteConnection.ClearAllPools();
         IList <IDictionary <String, object> > dic = SQLiteAccess.Select("SELECT ID, USER, OBS, [DESC], LEGACY, IPS,ENABLED, ALLOW_BLOCK, BLOCKED, [LIMIT], REQUESTS, TOTAL_REQUESTS FROM USERS WHERE ID=" + id);
         var user = new UserData(dic[0]);
         return(user);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #11
0
 public IList <User> GetAll()
 {
     try
     {
         SQLiteConnection.ClearAllPools();
         IList <IDictionary <String, object> > dic = SQLiteAccess.Select("SELECT ID, USER, OBS, [DESC], LEGACY, IPS, ENABLED, ALLOW_BLOCK, BLOCKED, [LIMIT], REQUESTS FROM USERS");
         IList <User> users = new List <User>();
         foreach (IDictionary <String, object> row in dic)
         {
             var user = new UserData(row);
             users.Add(user);
         }
         return(users);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #12
0
 public void DeleteUser(int id)
 {
     try
     {
         SQLiteConnection.ClearAllPools();
         if (id > 0)
         {
             var query = $@"DELETE FROM USERS WHERE ID = {id}";
             SQLiteAccess.ExecuteQuery(query);
         }
         else
         {
             throw new Exception("Selecione um usuário");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #13
0
 public void SaveUser(User user)
 {
     try
     {
         SQLiteConnection.ClearAllPools();
         var query = "";
         if (user.id > 0)
         {
             query = $@"UPDATE USERS SET USER = '******', OBS = '{user.obs}', [DESC] = '{user.desc}', LEGACY = {Convert.ToInt32(user.legacy)}, IPS = '{user.ips}', ENABLED = {Convert.ToInt32(user.enabled)}, ALLOW_BLOCK = {Convert.ToInt32(user.allowBlock)}, BLOCKED = {Convert.ToInt32(user.blocked)}, [LIMIT] = {user.limit}, REQUESTS = {user.requests} WHERE ID = {user.id}";
         }
         else
         {
             query = $@"INSERT INTO USERS (USER, OBS, [DESC], LEGACY, IPS, ENABLED, ALLOW_BLOCK, BLOCKED, [LIMIT], REQUESTS)
                              VALUES ('{user.name}', '{user.obs}', '{user.desc}', {Convert.ToInt32(user.legacy)}, '{user.ips}', {Convert.ToInt32(user.enabled)}, {Convert.ToInt32(user.allowBlock)},
                                       {Convert.ToInt32(user.blocked)}, {user.limit}, {user.requests})";
         }
         SQLiteAccess.ExecuteQuery(query);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public HistoryTaskFactory(SQLiteAccess access) : base(access)
 {
     userFactory = new UserFactory(access);
 }
Example #15
0
 public void CreateProcessingTimes(SQLiteAccess access)
 {
     this.access = access;
     CreateProcessingTimes();
 }
Example #16
0
 public HouseholdTaskFactory(SQLiteAccess access) : base(access)
 {
     historyTaskFactory    = new HistoryTaskFactory(access);
     processingTimeFactory = new ProcessingTimeFactory(access);
     userFactory           = new UserFactory(access);
 }
 public ProcessingTimeFactory(SQLiteAccess access) : base(access)
 {
 }
Example #18
0
 public UserFactory(SQLiteAccess access) : base(access)
 {
 }
Example #19
0
 public Factory(SQLiteAccess access)
 {
     _access = access;
 }
Example #20
0
 public ObjectBddTransition()
 {
     sqliteAccess = SQLiteAccess.Instance;
 }
Example #21
0
 public void CreateHouseholdTask(SQLiteAccess access)
 {
     this.access = access;
     CreateHouseholdTask();
 }
Example #22
0
 public void CreateUsers(SQLiteAccess access)
 {
     this.access = access;
     CreateUsers();
 }
Example #23
0
 public TaskService()
 {
     access = new SQLiteAccess();
     householdTaskFactory = new HouseholdTaskFactory(access);
 }