Пример #1
0
        public AddMark(Student student, StudentWindow studentWindow)
        {
            InitializeComponent();

            Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;

            this.student = student;
            this.studentWindow = studentWindow;
        }
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (ESchoolDiary.Validation.IsEmpty(txtBoxID.Text) || ESchoolDiary.Validation.IsEmpty(txtBoxPassword.Password))
            {
                MessageBox.Show("Invalid username or password! Fields cannot be empty.");
            }
            else
            {
                ESchoolDiary.Student student = ESchoolDiary.DataEngine.GetStudent(txtBoxID.Text);

                if (student != null && student.Password == txtBoxPassword.Password)
                {
                    studentWindow = new StudentWindow();

                    HideButtons();
                    studentWindow.LoadStudent(student);
                    studentWindow.Show();
                    studentWindow.Visibility = Visibility.Visible;
                    ClearText();
                }
                else if (ESchoolDiary.Headmaster.Instance.Pin.ToString() == txtBoxID.Text && ESchoolDiary.Headmaster.Instance.Password == txtBoxPassword.Password)
                {
                    RegistrationChoice regChoiceWindow = new RegistrationChoice();

                    regChoiceWindow.Show();
                    regChoiceWindow.Visibility = Visibility.Visible;

                    ClearText();
                }
                else if (txtBoxPassword.Password.Length == 4)
                {
                    Teacher teacher = DataEngine.GetTeacher(txtBoxID.Text);

                    studentWindow = new StudentWindow();

                    studentWindow.btnChangePwd.Visibility = Visibility.Hidden;
                    studentWindow.btnDelete.Visibility = Visibility.Hidden;
                    studentWindow.Show();
                    studentWindow.Visibility = Visibility.Visible;
                    studentWindow.btnAddNote.Visibility = Visibility.Hidden;
                    studentWindow.btnAddMark.Visibility = Visibility.Hidden;
                    studentWindow.lblStudentName.Content = String.Format("{0} {1}, Teacher", teacher.FirstName, teacher.LastName);

                    ClearText();
                }
                else
                {
                    MessageBox.Show("Invalid username or password.");
                }
            }
        }
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            foreach (Student student in ESchoolDiaryData.Students)
            {
                if (txtBoxSearch.Text == student.Pin.ToString())
                {
                    StudentWindow studentWindow = new StudentWindow();
                    studentWindow.LoadStudent(student);
                    studentWindow.Show();
                    studentWindow.Visibility = Visibility.Visible;
                    studentWindow.btnChangePwd.Visibility = System.Windows.Visibility.Hidden;
                    studentWindow.btnLogout.Content = "Back";
                    txtBoxSearch.Text = "";

                    break;
                }
                else
                {
                    MessageBox.Show("Nobody found with such credentials.");
                }
            }
        }
Пример #4
0
 public AddNote(Student student, StudentWindow studentWindow)
 {
     InitializeComponent();
     this.student = student;
     this.studentWindow = studentWindow;
 }