예제 #1
0
        public void Sort(string key, bool ascending)
        {
            // Take action based on key
            switch (key)
            {
            case "Apparaatnaam":
                if (ascending)
                {
                    Aankopen.Sort((x, y) => x.ApparaatNaam.CompareTo(y.ApparaatNaam));
                }
                else
                {
                    Aankopen.Sort((x, y) => - 1 * x.ApparaatNaam.CompareTo(y.ApparaatNaam));
                }
                break;

            case "GekochtOp":
                if (ascending)
                {
                    Aankopen.Sort((x, y) => ((int)x.GekochtOp.Compare(y.GekochtOp)));
                }
                else
                {
                    Aankopen.Sort((x, y) => - 1 * ((int)x.GekochtOp.Compare(y.GekochtOp)));
                }
                break;
            }
        }
예제 #2
0
        public void LoadAankopen(SqliteConnection conn, string id)
        {
            bool shouldClose = false;

            // clear last connection to preventcirculair call to update
            _conn = null;

            // Is the database already open?
            if (conn.State != ConnectionState.Open)
            {
                shouldClose = true;
                conn.Open();
            }

            using (var commandAK = conn.CreateCommand())
            {
                try
                {
                    // Create new command
                    commandAK.CommandText = "SELECT DISTINCT ID FROM [Aankoop] WHERE PersoonID = '" + ID + "'";
                    using (var readerAK = commandAK.ExecuteReader())
                    {
                        while (readerAK.Read())
                        {
                            var aankoop = new AankoopModel();
                            var idAK    = (string)readerAK["ID"];

                            aankoop.Load(conn, idAK);

                            Aankopen.Add(aankoop);
                        }
                    }
                }
                catch (Exception Exception)
                {
                    Debug.WriteLine(Exception.Message);
                }
            }

            if (shouldClose)
            {
                conn.Close();
            }

            // Save last connection
            _conn = conn;
        }
예제 #3
0
        void LoadAankopen(SqliteConnection conn, string PersoonID)
        {
            bool shouldClose = false;

            // Is the database already open?
            if (conn.State != ConnectionState.Open)
            {
                shouldClose = true;
                conn.Open();
            }

            // Execute query
            using (var command = conn.CreateCommand())
            {
                try
                {
                    // Create new command
                    command.CommandText = "SELECT DISTINCT ID FROM [Aankoop] WHERE PersoonID = '" + PersoonID + "'";

                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var aankoop = new AankoopModel();
                            var id      = (string)reader["ID"];

                            aankoop.Load(conn, id);

                            Aankopen.Add(aankoop);
                        }
                    }
                }
                catch (Exception Exception)
                {
                    Debug.WriteLine(Exception.Message);
                }
            }

            if (shouldClose)
            {
                conn.Close();
            }
        }