Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Student dhas = new Student("Manick", "Dhas", 22);
        Student raj  = new Student("Sundar", "Raj", 32);

        ///Using a custom strongly typed StudentList
        StudentList mc = new StudentList();

        mc.Add(dhas);
        mc.Add(raj);

        Response.Write("<B><U>Using a custom strongly typed StudentList</B></U><BR>");
        foreach (Student s in mc)
        {
            Response.Write("First Name : " + s.FirstName + "<BR>");
            Response.Write("Last Name : " + s.LastName + "<BR>");
            Response.Write("Age : " + s.Age + "<BR><BR>");
        }

        ///Creating a list of Student objects using my custom generics
        MyCustomList <Student> student = new MyCustomList <Student>();

        student.Add(dhas);
        student.Add(raj);

        Response.Write("<BR><B><U>Using a list of Student objects using my custom generics</B></U><BR>");
        foreach (Student s in student)
        {
            Response.Write("First Name : " + s.FirstName + "<BR>");
            Response.Write("Last Name : " + s.LastName + "<BR>");
            Response.Write("Age : " + s.Age + "<BR><BR>");
        }

        ///Creating a list of Student objects using my custom generics
        MyCustomList <int> intlist = new MyCustomList <int>();

        intlist.Add(1);
        intlist.Add(2);

        Response.Write("<BR><B><U>Using a list of String values using my custom generics</B></U><BR>");
        foreach (int i in intlist)
        {
            Response.Write("Index : " + i.ToString() + "<BR>");
        }

        ///Creating a list of Student objects using my custom generics
        MyCustomList <string> strlist = new MyCustomList <string>();

        strlist.Add("One");
        strlist.Add("Two");

        Response.Write("<BR><B><U>Using a list of int values using my custom generics</B></U><BR>");
        foreach (string str in strlist)
        {
            Response.Write("Index : " + str + "<BR>");
        }
    }
Ejemplo n.º 2
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));
                }
            }
        }
