Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();
            this.KeyDown += (a, b) => 
            {
                if (b.Key == Key.Enter)
                    btnLogin_Click(null, null);
            };
            lblAdministration.Foreground = Brushes.CornflowerBlue;            

            Settings = new Settings(false);

            LoadHistory();
        }
Beispiel #2
0
        public static void SaveCashpointSettings(Settings settings)
        {
            try
            {
                string query = "DELETE Config WHERE Name != 'BackupDestination' AND Name != 'LiveViewEndpoint';";
                query += "INSERT INTO Config (Name, Value) VALUES ('DoPrint', '" + settings.Cashpoint.DoPrint.ToString() + "');";
                query += "INSERT INTO Config (Name, Value) VALUES ('HoldLogoutDuration', '" + settings.Cashpoint.HoldLogoutDuration + "');";
                query += "INSERT INTO Config (Name, Value) VALUES ('IsEnabled', '" + settings.Cashpoint.IsEnabled.ToString() + "');";
                query += "INSERT INTO Config (Name, Value) VALUES ('IsServiceMode', '" + settings.Cashpoint.IsServiceMode.ToString() + "');";
                query += "INSERT INTO Config (Name, Value) VALUES ('OrganizationName', '" + settings.Cashpoint.OrganizationName.ToString() + "');";
                query += "INSERT INTO Config (Name, Value) VALUES ('AutoRefresh', '" + (settings.Cashpoint.IsAutoRefreshEnabled == true ? "Auto" : "Manual") + "');";
                query += "INSERT INTO Config (Name, Value) VALUES ('AutoRefreshInterval', '" + settings.Cashpoint.AutoRefreshInterval.ToString() + "');";   

                SqlConnection connection = new SqlConnection(ConnectionString);
                SqlCommand cmd = new SqlCommand(query, connection);
                connection.Open();
                cmd.ExecuteNonQuery();
                connection.Close();
            }
            catch (Exception ex)
            {
                string errmsg = "Fehler beim Speichern der Kasseneinstellungen.\n\n";
                errmsg += "DatabaseHandler.SaveCashpointSettings(settings): " + ex.ToString();
                throw new Exception(errmsg);
            }
        }
Beispiel #3
0
        public static void LoadCashpointSettings(Settings settings)
        {
            Dictionary<string, object> values = new Dictionary<string, object>();

            try
            {
                SqlConnection connection = new SqlConnection(ConnectionString);
                SqlCommand cmd = new SqlCommand("SELECT * FROM Config", connection);
                connection.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    values.Add(reader["Name"].ToString(), reader["Value"]);
                }
                connection.Close();

                settings.Cashpoint.Initialize(values);
            }
            catch (Exception ex)
            {
                string errmsg = "Fehler beim Abrufen Kasseneinstellungen.\n\n";
                errmsg += "DatabaseHandler.LoadCashpointSettings(settings): " + ex.ToString();
                throw new Exception(errmsg);
            }
        }