Example #1
0
 public static void RunSQL(string sql)
 {
     try
     {
         db_connect.Open();
         connectionIsOpen = true;
         command          = new SQLiteCommand(sql, db_connect);
         command.ExecuteNonQuery();
         db_connect.Close();
     }
     catch (SQLiteException a)
     {
         if (a.ErrorCode == 2067)
         {
             CstmMsgBx.Error("Name ist bereits vergeben");
             CheckConnectionStatus();
         }
     }
     catch (Exception exc)
     {
         CstmMsgBx.Error(exc.ToString());
         Log.Error(Log.GetMethodName(), exc.ToString());
         CheckConnectionStatus();
     }
 }
Example #2
0
        private void Btn_AddNote_Click(object sender, RoutedEventArgs e)
        {
            if (TxtBx_Name.Text == "")
            {
                MissingValue("Bitte tragen Sie einen Titel ein");
            }
            else
            {
                if (ListView_Projects.SelectedIndex != -1)
                {
                    //RunSQL($"INSERT INTO Notes (title) VALUES ('{TxtBx_Name.Name}')");
                    Objects.MyTreeViewItem art = new Objects.MyTreeViewItem();
                    art.Header = TxtBx_Name.Text;
                    art.Index  = 1;

                    Objects.MyTreeViewItem prt = new Objects.MyTreeViewItem();
                    prt.Header = TxtBx_Name.Text;
                    prt.Index  = 2;

                    TreeView_Note.Items.Add(art);
                }
                else
                {
                    CstmMsgBx.Error("Es wurde kein Projekt ausgewählt");
                }
            }
        }
Example #3
0
 public static void TestConnection()
 {
     try
     {
         db_connect.Open();
         db_connect.Close();
         CstmMsgBx.Show("Database connect successfully");
     }
     catch (Exception exc)
     {
         CstmMsgBx.Error(exc.ToString(), 4000);
     }
 }
Example #4
0
 private void RunSQL(string SQL)
 {
     try
     {
         Database.RunSQL(SQL);
         TxtBx_Name.Background = Brushes.White;
         TxtBx_Name.Text       = "";
     }
     catch (Exception exc)
     {
         CstmMsgBx.Error(exc.ToString());
         Log.Error(Log.GetMethodName(), exc.ToString());
     }
 }
Example #5
0
 private static void OnTimeEvent(object source, EventArgs e)
 {
     try
     {
         foreach (Window window in Application.Current.Windows)
         {
             if (window.GetType() == typeof(MainWindow))
             {
                 (window as MainWindow).Snackbar_MessageBox.IsActive = false;
             }
         }
         Timer.Stop();
     }
     catch (Exception exc)
     {
         CstmMsgBx.Error("A error occurred in CstmMsgBx.OnTimeEvent()");
         Log.Error(Log.GetMethodName(), exc.ToString());
     }
 }
Example #6
0
        public static void Error(string Function = "", string Message = "")
        {
            try
            {
                string filename  = "log.err";
                string path      = GetPath(filename);
                string timestamp = DateTime.UtcNow.ToString("dd:MM:yyyy HH:mm:ss.fff", CultureInfo.InvariantCulture);

                string log = $"{Function}     -     {Message}\n---------------------------------------------------------------------------------------";
                using (StreamWriter sw = File.AppendText(path))
                    Write(timestamp, log, sw);
            }
            catch
            {
                CstmMsgBx.Error("Couldn´t write to log file");
                System.Threading.Thread.Sleep(5000);
                Application.Current.Shutdown();
            }
        }
Example #7
0
 private void Btn_AddMeeting_Click(object sender, RoutedEventArgs e)
 {
     if (TxtBx_Name.Text == "")
     {
         MissingValue("Bitte tragen Sie einen Titel ein");
     }
     else
     {
         if (ListView_Projects.SelectedIndex != -1)
         {
             //RunSQL($"INSERT INTO Notes (title) VALUES ('{TxtBx_Name.Name}')");
             TreeView_Meetings.Items.Add(TxtBx_Name.Text);
         }
         else
         {
             CstmMsgBx.Error("Es wurde kein Projekt ausgewählt");
         }
     }
 }
Example #8
0
        private void TextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            var name = TreeView.SelectedItem.ToString();

            CstmMsgBx.Show(name.ToString());
        }
Example #9
0
 private void MissingValue(string message)
 {
     CstmMsgBx.Error(message);
     TxtBx_Name.Background = (SolidColorBrush) new BrushConverter().ConvertFromString("#ff3232");
 }