Ejemplo n.º 3
0
        private void SaveStudent()
        {
            StudentModel stu = new StudentModel();

            stu = CurrentStudent;
            StudentList.Add(stu);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets a list of Students
        /// </summary>
        /// <returns>List of Students</returns>
        public static StudentList GetItem()
        {
            StudentList myStudentList = null;

            using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
            {
                SqlCommand myCommand = new SqlCommand("spSelectStudentList", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                myConnection.Open();
                using (SqlDataReader myDataReader = myCommand.ExecuteReader())
                {
                    if (myDataReader.HasRows)
                    {
                        myStudentList = new StudentList();
                        while (myDataReader.Read())
                        {
                            myStudentList.Add(FillRecord(myDataReader));
                        }
                    }
                    myDataReader.Close();
                }
                myConnection.Close();
            }
            return(myStudentList);
        }
        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;
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Take the data list passed in, and convert each to a new StudentDisplayViewModel item and add that to the StudentList
 /// </summary>
 /// <param name="dataList"></param>
 public AdminReportIndexViewModel(List <StudentModel> dataList)
 {
     foreach (var item in dataList)
     {
         StudentList.Add(new StudentDisplayViewModel(item));
     }
 }
Ejemplo n.º 7
0
        public void Update()
        {
            var responseDict = Info.GenerateRequest("GET", Info.Server.MANAGING_STUDENT, Info.mainPage.AccessToken, "");

            if ((HttpStatusCode)responseDict["status"] != HttpStatusCode.OK)
            {
                return;
            }

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

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

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

                if (currentStep % 2 == 1)
                {
                    listviewCollection.Add(new ViewModel.StudentListViewModel(
                                               id: student["id"].ToString(),
                                               classNumber: student["number"].ToString(),
                                               name: student["name"].ToString(),
                                               goodPoint: student["good_point"].Type == JTokenType.Null ? 0 : (int)student["good_point"],
                                               badPoint: student["bad_point"].Type == JTokenType.Null ? 0 : (int)student["bad_point"],
                                               penaltyTrainingStaus: bool.Parse(student["penalty_training_status"].ToString()),
                                               penaltyLevel: Info.ParseStatus(currentStep),
                                               isSelected: false
                                               ));
                }
            }
        }
Ejemplo n.º 8
0
        // Add Student duymesine basildiqda bash verenler
        private void btnAddStudent_Click(object sender, EventArgs e)
        {
            // Add student forumundaki inputlara daxil edilenlerin yerlerine oyulmasi
            string firstname = txtFirstname.Text;
            string lastname  = txtLastname.Text;
            string email     = txtEmail.Text;
            // secilmish qrupun ID nomresinin  groupID-ye verilmesi
            string groupId = ((GroupCombo)cmbGroups.SelectedItem).Value;

            // Group tipinden deyishen yaradiriq
            // ve Qrup siyahisinin ID-lerinden secilmishini deyishene veririk
            Group selectedGroup = GroupList.GetGroupById(groupId);

            if (selectedGroup == null) // eger secilmish qrup yoxdursa
            {
                MessageBox.Show("Group doesn't exist");
                return;
            }

            // Studentlerin siyahisina yeni studentin elave elave edilmesi
            StudentList.Add(new Student
            {
                Firstname = firstname,
                Lastname  = lastname,
                Email     = email,
                Group     = selectedGroup
            });

            //txtFirstname.Text = "";
            //txtLastname.Text = "";
            //txtEmail.Text = "";
        }
Ejemplo n.º 9
0
        private void _F_AddStudent()
        {
            var sInstance = ServiceLocator.Current.GetInstance <StudentModifyViewModel>();

            sInstance.studentInfo = new StudentInfo();
            sInstance.classInfo   = Classes.FirstOrDefault();
            if (sInstance.classInfo == null)
            {
                return;
            }
            sInstance.Title = "添加学生信息";
            StudentInfoWindow studentInfoWindow = new StudentInfoWindow();

            studentInfoWindow.ShowDialog();
            if (studentInfoWindow.DialogResult == true)
            {
                var target = sInstance.studentInfo;
                target.Age = DateTime.Now.Year - target.DateOfBirth.Year;
                _StudentInfoDal.Insert(target);
                _StudentInfoDal.Save();
                _RelationShipDal.Insert(new Student_Class_Relation()
                {
                    StudentId = sInstance.studentInfo.ID, ClassId = sInstance.classInfo.ID
                });
                _RelationShipDal.Save();
                StudentList.Add(new StudentInfoViewModel(target));
            }
        }
Ejemplo n.º 10
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
                                               ));
                }
            }
        }
 public void AddStudent(Student student)
 {
     if (!IsActive)
     {
         Console.WriteLine("This course is currently inactive");
     }
     StudentList.Add(student);
 }
Ejemplo n.º 12
0
 private void RefreshData(IList <StudentInfo> list)
 {
     StudentList.Clear();
     foreach (var item in list)
     {
         StudentList.Add(new StudentInfoViewModel(item));
     }
     //_DataCollectioner.GetBindingExpression(DataGrid.ItemsSourceProperty)?.UpdateTarget();
 }
Ejemplo n.º 13
0
    public object Clone()
    {
        StudentList oNewList = new StudentList();

        for (int i = 0; i < Count; i++)
        {
            oNewList.Add(this[i].Clone() as Student);
        }
        return(oNewList);
    }
Ejemplo n.º 14
0
        /// <summary>
        /// Выполняет переход в режим добавления нового объекта, втавляет новый объект в коллекцию
        /// </summary>
        protected override void Add()
        {
            StudentViewModel newStudent = new StudentViewModel
            {
                StudentId = 0
            };

            StudentList.Add(newStudent);
            CurrentStudent = newStudent;
            IsAdding       = true;
        }
Ejemplo n.º 15
0
        //Create student object
        public Student createStudent()
        {
            Student student = new Student
            {
                StudentName   = studentName,
                StudentSchool = studentSchool,
            };

            //Add student to oobservablecollection so all students are displayed in the panel, before group is created
            StudentList.Add(student);
            return(student);
        }
