Esempio n. 1
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            string command = SearchCommand.Text;

            listviewCollection.Clear();

            foreach (JObject student in students)
            {
                if (student["number"].ToString().Contains(command) ||
                    student["name"].ToString().Contains(command) ||
                    student["good_point"].ToString().Contains(command) ||
                    student["bad_point"].ToString().Contains(command))
                {
                    listviewCollection.Add(new ViewModel.StudentListViewModel(
                                               id: student["id"].ToString(),
                                               classNumber: student["number"].ToString(),
                                               name: student["name"].ToString(),
                                               goodPoint: int.Parse(student["good_point"].ToString()),
                                               badPoint: int.Parse(student["bad_point"].ToString()),
                                               penaltyLevel: Info.ParseStatus(student["bad_point_status"].Type == JTokenType.Null ? 0 : int.Parse(student["bad_point_status"].ToString())),
                                               penaltyTrainingStaus: bool.Parse(student["penalty_training_status"].ToString()),
                                               isSelected: false));
                }
            }
        }
        async Task ExecuteLoadStudentsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                StudentList.Clear();
                List <Student> students = await App.StudentDB.GetItemsAsync();

                foreach (Student student in students)
                {
                    StudentList.Add(student);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 3
0
        public void Update()
        {
            listviewCollection.Clear();
            var responseDict = Info.GenerateRequest("GET", Info.Server.MANAGING_STUDENT, Info.mainPage.AccessToken, "");

            if ((HttpStatusCode)responseDict["status"] != HttpStatusCode.OK)
            {
                Info.RefreshToken();
                responseDict = Info.GenerateRequest("GET", Info.Server.MANAGING_STUDENT, Info.mainPage.AccessToken, "");
                //MessageBox.Show("오류");
            }
            Console.WriteLine("aa");

            JObject responseJSON = JObject.Parse(responseDict["body"].ToString());

            studentList = JArray.Parse(responseJSON["studentList"].ToString());

            Console.WriteLine("aa");
            foreach (JObject student in studentList)
            {
                int currentStep = student["penaltyLevel"].Type == JTokenType.Null
                    ? 0
                    : (int)student["penaltyLevel"];

                if (filter != "전체" && Info.ParseStatus(currentStep).Equals(filter))
                {
                    continue;
                }

                if (currentStep >= 1 && (bool)student["penaltyTrainingStatus"] == true)
                {
                    listviewCollection.Add(new ViewModel.StudentListViewModel(
                                               id: student["id"].ToString(),
                                               classNumber: student["number"].ToString(),
                                               name: student["name"].ToString(),
                                               goodPoint: student["goodPoint"].Type == JTokenType.Null ? 0 : (int)student["goodPoint"],
                                               badPoint: student["badPoint"].Type == JTokenType.Null ? 0 : (int)student["badPoint"],
                                               penaltyTrainingStaus: bool.Parse(student["penaltyTrainingStatus"].ToString()),
                                               penaltyLevel: bool.Parse(student["penaltyTrainingStatus"].ToString()) == true
                            ? Info.ParseStatus((int)student["penaltyLevel"])
                            : " ",
                                               isSelected: false
                                               ));
                }
            }
        }
Esempio n. 4
0
 public void ClearButton()
 {
     StudentList.Clear();
     SearchBox     = "";
     SelectedClass = null;
     StudentList.Where(s => s.Checked == false);
     SearchButton(StudentList); //call search again to reset studentlist
 }
Esempio n. 5
0
 private void RefreshData(IList <StudentInfo> list)
 {
     StudentList.Clear();
     foreach (var item in list)
     {
         StudentList.Add(new StudentInfoViewModel(item));
     }
     //_DataCollectioner.GetBindingExpression(DataGrid.ItemsSourceProperty)?.UpdateTarget();
 }
Esempio n. 6
0
        //Search button
        public void SearchButton(object o)
        {
            StudentList.Clear();
            var result = StudentService.SearchStudent(new StudentSearchCriteria
            {
                SearchText = SearchBox,
                ClassName  = SelectedClass
            });

            StudentList.AddRange(result);
        }
Esempio n. 7
0
 private void FileToDatas(string filename)
 {
     for (int dayHour = 0; dayHour < 24; dayHour++)
     {
         string monday    = null;
         string tuesday   = null;
         string wednesday = null;
         string thursday  = null;
         string friday    = null;
         string saturday  = null;
         string sunday    = null;
         Week   week      = new Week((dayHour + " - " + (dayHour + 1)), monday, tuesday, wednesday, thursday, friday, saturday, sunday);
         this.WeekGrid.RemoveAt(dayHour);
         this.WeekGrid.Insert(dayHour, week);
     }
     StudentList.Clear();
     GroupStudentList.Clear();
     GroupList.Clear();
     using (var readFromFile = new StreamReader(filename))
     {
         var deserializer = new XmlSerializer(typeof(ObservableCollection <Student>));
         ObservableCollection <Student> tmpStudentList = (ObservableCollection <Student>)deserializer.Deserialize(readFromFile);
         foreach (var item in tmpStudentList)
         {
             StudentList.Add(item);
         }
         deserializer = new XmlSerializer(typeof(ObservableCollection <Student>));
         foreach (var item in tmpStudentList)
         {
             GroupStudentList.Add(item);
         }
         deserializer = new XmlSerializer(typeof(ObservableCollection <Group>));
         ObservableCollection <Group> tmpGroupList = (ObservableCollection <Group>)deserializer.Deserialize(readFromFile);
         foreach (var item in tmpGroupList)
         {
             GroupList.Add(item);
         }
         deserializer = new XmlSerializer(typeof(ObservableCollection <Week>));
         ObservableCollection <Week> tmpWeekGrid = (ObservableCollection <Week>)deserializer.Deserialize(readFromFile);
         foreach (var item in tmpWeekGrid)
         {
             WeekGrid.Add(item);
         }
     }
 }
Esempio n. 8
0
 private void NewButtonClick(object sender, RoutedEventArgs e)
 {
     for (int dayHour = 0; dayHour < 24; dayHour++)
     {
         string monday    = null;
         string tuesday   = null;
         string wednesday = null;
         string thursday  = null;
         string friday    = null;
         string saturday  = null;
         string sunday    = null;
         Week   week      = new Week((dayHour + " - " + (dayHour + 1)), monday, tuesday, wednesday, thursday, friday, saturday, sunday);
         this.WeekGrid.RemoveAt(dayHour);
         this.WeekGrid.Insert(dayHour, week);
     }
     StudentList.Clear();
     GroupStudentList.Clear();
     GroupList.Clear();
 }
Esempio n. 9
0
 public void LoadStudentAction()
 {
     OpenFileDialog.Filter = "Txt files (*.txt)|*.txt|Xml files (*.xml)|*.xml|Json files (*.jon)|*.json|All files (*.*)|*.*";
     if (true == OpenFileDialog.ShowDialog())
     {
         string filePath     = OpenFileDialog.FileName;
         var    dataStudentR = Path.GetExtension(filePath) switch
         {
             ".xml" => fileServiceXml.Read(filePath),
             ".json" => fileServiceJson.Read(filePath),
             ".txt" => fileServiceTxt.Read(filePath),
             _ => throw new Exception("")
         };
         StudentList.Clear();
         foreach (var student in dataStudentR)
         {
             StudentList.Add(student);
         }
     }
 }
Esempio n. 10
0
 public bool Load(string fileName)
 {
     using (StreamReader fileStream = new StreamReader(fileName, System.Text.Encoding.UTF8))
     {
         StudentList.Clear();
         SubjectsList.Clear();
         string checkString = fileStream.ReadLine();
         if (!checkString.Equals("CPF"))
         {
             return(false);
         }
         string stipend = fileStream.ReadLine();
         StipendBox.Text = stipend;
         string startPeriod = fileStream.ReadLine();
         Start_Period            = DateTime.Parse(startPeriod);
         StartPeriodPicker.Value = Start_Period;
         string finishPeriod = fileStream.ReadLine();
         Finish_Period            = DateTime.Parse(finishPeriod);
         FinishPeriodPicker.Value = Finish_Period;
         List <int> subjects = Program.StringInListInt(fileStream.ReadLine(), ' ');
         SubjectsList = subjects;
         while (!fileStream.EndOfStream)
         {
             string student = fileStream.ReadLine();
             GetStudentOfStreamLine(student, out string idStudent, out string assessmentStudent);
             AssessmentsStudent assessmentsStudent = new AssessmentsStudent(Int32.Parse(idStudent));
             List <string>      assessmentsList    = Program.StringInListString(assessmentStudent, ' ');
             assessmentsList.ForEach(assessment =>
             {
                 assessmentsStudent.GetAssessmentOfStreamLine(assessment);
             });
             StudentList.Add(assessmentsStudent);
         }
         UpdateTable();
         return(true);
     }
 }