Ejemplo n.º 1
0
        private void client_LoginCompleted(object sender, LoginCompletedEventArgs e)
        {
            ClientInstance.HideSpinner();

            Logger.Instance().Log(MessageType.Information, "Login Completed");
            if (ErrorHandler.Handle(e.Error))
            {
                passwordTxtBox.Password = string.Empty;
                userNameTxtBox.Focus();
                userNameTxtBox.SelectAll();
                return;
            }

            Employee employee = new Employee();

            if (e.Result != null)
            {
                employee = (Employee)e.Result;
                string aesPassword = CryptographyStuff.AES_DecryptString(employee.Password);
                employee.Password = aesPassword;
                User currentUser = new User(employee);
                this.Content = new Main(currentUser);
            }
            else
            {
                Logger.Instance().Log(MessageType.Error, "Result is NULL");
            }
        }
Ejemplo n.º 2
0
        private void FillData(System.Collections.ObjectModel.ObservableCollection <LeaveInfo> observableCollection)
        {
            List <LeaveInfo> leaveInfos = (List <LeaveInfo>)observableCollection.ToList <LeaveInfo>();

            source.Clear();
            for (int i = 0; i < leaveInfos.Count; i++)
            {
                LeaveInfo li   = (LeaveInfo)leaveInfos[i];
                LeaveItem item = new LeaveItem(li);
                item.Submitter = li.Submitter.FirstName + " " + li.Submitter.LastName;
                //item.Index = (i + 1);
                source.Add(item);
            }

            records.ItemsSource = null;
            records.ItemsSource = source;

            int selectIndex = -1;

            for (int i = 0; i < source.Count; i++)
            {
                if (source[i].LeaveInfo.PKLeaveInfoID == currentGUID)
                {
                    selectIndex = i;
                }
            }

            records.SelectedIndex = selectIndex;

            ClientInstance.HideSpinner();
        }
Ejemplo n.º 3
0
 void records_LoadingRow(object sender, DataGridRowEventArgs e)
 {
     loadingRow++;
     if (loadingRow == source.Count)
     {
         ClientInstance.HideSpinner();
         records.LoadingRow -= new EventHandler <DataGridRowEventArgs>(records_LoadingRow);
     }
 }
Ejemplo n.º 4
0
        private void client_AddEmployeeCompleted(object sender, AddEmployeeCompletedEventArgs e)
        {
            ClientInstance.HideSpinner();

            Logger.Instance().Log(MessageType.Information, "Add Employee Completed");
            if (ErrorHandler.Handle(e.Error))
            {
                return;
            }

            Message.Information("Done! Check your email to get your default password. Don't forget to change your default password when you login CARS.");
            backButton_Click(backButton, new RoutedEventArgs());
        }
Ejemplo n.º 5
0
        private void client_GetManagersCompleted(object sender, GetManagersCompletedEventArgs e)
        {
            Logger.Instance().Log(MessageType.Information, "Get Managers Completed");
            if (ErrorHandler.Handle(e.Error))
            {
                return;
            }

            List <Employee> managers = new List <Employee>();

            if (e.Result != null)
            {
                managers = ((ObservableCollection <Employee>)e.Result).ToList <Employee>();
            }
            else
            {
                Logger.Instance().Log(MessageType.Error, "Result is NULL");
            }

            supervisor.Items.Clear();
            foreach (Employee manager in managers)
            {
                User userManager = new User(manager);
                if (userManager.IsActive)
                {
                    supervisor.Items.Add(userManager);
                }
            }

            SetPage();

            if (currentPage == CARSPage.PersonalInfo)
            {
                UpdateUserInfomation(true);
            }
            else if (currentPage == CARSPage.EmployeeInfo)
            {
                UpdateUserInfomation(false);
            }

            ClientInstance.HideSpinner();
        }