Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string Name_con    = Name_condition.Text;
            string Surname_con = SurName_condition.Text;

            if (Name_con.Length == 0 && Surname_con.Length == 0)
            {
                MessageBox.Show("Wyplenij przynajmniej jedno z pol");
            }
            else if (Name_con.Length != 0 && Surname_con.Length == 0)
            {
                StudentGrid.ItemsSource = MenuLecturerLogic.getFreeStudentInSem(semester, selected_sec.ID_sekcji).Where(x => x.Name.Trim() == Name_con.Trim());
            }
            else if (Surname_con.Length != 0 && Name_con.Length == 0)
            {
                StudentGrid.ItemsSource = MenuLecturerLogic.getFreeStudentInSem(semester, selected_sec.ID_sekcji).Where(x => x.Surname.Trim() == Surname_con.Trim());
            }
            else if (Surname_con.Length != 0 && Name_con.Length != 0)
            {
                StudentGrid.ItemsSource = MenuLecturerLogic.getFreeStudentInSem(semester, selected_sec.ID_sekcji).Where(x => x.Surname.Trim() == Surname_con.Trim() && x.Name.Trim() == Name_con.Trim());
            }
            else
            {
                MessageBox.Show("Samfing is not yes :(");
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (mode == 0)
     {
         DataClassesDataContext context = new DataClassesDataContext();
         var upd = (from s in context.Subject where s.ID_Subject == subject.ID_Subject select s).Single();
         upd.Name        = s_name.Text;
         upd.Description = Desctrip.Text;
         upd.Status      = (bool)Availbe.IsChecked;
         context.SubmitChanges();
         this.Close();
     }
     if (mode == 1)
     {
         if (this.s_name.Text == "" || this.Desctrip.Text == "")
         {
             MessageBox.Show("Wypełnij wszystkie pola");
         }
         else
         {
             subject.Description = this.Desctrip.Text;
             subject.Name        = this.s_name.Text;
             subject.Status      = (bool)this.Availbe.IsChecked;
             bool IsAddGood = MenuLecturerLogic.addSubject(subject);
             if (!IsAddGood)
             {
                 MessageBox.Show("Nie udało sie dodac przedmiotu");
             }
             this.Close();
         }
     }
 }
Beispiel #3
0
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            string topic_field   = SecTopField.Text;
            bool   nonFull_field = (bool)NonFullField.IsChecked;
            var    tab           = MenuLecturerLogic.getSectionsWithCondition(semestr.ID_Semester, lecturer.ID_lecturer, topic_field, nonFull_field);

            sectionsgrid.ItemsSource = tab;
        }
Beispiel #4
0
 public SML_Stu_Add(Semester sems, MenuLecturerLogic.SectionDisplay selected_sec, int studentinsecnumber)
 {
     InitializeComponent();
     this.semester           = sems;
     this.selected_sec       = selected_sec;
     free_space              = selected_sec.Max_User - studentinsecnumber;
     StudentGrid.ItemsSource = MenuLecturerLogic.getFreeStudentInSem(semester, selected_sec.ID_sekcji);
 }
Beispiel #5
0
        public SML_Subject(Lecturer lecturer)
        {
            InitializeComponent();
            this.lecturer = lecturer;
            IEnumerable <MenuLecturerLogic.SubjectInfo> tab_s = MenuLecturerLogic.getAllSubjectList(lecturer.ID_lecturer);

            subject_grid.IsReadOnly  = true;
            subject_grid.ItemsSource = tab_s;
            //subject_grid
        }
Beispiel #6
0
        public SML_SectionManagement(Lecturer lecturer, Semester sem)
        {
            InitializeComponent();

            this.lecturer         = lecturer;
            this.semestr          = sem;
            StuSecGrid.IsReadOnly = true;

            sectionsgrid.IsReadOnly  = true;
            sectionsgrid.ItemsSource = MenuLecturerLogic.getSectionsWithCondition(sem.ID_Semester, lecturer.ID_lecturer, "", false);
        }
