Beispiel #1
0
        private async void loginCode_GoClick(object sender, RoutedEventArgs e)
        {
            string code;

            try
            {
                code = loginCode.InputValue;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Incorrect input!");
                return;
            }

            try
            {
                loginCode.ButtonGoAbleState(false);
                if (_typeshow == 1)//login
                {
                    await Async("", "", code, null);

                    setControl(true);
                }
                else if (_typeshow == 2)//view
                {
                    EmployeeDetail ed = new EmployeeDetail(_emplog.Emp.Username, _cloudPosUnitofwork);
                    ed.ShowDialog();
                    setControl(true);
                }
                else if (_typeshow == 3)//logout
                {
                    await Async("", "", code, _emplog);

                    setControl(true);
                }
                else if (_typeshow == 4)//start
                {
                    if (_emplog.Emp.DecryptedCode.Equals(code))
                    {
                        App.Current.Properties["CurrentEmpWorking"] = _emplog;
                        _cUser.Content = (App.Current.Properties["CurrentEmpWorking"] as EmpLoginList).Emp.Username;
                        setControl(true);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Login fail Employee's code is not correct!");
                    }
                }

                loginCode.ButtonGoAbleState(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #2
0
        private void btnAcceptView_Click(object sender, RoutedEventArgs e)
        {
            if (!_emplog.Emp.DecryptedPass.Equals(txtPass.Password.Trim()))
            {
                MessageBox.Show("Login fail! Please try again!");
                return;
            }

            EmployeeDetail ed = new EmployeeDetail(_emplog.Emp.Username, _cloudPosUnitofwork);

            ed.ShowDialog();

            setControl(true);
        }
Beispiel #3
0
        private async void txtPass_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (_typeshow == 1)
                {
                    string username = txtUsername.Text.Trim();
                    string pass     = txtPass.Password.Trim();
                    try
                    {
                        btnAcceptLogin.IsEnabled   = false;
                        PgbLoginProcess.Visibility = Visibility.Visible;
                        await Async(username, pass, "", null);

                        btnAcceptLogin.IsEnabled   = true;
                        PgbLoginProcess.Visibility = Visibility.Collapsed;

                        lvLoginList.ItemsSource = EmpLoginListData.emploglist;
                        lvLoginList.Items.Refresh();

                        setControl(true);

                        if (App.Current.Properties["CurrentEmpWorking"] != null)
                        {
                            _cUser.Content = (App.Current.Properties["CurrentEmpWorking"] as EmpLoginList).Emp.Username;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                else if (_typeshow == 2)
                {
                    if (!_emplog.Emp.DecryptedPass.Equals(txtPass.Password.Trim()))
                    {
                        MessageBox.Show("Login fail! Please try again!");
                        return;
                    }

                    EmployeeDetail ed = new EmployeeDetail(_emplog.Emp.Username, _cloudPosUnitofwork);
                    ed.ShowDialog();

                    setControl(true);
                }
                else if (_typeshow == 3)
                {
                    if (!_emplog.Emp.DecryptedPass.Equals(txtPass.Password.Trim()))
                    {
                        MessageBox.Show("Fail! Please try again!");
                        return;
                    }

                    try
                    {
                        btnAcceptLogout.IsEnabled  = false;
                        PgbLoginProcess.Visibility = Visibility.Visible;
                        await Async("", "", "", _emplog);

                        btnAcceptLogout.IsEnabled  = true;
                        PgbLoginProcess.Visibility = Visibility.Collapsed;

                        lvLoginList.ItemsSource = EmpLoginListData.emploglist;
                        lvLoginList.Items.Refresh();

                        setControl(true);

                        if (App.Current.Properties["CurrentEmpWorking"] != null)
                        {
                            _cUser.Content = (App.Current.Properties["CurrentEmpWorking"] as EmpLoginList).Emp.Username;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                else if (_typeshow == 4)
                {
                    if (!_emplog.Emp.DecryptedPass.Equals(txtPass.Password.Trim()))
                    {
                        MessageBox.Show("Login fail! Please try again!");
                        return;
                    }

                    App.Current.Properties["CurrentEmpWorking"] = _emplog;
                    _cUser.Content = (App.Current.Properties["CurrentEmpWorking"] as EmpLoginList).Emp.Username;

                    this.Close();
                }
            }
        }