Beispiel #1
0
        private void cbEditor1_ValueChanged(object sender, EventArgs e)
        {
            StudentSchedule sa = new StudentSchedule();
            int i = gvAllSchedules.CurrentRow.Index;
            string subass = gvAllSchedules.Rows[i].Cells["SubjectAssignments"].Value.ToString();
            int index = Schedules.FindIndex(item => item.SubjectAssignments == subass);

            Schedules[index].Selected = false;
            sa = Schedules[index];

            RadCheckBoxEditor cbEditor1 = sender as RadCheckBoxEditor;
                StudentSubject ss = new StudentSubject()
                {
                    StudentSY = controlStudentId + SY,
                    SubjectCode = sa.SubjectCode,
                    SubjectAssignments = sa.SubjectAssignments,
                    StudentEnrSubCode = controlStudentId + SY + sa.SubjectCode,
                    LockFirst = false,
                    LockSecond = false,
                    LockThird = false,
                    LockFourth = false,
                    FirstPeriodicRating = 0.00,
                    SecondPeriodicRating = 0.00,
                    ThirdPeriodicRating = 0.00,
                    FourthPeriodicRating = 0.00
                };

                if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor1.Value == Telerik.WinControls.Enumerations.ToggleState.On)
                {
                    sa.Selected = false;
                    AddFromControl.Add(sa);
                    subjects.Add(ss);
                    Schedules.Remove(sa);
                }
                else if ((Telerik.WinControls.Enumerations.ToggleState)cbEditor1.Value == Telerik.WinControls.Enumerations.ToggleState.Off)
                {
                    sa.Selected = false;
                    ControlSchedule.Remove(sa);
                    subjects.Remove(ss);
                    AddFromAll.Add(sa);
                }
            
        }
        public List<StudentSchedule> GetSchedules(string sy)
        {
            List<SubjectAssignment> schedList = new List<SubjectAssignment>();
            schedList = GetAllSchedules(sy);

            List<StudentSchedule> studSched = new List<StudentSchedule>();

            foreach (SubjectAssignment sab in schedList)
            {
                int index = -1;
                index = studSched.FindIndex(item => item.SubjectCode == sab.SubjectCode && item.GradeSectionCode == sab.GradeSectionCode);
                if (index == -1)
                {
                    StudentSchedule sa = new StudentSchedule();
                    TranslateSAToLoadStudentSchedule(sab, sa);
                    sa.SubjectAssignments = sab.SubjectAssignmentsID.ToString();
                    sa.TimeslotInfo = sab.TimeslotInfo;
                    studSched.Add(sa);
                }
                else
                {
                    studSched[index].SubjectAssignments += " " + sab.SubjectAssignmentsID.ToString();
                    studSched[index].TimeslotInfo += " " + sab.TimeslotInfo;
                }
            }
            return studSched;
        }
        public void TranslateSAToLoadStudentSchedule(SubjectAssignment sab, StudentSchedule sa)
        {

            sa.GradeSection = sab.GradeSection;
            sa.Section = sab.Section;
            sa.GradeLevel = sab.GradeLevel;
            sa.Class = sab.Class;

            sa.Room = sab.Room;
            sa.RoomCode = sab.RoomCode;

            sa.Subject = sab.Subject;
            sa.Teacher = sab.Teacher;
            sa.TeacherName = sab.TeacherName;

            sa.Timeslot = sab.Timeslot;
            sa.Timestart = sab.Timestart;
            sa.TimeEnd = sab.TimeEnd;
            sa.Days = sab.Days;

            sa.Deactivated = sab.Deactivated;
            sa.GradeSectionCode = sab.GradeSectionCode;
            sa.RoomId = sab.RoomId;
            sa.SubjectCode = sab.SubjectCode;

            sa.SY = sab.SY;
            sa.TeacherId = sab.TeacherId;
            sa.TimeSlotCode = sab.TimeSlotCode;


            sa.SubjectInfo = sa.SubjectInfo;

            sa.SubjectDescription = sa.SubjectDescription;
        }
 public List<StudentSchedule> GetStudentExistingSchedule(List<StudentSubject> studSubs, string sy)
 {
     List<StudentSchedule> schedList = new List<StudentSchedule>();
     schedList = GetSchedules(sy);
     List<StudentSchedule> existing = new List<StudentSchedule>();
     StudentSchedule stud = new StudentSchedule();
     foreach (StudentSubject ss in studSubs)
     {
         int index = schedList.FindIndex(item => item.SubjectAssignments == ss.SubjectAssignments);
         stud = schedList[index];
         stud.Selected = false;
         existing.Add(stud);
     }
     return existing;
 }