예제 #1
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (chkActiveDirectory.IsChecked == true)
                {
                    ADUser = new ActiveDirectoryEmployee(txtUsername.Text, txtPassword.Password);
                    bool isAuthorised = ADUser.AuthenticateUser();

                    if (isAuthorised == true)
                    {
                        Global.ADUser = ADUser.ADPrincipal;
                        string type = "";
                        if (ADUser.ADPrincipal.IsAdministrator == true)
                        {
                            type = "Administrator - " + txtUsername.Text;
                        }
                        if (ADUser.ADPrincipal.IsEmployee == true)
                        {
                            type = "Employee - " + txtUsername.Text;
                        }
                        if (ADUser.ADPrincipal.IsTechnician == true)
                        {
                            type = "Technician - " + txtUsername.Text;
                        }
                        Task.Run(() => {
                            SystemLogins systemLogins = new SystemLogins(Guid.NewGuid(), ADUser.ADPrincipal.GUID ?? Guid.NewGuid(), DateTime.UtcNow, type, failedCount);
                            systemLogins.insertLogin();
                        }).ConfigureAwait(false);

                        NavigationService.NavigateTo(new MainScreen());
                    }
                    else
                    {
                        // Error Message
                        MessageBox.Show("Incorrect Credentials");
                        failedCount++;
                    }
                }
                else
                {
                    if (txtUsername.Text.Equals("letmein"))
                    {
                        Global.ADUser = new ActiveDirectoryEmployee("1234", "Marno van Niekerk", "*****@*****.**", true, Guid.NewGuid(), "Marno", "van Niekerk", DateTime.UtcNow, false, false, true);
                        NavigationService.NavigateTo(new MainScreen());
                    }
                    else
                    {
                        MessageBox.Show("Incorrect Credentials");
                        failedCount++;
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorHandler.ErrorHandle error = ErrorHandler.ErrorHandle.getInstance();
                error.handle(exception, true);
            }
        }
예제 #2
0
        public Dictionary <ActiveDirectoryEmployee, AppointmentPriority> getAllActiveTechniciansWithAppointment()
        {
            Dictionary <ActiveDirectoryEmployee, AppointmentPriority> activeTechnicians = new Dictionary <ActiveDirectoryEmployee, AppointmentPriority>();

            ActiveDirectoryEmployee ADTechnician = new ActiveDirectoryEmployee();

            AppointmentList            appointmentPriority     = new AppointmentList();
            List <AppointmentPriority> appointmentPriorityList = appointmentPriority.getAllActiveAppointments();

            foreach (AppointmentPriority appointment in appointmentPriorityList)
            {
                ADTechnician = ADTechnician.getSpecificTechnician(appointment.TechnicianGuid);
                activeTechnicians.Add(ADTechnician, appointment);
            }

            return(activeTechnicians);
        }
 public TechnicianDBInfo(int totalAppointments, ActiveDirectoryEmployee adTechnician)
 {
     this.totalAppointments = totalAppointments;
     this.adTechnician      = adTechnician;
 }