Ejemplo n.º 1
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            foreach (Window window in Application.Current.Windows)
            {
                if (window.GetType() == typeof(MainWindow))
                {
                    try {
                        RoutedEventArgs newEventArgs = new RoutedEventArgs(Button.ClickEvent);
                        int             index        = ListViewMenu.SelectedIndex;
                        MoveCursorMenu(index);

                        switch (index)
                        {
                        case 0:
                            (window as MainWindow).Grid_Main_UC.Children.Clear();
                            (window as MainWindow).Grid_Main_UC.Children.Add((window as MainWindow).UC_PatientDetails);

                            if ((window as MainWindow).MenuOpen == true)
                            {
                                (window as MainWindow).ButtonCloseMenu.RaiseEvent(newEventArgs);
                                (window as MainWindow).MenuOpen = false;
                            }
                            break;

                        case 1:
                            (window as MainWindow).Grid_Main_UC.Children.Clear();
                            (window as MainWindow).Grid_Main_UC.Children.Add((window as MainWindow).UC_PatientList);

                            if ((window as MainWindow).MenuOpen == true)
                            {
                                (window as MainWindow).ButtonCloseMenu.RaiseEvent(newEventArgs);
                                (window as MainWindow).MenuOpen = false;
                            }
                            break;

                        case 2:
                            (window as MainWindow).Grid_Main_UC.Children.Clear();
                            (window as MainWindow).Grid_Main_UC.Children.Add((window as MainWindow).UC_UserManagement);

                            if ((window as MainWindow).MenuOpen == true)
                            {
                                (window as MainWindow).ButtonCloseMenu.RaiseEvent(newEventArgs);
                                (window as MainWindow).MenuOpen = false;
                            }
                            break;
                        }
                    }
                    catch (Exception exc) {
                        CstmMsgBx.Error("A error occured in ListView_Menu_SelectionChanged");
                        Log.Error(Log.GetMethodName(), exc.ToString());
                    }
                }
            }
        }
        private void BtnRemoveEmplyoee_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            int index = ListViewEmployees.SelectedIndex;

            if (index != -1)
            {
                employeeList.RemoveAt(index);
                string sql = $"DELETE FROM employee where id = {index}";
                Database.RunSQL(sql);
                sql = $"DELETE FROM employee_login where id = {index}";
                Database.RunSQL(sql);
            }
            else
            {
                CstmMsgBx.Error("you need to select a employee");
            }
        }
        private void BtnEditPatient_Click(object sender, RoutedEventArgs e)
        {
            int index = ListViewPatient.SelectedIndex;

            if (index != -1)
            {
                var ep     = new PopUp.EditPatient(patientList[index]);
                var result = ep.ShowDialog();

                if (result == true)
                {
                    patientList[index] = ep.patient;
                    Database.RunSQL($"UPDATE patient set firstName = '{ep.patient.Firstname}', lastName = '{ep.patient.Lastname}', street = '{ep.patient.Street}', zipCode = '{ep.patient.Town}', dateOfBirth = '{ep.patient.Birthday}', phoneNumber = '{ep.patient.Phone}', healthInsurance = '{ep.patient.HealthInsurance}', insuranceNumber = '{ep.patient.InsuranceNumber}' WHERE id = {ep.patient.Id}");
                }
            }
            else
            {
                CstmMsgBx.Error("you need to select a patient");
            }
        }
Ejemplo n.º 4
0
        private void LoadLog(string filename)
        {
            try {
                logs.Clear();
                if (TxtBxLog.Text != "")
                {
                    TxtBxLog.Clear();
                }

                using (var reader = new StreamReader(filename)) {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        logs.Add(line);
                    }
                }
            }
            catch (Exception exc) {
                CstmMsgBx.Error("A error occured while trying to load logs");
                Log.Error(Log.GetMethodName(), exc.ToString());
            }
        }
Ejemplo n.º 5
0
        private void BtnClearLog_Click(object sender, RoutedEventArgs e)
        {
            try {
                string path = "";
                switch (CmbBx_Spelling.SelectedIndex)
                {
                case 0:
                    path = Log.GetPath("log.txt");
                    break;

                case 1:
                    path = Log.GetPath("log.err");
                    break;
                }

                System.IO.File.WriteAllText(path, string.Empty);
                TxtBxLog.Clear();
            }
            catch (Exception exc) {
                CstmMsgBx.Error("A error occured while trying to clear logs");
                Log.Error(Log.GetMethodName(), exc.ToString());
            }
        }