Beispiel #1
0
        public void Refresh()
        {
            var tasks    = _repository.GetAllExecutors(_isFullInfoRequired);
            var filtered = tasks.Select(x => new ExecutorVM(x)).ToList();

            Filtered.Clear();
            filtered.ForEach(x => Filtered.Add(x));
        }
Beispiel #2
0
        public void InitAccounts(ListBox list, string sorting)
        {
            try
            {
                Accounts.Clear();
                Filtered.Clear();
                SqlConnection con = new SqlConnection(conStrSQL);
                if (!sorting.Equals(""))
                {
                    sorting = String.Format(" ORDER BY {0}", sorting);
                }
                string comStr = "SELECT * " +
                                "FROM AccountTable " +
                                "WHERE username = '******' AND deleted = '0'" + sorting + ";";
                using (SqlCommand cmd = new SqlCommand(comStr, con))
                {
                    con.Open();
                    var reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Account acc = new Account
                        {
                            id         = Convert.ToInt32(reader["id"]),
                            Email      = reader["email"].ToString(),
                            Onlineuser = reader["onlineuser"].ToString(),
                            Password   = EncryptionHelper.Encrypt(reader["password"].ToString(), cryptokey),
                            Title      = reader["title"].ToString(),
                            Url        = reader["url"].ToString(),
                            marked     = reader["marked"].ToString().Equals("1")
                        };

                        Accounts.Add(acc);
                        Filtered.Add(acc);
                    }
                }
                con.Close();
                update(list);
            }
            catch (SqlException)
            {
                if (German)
                {
                    throw new Exception("Fehler beim Verbinden zur Datenbank!\n Versuchen Sie es in einer halben Stunde erneut, wenn Sie sich bis dahin noch immer nicht anmelden können, schreiben Sie ein Email an: [email protected]");
                }
                throw new Exception("An error accured while trying to connect to the database!\n Try to connect again in 30 minutes, if it won't work then contact us at: [email protected]");
            }
        }
 public void Clear()
 {
     Filtered.Clear();
 }