コード例 #1
0
ファイル: MainWindowVM.cs プロジェクト: calebreed33/fetool
        private void onLoad()
        {
            foreach (string database in globalvariables.DatabaseLocations)
            {
                using (SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + database + ";Version=3;"))
                {
                    sqlite_connection.Open();

                    string sql = "select Recommendation,IA_Controls,Notes,Topic,PDI,Status,System_Name,V_Key,Cat,Discussion,Stig_ID from ComplianceEntries";
                    using (SQLiteCommand command = new SQLiteCommand(sql, sqlite_connection))
                    {
                        using (SQLiteDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                ComplianceEntry complianceEntry = new ComplianceEntry();
                                complianceEntry.System_name = reader["System_Name"] as string ?? "";
                                if (!System_names.Contains(reader["System_Name"] as string))
                                {
                                    System_names.Add(reader["System_Name"] as string);
                                }
                                if (!Stig_IDs.Contains((string)reader["Stig_ID"]))
                                {
                                    Stig_IDs.Add((string)reader["Stig_ID"]);
                                }
                                complianceEntry.V_key          = (string)reader["V_Key"];
                                complianceEntry.Stig_ID        = (string)reader["Stig_ID"];
                                complianceEntry.Cat            = (long)reader["Cat"];
                                complianceEntry.Status         = (string)reader["Status"];
                                complianceEntry.Discussion     = (string)reader["Discussion"];
                                complianceEntry.Pdi            = (string)reader["PDI"];
                                complianceEntry.Topic          = (string)reader["Topic"];
                                complianceEntry.Notes          = (string)reader["Notes"];
                                complianceEntry.Ia_controls    = (string)reader["IA_Controls"];
                                complianceEntry.Recommendation = (string)reader["Recommendation"];
                                this.ComplianceEntries.Add(complianceEntry);
                            }
                            Stig_IDs.Add("All Stigs");
                            System_names.Add("All Systems");

                            reader.Close();
                            sqlite_connection.Close();
                            command.Dispose();
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: MainWindowVM.cs プロジェクト: calebreed33/fetool
 public MainWindowVM()
 {
     this.ComplianceEntries = new ObservableCollection <ComplianceEntry>();
     this.System_names      = new ObservableCollection <string>();
     this.Stig_IDs          = new ObservableCollection <string>();
     this.Users             = new ObservableCollection <string>();
     this.Comments          = new ObservableCollection <string>();
     onLoad();
     Generate_Users();
     if (System_names.Count > 0)
     {
         SelectedSystem_Name = System_names.ElementAt(0);
     }
     if (Stig_IDs.Count > 0)
     {
         SelectedStig_ID = Stig_IDs.ElementAt(0);
     }
 }