示例#1
0
        private void AuthButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (UserComboBox.SelectedItem is User currentUser)
                {
                    if (PasswordBox.Password == currentUser.Password)
                    {
                        WorkShift workShift = new WorkShift {
                            UserID = currentUser.ID, Datetime = DateTime.Now
                        };

                        DbHelper.GetContext().WorkShift.Add(workShift);
                        DbHelper.GetContext().SaveChanges();
                        OperatorForm operatorForm = new OperatorForm(currentUser);
                        operatorForm.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Неправильные логин или пароль!");
                    }
                }
                else
                {
                    MessageBox.Show("Выберите оператора!", "Внимание", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch
            {
            }
        }
示例#2
0
        private void barButtonOperator_ItemClick(object sender, ItemClickEventArgs e)
        {
            OperatorForm xform1 = new OperatorForm(_FlexSys)
            {
                MdiParent = this
            };

            xform1.Show();
        }