Ejemplo n.º 16
0
        private void init()
        {
            MessageSubscribeRelations.AddSubscribe(MessageType.WSDEDataEvent, new Relation()
            {
                CanUninstall     = true,
                IsActive         = true,
                IsKeep           = false,
                RelationDescribe = Title,
                RelationGuid     = this.StrGuid,
                RelationAction   = messageData =>
                {
                    base.BindingPropInOtherTask(() =>
                    {
                        JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                        var response = javaScriptSerializer.Deserialize <WSDESubVoterSelectRequest>(messageData.MessageData);
                        if (!Start)
                        {
                            StudentLogin(response);
                            return;
                        }
                        StudentLogin(response);
                        if (String.IsNullOrWhiteSpace(response.SubVoterResult) || response.SubVoterResult.Equals("login"))
                        {
                            return;
                        }
                        if (!StudentList.Any(k => k.StudentNumber == response.SubVoterNumber) && RefuseOutOfStudentList)
                        {
                            return;
                        }
                        response.SubVoterResult = response.SubVoterResult.Replace(".", "");
                        response.SubVoterResult = StringUtils.RemoveDuplicateCharacters(response.SubVoterResult);
                        var number = System.Convert.ToInt32(response.SubVoterSelectNumber);
                        examination.Add(response.SubVoterNumber, number, response.SubVoterResult);
                        if (QuestionList.Any(k => k.QuestionNumber == response.SubVoterSelectNumber))
                        {
                            QuestionList.First(k => k.QuestionNumber == response.SubVoterSelectNumber).Set(examination.ExaminationQuestions.First(k => k.QuestionNumber == number));
                        }
                        if (!StudentList.Any(k => k.StudentNumber == response.SubVoterNumber) && examination.Voters != null && examination.Voters.Count() > 0)
                        {
                            StudentVM studentNM = new StudentVM();
                            studentNM.Set(examination.Voters.First(k => k.VoterId == response.SubVoterNumber));
                            StudentList.Add(studentNM);
                        }
                        if (examination.Voters != null && examination.Voters.Count() > 0)
                        {
                            StudentList.First(k => k.StudentNumber == response.SubVoterNumber).Set(examination.Voters.First(k => k.VoterId == response.SubVoterNumber));
                        }

                        base.ViewChange();
                    });
                },
            });
        }
Ejemplo n.º 17
0
        /// <summary>
        /// "This fuction gets students' snapshots from a csv file and represents them in a data structure for each student
        /// </summary>
        /// <param name="path">Where the data is located</param>
        /// <param name="students">An object of type student that has an id and a snapshot list</param>
        public void ConstructStudent(string path, ref List <Student> students, Dictionary <string, string> studentResultsList)
        {
            int lastItem = students.Count;

            List <string> SplitLine(string line)
            {
                return(line.Split(new char[] { ',' }, StringSplitOptions.None).ToList());
            }

            void Add(List <string> record, List <Student> StudentList, int index)
            {
                var snapShot = new Snapshot();

                StudentList.Add(new Student());
                StudentList[index].Id     = record[0];
                StudentList[index].Result = studentResultsList[record[0]];
                snapShot.AddRecord(record, 0);
                StudentList[index].Snapshots = new List <Snapshot>()
                {
                    snapShot
                };
            }

            using (var stream = new StreamReader(path))
            {
                string headerLine = stream.ReadLine();
                string firstLine  = stream.ReadLine();
                string currentLine;
                int    index = 0;

                Add(SplitLine(firstLine), students, lastItem);
                while ((currentLine = stream.ReadLine()) != null)
                {
                    index++;
                    var record   = SplitLine(currentLine);
                    var snapShot = new Snapshot();

                    if (students[lastItem].Id != record[0])
                    {
                        lastItem++;
                        Add(record, students, lastItem);
                        index = 0;
                    }
                    else
                    {
                        snapShot.AddRecord(record, index);
                        students[lastItem].Snapshots.Add(snapShot);
                    }
                }
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// This function adds a new student to the list
        /// </summary>
        public void AddStudentButtonPressed()
        {
            int firstAvailable = Enumerable.Range(0, StudentList.Count + 1).Except(StudentList.Select(s => s.ID).ToList()).First();

            StudentList.Add(new StudentModel(
                                firstAvailable,
                                "[Enter First Name]",
                                "[Enter Last Name]",
                                "[Enter Adress]",
                                0,
                                0M
                                ));
            SaveStudentsButtonEnabled = true;
        }
Ejemplo n.º 19
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var newStudent = new Student();
            var addForm    = new OneStudentForm(OneStudentForm.WorkMode.AddStudent, newStudent);

            newStudent = addForm.ShowDialog();
            if (newStudent != new Student())
            {
                _studentList.Add(newStudent);
            }
            _studentList.Fill();

            dgvStudents.DataSource = typeof(List <Student>);
            dgvStudents.DataSource = _studentList.Value;
        }
        internal static StudentList DataTableToTitleList(DataTable Dt)
        {
            StudentList students = new StudentList();

            try
            {
                foreach (DataRow item in Dt.Rows)
                {
                    students.Add(DataRowToTitle(item));
                }
            }
            catch
            {
            }
            return(students);
        }
Ejemplo n.º 21
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);
         }
     }
 }