Beispiel #7
0
        private void topicGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selected_sec = (MenuLecturerLogic.SectionDisplay)topicGrid.SelectedItem;

            if (selected_sec == null)
            {
                return;
            }
            int sec_id = selected_sec.ID_sekcji;

            membersgrid.ItemsSource = MenuLecturerLogic.getStudentInSection(sec_id);
        }
        private void OpenWindow(object sender, RoutedEventArgs e)
        {
            /*SelectionMenuAdmin objSMA = new SelectionMenuAdmin();
             * this.Visibility = Visibility.Hidden;
             * objSMA.Show();
             */

            log_t = login_text.Text;
            if (login_text.Text == "" || password_text.Password == "")
            {
                MessageBox.Show("Uzupełnij pola login oraz hasło!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                string role;
                int    id;

                bool access = Login.login(login_text.Text, password_text.Password, out role, out id);
                role = role.Trim(' ');
                if (access)
                {
                    if (role == "admin")
                    {
                        SelectionMenuAdmin admin_window = new SelectionMenuAdmin();
                        admin_window.Show();
                    }
                    else if (role == "student")
                    {
                        Student stu = MenuStudentLogic.getStudentInfo(id);
                        SelectionMenuStudent student_window = new SelectionMenuStudent(stu);
                        student_window.Show();
                    }
                    else if (role == "lecturer")
                    {
                        Lecturer lectu = MenuLecturerLogic.getLectuterData(id);
                        // MessageBox.Show(lectu.Surname);
                        SelectionMenuLecturer lecturer_window = new SelectionMenuLecturer(lectu);
                        lecturer_window.Show();
                    }
                    else
                    {
                        MessageBox.Show("Samfing is not yes!");
                    }
                }
                else
                {
                    MessageBox.Show("Błędne dane logowania!");
                }
            }
        }
Beispiel #9
0
        public SML_SecMan_SecAdd(Lecturer lecturer, Semester semester)
        {
            InitializeComponent();
            this.lecturer = lecturer;
            this.semester = semester;

            var sub_list = MenuLecturerLogic.getSubjectList(lecturer.ID_lecturer).ToList();
            List <Tuple <int, string> > topic_list = new List <Tuple <int, string> >();

            foreach (var rec in sub_list)
            {
                topic_list.Add(Tuple.Create(rec.Id, rec.Name.Trim()));
            }
            Topiccombobox.ItemsSource = topic_list;
        }
Beispiel #10
0
        private void sectionsgrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var select_row = (MenuLecturerLogic.SectionDisplay)sectionsgrid.SelectedItem;

            if (select_row == null)
            {
                return;
            }
            else
            {
                int seleted_secId = select_row.ID_sekcji;
                max_user = select_row.Max_User;
                var tab_source = MenuLecturerLogic.getStudentInSection(seleted_secId);
                StuSecGrid.ItemsSource = tab_source;
            }
        }
Beispiel #11
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            var selected_student = StuSecGrid.SelectedItems;
            List <MenuLecturerLogic.StudentDisplay> stud_list = new List <MenuLecturerLogic.StudentDisplay>();

            foreach (var i in selected_student)
            {
                var single_stud = (MenuLecturerLogic.StudentDisplay)i;
                stud_list.Add(single_stud);
            }
            if (selected_student.Count == 0)
            {
                MessageBox.Show("Wybierz studentów");
                return;
            }
            MenuLecturerLogic.removeStudents(stud_list);
        }
