public static void UpdateAdminSettings(OSAEAdmin adSet) { try { foreach (var prop in adSet.GetType().GetProperties()) { using (MySqlConnection connection = new MySqlConnection(Common.ConnectionString)) { MySqlCommand command = new MySqlCommand(); command.Connection = connection; command.CommandText = "UPDATE osae_admin SET Value = '" + prop.GetValue(adSet, null) + "' WHERE ID = '" + prop.Name + "'"; connection.Open(); int x = command.ExecuteNonQuery(); connection.Dispose(); } } } catch { } }
//public static void UpdateAdminSettingsAll(string ScreenTrust, string ObjectsTrust, string AnalyticsTrust, string LogsTrust, string ValuesTrust, string ConfigTrust, string ManagementTrust, string ObjectTypeTrust, string ScriptTrust, string PatternTrust, string ReaderTrust, string ScheduleTrust, string ImagesTrust, string EventLogTrust, string MethodLogTrust, string ServerLogTrust, string DebugLogTrust, string defaultScreen) public static void UpdateAdminSettings(OSAEAdmin adSet) { try { foreach (var prop in adSet.GetType().GetProperties()) { using (MySqlConnection connection = new MySqlConnection(Common.ConnectionString)) { MySqlCommand command = new MySqlCommand(); command.Connection = connection; //command.CommandText = "UPDATE osae_admin SET ScreenTrust=" + ScreenTrust + ",ObjectsTrust=" + ObjectsTrust + ",AnalyticsTrust=" + AnalyticsTrust + ",LogsTrust=" + LogsTrust + ",ValuesTrust=" + ValuesTrust + ",ConfigTrust=" + ConfigTrust + ",ManagementTrust=" + ManagementTrust + ",ObjectTypeTrust=" + ObjectTypeTrust + ",ScriptTrust=" + ScriptTrust + ",PatternTrust=" + PatternTrust + ",ReaderTrust=" + ReaderTrust + ",ScheduleTrust=" + ScheduleTrust + ",ImagesTrust=" + ImagesTrust + ",EventLogTrust=" + EventLogTrust + ",MethodLogTrust=" + MethodLogTrust + ",ServerLogTrust=" + ServerLogTrust + ",DebugLogTrust=" + DebugLogTrust + ",defaultScreen='" + defaultScreen + "' WHERE primary_key = 1"; command.CommandText = "UPDATE osae_admin SET Value = '" + prop.GetValue(adSet, null) + "' WHERE ID = '" + prop.Name + "'"; connection.Open(); int x = command.ExecuteNonQuery(); connection.Dispose(); } } } catch { } }