Ejemplo n.º 22
0
 private void DeleteFromGroupButtonClick(object sender, RoutedEventArgs e)
 {
     try
     {
         Student student = new Student
                               (this.GroupStudentList[this.GroupStudentListView.SelectedIndex].Name,
                               this.GroupStudentList[this.GroupStudentListView.SelectedIndex].LastName,
                               this.GroupStudentList[this.GroupStudentListView.SelectedIndex].Bid,
                               this.GroupStudentList[this.GroupStudentListView.SelectedIndex].PhoneNumber,
                               this.GroupStudentList[this.GroupStudentListView.SelectedIndex].Adress, null);
         StudentList.Add(student);
         GroupStudentList.RemoveAt(this.GroupStudentListView.SelectedIndex);
     }
     catch (Exception)
     {
         MessageBox.Show("You have to select student from the list.", "Student not selected");
     }
 }
Ejemplo n.º 23
0
        public PunishmentLogPage(MainWindow mainWindow, string id, string name, string classNumber, int goodPoint, int badPoint, string currentStep)
        {
            InitializeComponent();

            listviewCollection = Resources["StudentListKey"] as ViewModel.StudentList;

            BackButton.Click += (s, e) =>
            {
                NavigationService.GoBack();
            };

            var responseDict = Info.GenerateRequest("GET", Info.Server.MANAGING_STUDENT, Info.mainPage.AccessToken, "");

            if ((HttpStatusCode)responseDict["status"] != HttpStatusCode.OK)
            {
                MessageBox.Show("학생 목록 조회 실패");
                return;
            }

            students = JArray.Parse(responseDict["body"].ToString());

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

            SetLogData(id);

            StudentName.Content     = name;
            ClassNumber.Content     = classNumber;
            TotalGoodPoint.Content  = goodPoint.ToString();
            TotalBadPoint.Content   = badPoint.ToString();
            TotalPunishStep.Content = currentStep.ToString();

            this.mainWindow = mainWindow;
        }
Ejemplo n.º 24
0
        //Responsible of submitting the student with all its details to the database
        private void ButtonSubmit_Click(object sender, EventArgs e)
        {
            //Check if there is an empty field
            bool isValid = true;

            foreach (Control ctr in Controls)
            {
                if (ctr is TextBox)
                {
                    if (ctr.Text == "" || ctr.Text is null)
                    {
                        isValid = false;
                    }
                }
            }
            //Check if there is an empty field that wasn't put
            if (isValid)
            {
                Student student = new Student();
                //Taking all the details from text boxes (submitted by user) and fill it in an Student object
                student.StudentID      = textBoxID.Text.ToString();
                student.FirstName      = textBoxFname.Text;
                student.LastName       = textBoxLname.Text;
                student.EnrollmentDate = textBoxEdate.Text;
                student.Password       = textBoxPasswd.Text;
                //Add the student
                studentList.Add(student);
                if (student.getValid())
                {
                    //Show confirmation message
                    MessageBox.Show("Student Added Successfully!");
                    Clear();
                }
                else
                {
                    MessageBox.Show(student.geterrorMessage());
                }
            }
            else
            {
                MessageBox.Show("A field is empty");
            }
        }
Ejemplo n.º 25
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);
         }
     }
 }