Beispiel #12
0
        public SMA_add(int mode)
        {
            InitializeComponent();
            this.mode = mode;
            if (mode == 1)
            {
                Degree_label.Visibility  = Visibility.Hidden;
                Degree_choose.Visibility = Visibility.Hidden;
                Sem_label.Visibility     = Visibility.Hidden;
                Sem_choose.Visibility    = Visibility.Hidden;
            }
            else if (mode == 2)
            {
                Sem_label.Visibility  = Visibility.Hidden;
                Sem_choose.Visibility = Visibility.Hidden;
            }
            else if (mode == 3)
            {
                Degree_label.Visibility  = Visibility.Hidden;
                Degree_choose.Visibility = Visibility.Hidden;
            }
            List <Tuple <int, string, string> > semsetrInfoList = new List <Tuple <int, string, string> >();

            IQueryable <SemsestrInfo> stb = MenuLecturerLogic.getSemestrInfo();

            stb.ToList();
            foreach (var rec in stb)
            {
                semsetrInfoList.Add(Tuple.Create(rec.semestrid, rec.fieldofstudy.Trim(), rec.yearofstudy));
            }
            Sem_choose.ItemsSource = semsetrInfoList;

            ObservableCollection <string> list = new ObservableCollection <string>();

            list.Add("Inż");
            list.Add("Mgr.");
            list.Add("Dr.");
            list.Add("Prof");
            Degree_choose.ItemsSource = list;
        }
        public SelectionMenuLecturer(Lecturer lecturer)
        {
            InitializeComponent();
            List <Tuple <int, string, string> > semsetrInfoList = new List <Tuple <int, string, string> >();

            IQueryable <SemsestrInfo> stb = MenuLecturerLogic.getSemestrInfo();

            stb.ToList();
            foreach (var rec in stb)
            {
                semsetrInfoList.Add(Tuple.Create(rec.semestrid, rec.fieldofstudy.Trim(), rec.yearofstudy));
            }

            fieldofstudybox.ItemsSource = semsetrInfoList;

            /* this.lecturer = new Lecturer();
             * this.lecturer.ID_lecturer = lecturer.ID_lecturer;
             * this.lecturer.Name = lecturer.Name;
             * this.lecturer.Surname = lecturer.Surname;
             * this.lecturer.Degree = lecturer.Degree;
             */
            this.lecturer = lecturer;
        }
Beispiel #14
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Tuple <int, string> selected_sub = (Tuple <int, string>)Topiccombobox.SelectedItem;

            if (selected_sub == null)
            {
                MessageBox.Show("Wybierz temat");
                return;
            }

            string capa         = Capacity_field.Text;
            bool   capaIsNumber = true;

            for (int i = 0; i < capa.Length; i++)
            {
                if (!char.IsDigit(capa, i))
                {
                    MessageBox.Show("Rozmiar sekcji nie jest liczbą");
                    capaIsNumber = false;
                    break;
                }
            }
            if ((selected_sub != null) || (!capaIsNumber))
            {
                int capa_numb = Int32.Parse(capa);
                database_layer.Section sec = new database_layer.Section();
                sec.ID_Semester = semester.ID_Semester;
                sec.Max_user    = (short)capa_numb;
                sec.ID_Subject  = (short)selected_sub.Item1;
                DataClassesDataContext context = new DataClassesDataContext();
                var s = context.Section.OrderByDescending(se => se.ID_Section).FirstOrDefault();
                sec.ID_Section = (short)(s.ID_Section + 1);
                MenuLecturerLogic.addSection(sec);
            }
            this.Close();
        }
Beispiel #15
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var selected_student = StuSecGrid.SelectedItems;
            List <MenuLecturerLogic.StudentDisplay> stud_list = new List <MenuLecturerLogic.StudentDisplay>();

            foreach (var i in selected_student)
            {
                var single_stud = (MenuLecturerLogic.StudentDisplay)i;
                stud_list.Add(single_stud);
            }
            if (selected_student.Count == 0)
            {
                MessageBox.Show("Wybierz studentów");
                return;
            }
            if ((Degree_field.Text.Length != 1) || !(char.IsDigit(Degree_field.Text.ElementAt(0))) || (Int32.Parse(Degree_field.Text)) > 6)
            {
                MessageBox.Show("Błędna ocena");
                return;
            }
            int degree = Int32.Parse(Degree_field.Text);

            MenuLecturerLogic.addDegree(stud_list, degree);
        }
 public SML_Presence(int sec_id)
 {
     InitializeComponent();
     presencegrid.ItemsSource = MenuLecturerLogic.getPresenceofSection(sec_id);
 }