private void The_class_letter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int    theClassName   = (int)The_class_name.SelectedValue;
            string theClassLetter = (string)The_class_letter.SelectedValue;

            curClass = unitOfWork.TheClasses.GetTheClassByFullName(theClassName + " " + theClassLetter);
        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            TheClasses TheClass = new TheClasses();

            TheClass.TheClass    = (int)The_class_name.SelectedValue;
            TheClass.ClassLetter = (string)The_class_letter.SelectedValue;

            if (The_class_letter.SelectedValue == null)
            {
                MessageBox.Show("Пожалуйста, выберите другой класс!");
                return;
            }


            using (var unitOfWork = UnitOfWork.GetInstance())
            {
                unitOfWork.TheClasses.Create(TheClass);
                unitOfWork.Save();
            }

            The_class_letter.ItemsSource   = TheClassesInteraction.GetTheClassesLettersByName((int)The_class_name.SelectedValue);
            The_class_letter.SelectedIndex = -1;

            MessageBox.Show("Новый класс был успешно добавлен!");
            this.Close();
        }
Ejemplo n.º 3
0
        public UserPage(MainWindow _mainWindow, User _user)
        {
            InitializeComponent();


            mainWindow = _mainWindow;
            user       = _user;

            TheClasses Class = mainWindow.unitOfWork.TheClasses.GetTheClassById(user.TheClassesId.Value, mainWindow);

            User_class_label.Content = Class.TheClass.ToString() + "-ого " + Class.ClassLetter;
            User_name_label.Content  = user.LastName + " " + user.FirstName + " " + user.MiddleName;
            Number_label.Content     = user.Phone;

            if (mainWindow.user.Id != _user.Id)
            {
                Upload_image.Visibility = Visibility.Hidden;
            }

            if (string.IsNullOrEmpty(user.ImagePath) == false)
            {
                imgPicture.Source = new BitmapImage(new Uri(user.ImagePath));
            }

            if (mainWindow.user.Id != user.Id)
            {
                Admin_Button.Visibility = Visibility.Hidden;
            }
        }
Ejemplo n.º 4
0
        private void Events_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                StackPanel seletedItem;
                seletedItem = (StackPanel)e.AddedItems[0];

                string subject = ((TextBlock)seletedItem.Children[3]).Text;
                if (subject == "Предмет" || subject.Length == 0)
                {
                    return;
                }

                int SubjectId    = unitOfWork.Subjects.GetSubjectId(subject);
                int LessonNumber = Int32.Parse(((TextBlock)seletedItem.Children[0]).Text);

                string     classDescription = ((TextBlock)seletedItem.Children[2]).Text;
                TheClasses curClass         = unitOfWork.TheClasses.GetTheClassByFullName(classDescription);

                var timeTableModel = TimeTableInteraction.GetTimeTableModel(LessonNumber, SubjectId, curClass.Id);

                mainWindow.Navigation.Navigate(new SubjectMarks(mainWindow, timeTableModel));
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
                return;
            }
        }
        private void The_class_name_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            The_class_letter.ItemsSource   = unitOfWork.TheClasses.GetTheClassesLetters((int)comboBox.SelectedValue);
            The_class_letter.SelectedIndex = 0;

            int    theClassName   = (int)The_class_name.SelectedValue;
            string theClassLetter = (string)The_class_letter.SelectedValue;

            curClass = unitOfWork.TheClasses.GetTheClassByFullName(theClassName + " " + theClassLetter);
        }
Ejemplo n.º 6
0
        public TheClassPage(MainWindow _mainWindow, User _user)
        {
            InitializeComponent();
            unitOfWork = UnitOfWork.GetInstance();

            mainWindow = _mainWindow;
            user       = _user;
            TheClasses Class = unitOfWork.TheClasses.GetTheClassById(user.TheClassesId.Value);

            Class_label.Content = Class.TheClass.ToString() + " " + Class.ClassLetter;
            UpdateStackPanel();
        }
Ejemplo n.º 7
0
        public SubjectMarks(MainWindow _mainWindow, Timetable timeTableModel)
        {
            InitializeComponent();
            unitOfWork = UnitOfWork.GetInstance();
            DatesRow   = new List <string>();

            mainWindow   = _mainWindow;
            curTimeTable = timeTableModel;

            TheClasses TheClass = unitOfWork.TheClasses.GetTheClassById(timeTableModel.ClassId);

            the_class_name = TheClass.TheClass.ToString() + " " + TheClass.ClassLetter;
            subject_name   = unitOfWork.Subjects.GetSubjectName(timeTableModel.SubjectId);

            class_name.Content = the_class_name;
            subject.Content    = subject_name;

            InitColumns(20);

            DataContext = new Application(timeTableModel.ClassId, mainWindow);
        }
Ejemplo n.º 8
0
        public static List <StackPanel> GetStackPanelListForTeacher(string day, int teacher_id)
        {
            List <StackPanel> list         = new List <StackPanel>();
            List <string>     timeTemplate = GetTimeTemplate();

            for (int i = 0; i < 7; i++)
            {
                StackPanel stackPanel = new StackPanel();

                TextBlock idBlock = new TextBlock();
                idBlock.Width = 25;
                idBlock.Text  = (i + 1).ToString();

                TextBlock timeBlock = new TextBlock();
                timeBlock.Width = 100;
                timeBlock.Text  = timeTemplate[i];

                TextBlock classBlock = new TextBlock();
                classBlock.Width = 65;
                TheClasses Class = GetClassForTeacher(day, teacher_id, i + 1);
                if (Class != null)
                {
                    classBlock.Text = Class.TheClass + " " + Class.ClassLetter;
                }
                else
                {
                    classBlock.Text = "";
                }

                Timetable curTimeTable = null;
                if (Class != null)
                {
                    curTimeTable = GetTimeTableForUser(day, Class.Id, i + 1);
                }

                TextBlock subjectBlock = new TextBlock();
                subjectBlock.Width = 130;

                var unitOfWork = UnitOfWork.GetInstance();

                if (Class != null && curTimeTable != null)
                {
                    subjectBlock.Text = unitOfWork.Subjects.GetSubjectName(curTimeTable.SubjectId);
                }
                else
                {
                    subjectBlock.Text = "";
                }


                TextBlock cabBlock = new TextBlock();
                cabBlock.Text = " - ";

                stackPanel.Children.Add(idBlock);
                stackPanel.Children.Add(timeBlock);
                stackPanel.Children.Add(classBlock);
                stackPanel.Children.Add(subjectBlock);
                stackPanel.Children.Add(cabBlock);

                stackPanel.Orientation = Orientation.Horizontal;
                list.Add(stackPanel);
            }


            return(list);
        }