Ejemplo n.º 26
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                student = new Student();

                student.FirstName = txtFirstName.Text;
                student.LastName  = txtLastName.Text;
                student.StudentId = txtStudentId.Text;

                student.Insert();
                students.Add(student);
                Session["students"] = students;
                Rebind();
            }
            catch (Exception ex)
            {
                Response.Write("Error: " + ex.Message);
            }
        }
Ejemplo n.º 27
0
        //To add Student to DB
        private void CreateStudent(Student student)
        {
            try
            {
                //Add new student to DB
                Student StudentAdded = _studentDB.CreateStudent(student);

                //Add new Student to ObservableCollection
                StudentList.Add(StudentAdded);

                MessageBox.Show("Student wurde erfolgreich hinzufügt!", "Erfolg", MessageBoxButton.OK, MessageBoxImage.None);

                Messenger.Default.Send(new NotificationMessage("CloseAddStudentView"));

                SelectedStudent = StudentAdded;
            }
            catch (Exception e)
            {
                MessageBox.Show("Student wurde nicht hinzufügt. Error: " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Ejemplo n.º 28
0
        public MainWindow()
        {
            GStudentList.GroupDescriptions.Add(new PropertyGroupDescription(nameof(Student.ClassId)));
            GStudentList.SortDescriptions.Add(new SortDescription(nameof(Student.Age), ListSortDirection.Ascending));
            GStudentList.SortDescriptions.Add(new SortDescription(nameof(Student.Name), ListSortDirection.Ascending));

            GStudentList.IsLiveGrouping = true;
            GStudentList.IsLiveSorting  = true;

            StudentList.Add(new Student("Tom", "Junior", 20));
            StudentList.Add(new Student("djm03178", "Elite", 31));
            StudentList.Add(new Student("Mike", "Expert", 44));
            StudentList.Add(new Student("tourist", "Elite", 55));
            StudentList.Add(new Student("Amok", "Elite", 55));
            StudentList.Add(new Student("Dotory", "Elite", 55));
            StudentList.Add(new Student("Radewoosh", "Elite", 21));
            StudentList.Add(new Student("gaelim", "Junior", 33));

            InitializeComponent();
            DataContext = this;
        }
Ejemplo n.º 29
0
        public static void SaveStudentInformation(StudentInformation student)
        {
            if (student.OperationType == 0)
            {
                if (!Directory.Exists(student.StudentId.ToString()))
                {
                    Directory.CreateDirectory(student.StudentId.ToString());

                    StudentList.Add(student.StudentId, student);

                    // TODO new implementation
                    var studentDb = new Student()
                    {
                        StudentId     = student.StudentId,
                        ExamStartTime = GetStartTime(),
                        ExamEndTime   = GetEndTime()
                    };

                    dataService.CreateStudentIfNotExists(studentDb);
                }
            }
        }
Ejemplo n.º 30
0
        public void AddStudent(int student)
        {
            bool isSet = false;

            StudentList.ForEach(stud => {
                if (stud.IdStudent == student)
                {
                    isSet = true;
                    return;
                }
            });
            if (!isSet)
            {
                AssessmentsStudent newStudent = new AssessmentsStudent(student);
                SubjectsList.ForEach(subject =>
                {
                    newStudent.AssessmentsList.Add(subject, 0);
                });
                StudentList.Add(newStudent);
            }
            UpdateTable();
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Gets a list of Students
 /// </summary>
 /// <returns>List of Students</returns>
 public static StudentList GetItem()
 {
     StudentList myStudentList = null;
     using (SqlConnection myConnection = new SqlConnection(AppSettings.ConnectionString))
     {
         SqlCommand myCommand = new SqlCommand("spSelectStudentList", myConnection);
         myCommand.CommandType = CommandType.StoredProcedure;
         myConnection.Open();
         using (SqlDataReader myDataReader = myCommand.ExecuteReader())
         {
             if (myDataReader.HasRows)
             {
                 myStudentList = new StudentList();
                 while (myDataReader.Read())
                 {
                     myStudentList.Add(FillRecord(myDataReader));
                 }
             }
             myDataReader.Close();
         }
         myConnection.Close();
     }
     return myStudentList;
 }