Ejemplo n.º 1
0
 public MentorScheduleModel FindMentorSchedule(string username, int mentorId)
 {
     List<MentorSchedule> scheduleList = mr.GetMentorSchedule(mentorId);
     Mentor mp = mr.GetMentorProfileDetails(mentorId);
     MentorScheduleModel msm = new MentorScheduleModel();
     msm._mentorId = mentorId;
     msm.studentId = mr.GetIDfromEmail(username);
     msm.imgpath = mp._imagePath;
     msm.major = mp.major;
     msm.description = mp.description;
     msm.name = mp._userName;
     msm.subject = mp.subjects.ToList().First().id;
     msm.subjectName = mp.subjects.ToList().First().name;
     List<DaySchedule> schList = new List<DaySchedule>();
     List<StudentSchedule> allMyBusySchedule = mr.GetStudentBusySchedule(msm.studentId);
     for (int i = 1; i <= 7; i++ )
     {
         DaySchedule ds = new DaySchedule();
         ds.day = i;
         List<TimeandRequest> timeList = new List<TimeandRequest>();
         List<MentorSchedule> eachdayschedulelist = (from l in scheduleList where l.fk_day_Id == i select l).ToList();
         foreach(MentorSchedule eachSchedule in eachdayschedulelist){
             TimeandRequest tnr = new TimeandRequest();
             tnr.timeId = eachSchedule.fk_time_id;
             tnr.isMentorAvailable = (eachSchedule.isMentoring==1 && eachSchedule.Mentorship == null)? 1 : 0;
             tnr.isFuture = IsFuture(i,tnr.timeId);
             tnr.isClashing = (tnr.isMentorAvailable == 1) && ((from a in allMyBusySchedule where a.fk_day_Id == i && a.fk_time_id == tnr.timeId select a).Count() > 0);
             timeList.Add(tnr);
         }
         ds._timeandRequest = timeList;
         schList.Add(ds);
     }
     msm._schedule = schList;
     return msm;
 }
Ejemplo n.º 2
0
        public MentorScheduleModel FindMentorSchedule(string username)
        {
            int mentorId = mr.GetIDfromEmail(username);
            List<MentorSchedule> scheduleList = mr.GetMentorScheduleForMentor(mentorId);
            Mentor mp = mr.GetMentorProfileDetails(mentorId);
            MentorScheduleModel msm = new MentorScheduleModel();
            msm._mentorId = mentorId;
            msm.studentId = 0;
            msm.imgpath = mp._imagePath;
            msm.major = mp.major;
            msm.description = mp.description;
            msm.name = mp._userName;
            msm.subject = mp.subjects.Count > 0 ? mp.subjects.ToList().First().id : 1;
            msm._subjects = GetAllSubjects();
            List<DaySchedule> schList = new List<DaySchedule>();

            for (int i = 1; i <= 7; i++)
            {
                DaySchedule ds = new DaySchedule();
                ds.day = i;
                List<TimeandRequest> timeList = new List<TimeandRequest>();
                List<MentorSchedule> eachdayschedulelist = (from l in scheduleList where l.fk_day_Id == i select l).ToList();
                foreach (MentorSchedule eachSchedule in eachdayschedulelist)
                {
                    TimeandRequest tnr = new TimeandRequest();
                    tnr.timeId = eachSchedule.fk_time_id;
                    tnr.isMentorAvailable = eachSchedule.isMentoring;
                    timeList.Add(tnr);
                }
                ds._timeandRequest = timeList;
                schList.Add(ds);
            }
            msm._schedule = schList;
            return msm;
        }
Ejemplo n.º 3
0
        public MentorScheduleModel FindthisMentorshipSchedule(int mshipID)
        {
            Mentorship mship = mr.GetMentorship(mshipID);

                    MentorScheduleModel msm = new MentorScheduleModel();
                    msm._mentorId = mship.fk_mentorId;
                    msm.subject = mship.fk_subject;
                    msm.subjectName = mship.subject.name;
                    msm.studentId = mship.fk_studentId;
                    msm.mentorShipID = mshipID;
                    List<DaySchedule> schList = new List<DaySchedule>();

                    List<MentorSchedule> msList = mr.GetMentorSchedule(mship.fk_mentorId);//find all mentor schedule records from the mentorSchedule table
                    for (int i = 1; i <= 7; i++)
                    {
                        DaySchedule ds = new DaySchedule();
                        ds.day = i;
                        List<TimeandRequest> timeList = new List<TimeandRequest>();
                        List<MentorSchedule> eachdayschedulelist = (from l in msList where l.fk_day_Id == i select l).ToList();
                        foreach (MentorSchedule eachSchedule in eachdayschedulelist)
                        {
                            TimeandRequest tnr = new TimeandRequest();
                            tnr.timeId = eachSchedule.fk_time_id;
                            tnr.isRequested = eachSchedule.fk_mentorship_id == mshipID ? 1 : 0;
                            timeList.Add(tnr);
                        }
                        ds._timeandRequest = timeList;
                        schList.Add(ds);
                    }
                    msm._schedule = schList;

            return msm;
        }
Ejemplo n.º 4
0
        public MentorScheduleModel FindthisScheduleRequest(int mshipID)
        {
            List<MentorScheduleRequest> reqList = mr.GetMentorScheduleRequests(mshipID);
               Mentorship mship = mr.GetMentorship(mshipID);
                    MentorScheduleModel msm = new MentorScheduleModel();
                    msm._mentorId = mship.fk_mentorId;
                    msm.subject = mship.fk_subject;
                    msm.subjectName = mship.subject.name;
                    msm.studentId = mship.fk_studentId;
                    msm.comment = mship.comments;//same mentorship id for all mentorschedulerequest records
                    msm.name = mr.GetNameFromID(mship.fk_studentId);
                    msm.imgpath = mr.GetStuImgPath(mship.fk_studentId);
                    msm.mentorShipID = mshipID;
                    List<DaySchedule> schList = new List<DaySchedule>();
                    List<MentorSchedule> allMyBusySchedule = mr.GetMentorBusySchedule(mship.fk_mentorId);
                    for (int i = 1; i <= 7; i++)
                    {
                        DaySchedule ds = new DaySchedule();
                        ds.day = i;
                        List<TimeandRequest> timeList = new List<TimeandRequest>();
                        List<MentorScheduleRequest> eachdayschedulelist = (from l in reqList where l.fk_day_Id == i select l).ToList();
                        foreach (MentorScheduleRequest eachSchedule in eachdayschedulelist)
                        {
                            TimeandRequest tnr = new TimeandRequest();
                            tnr.timeId = eachSchedule.fk_time_id;
                            tnr.isRequested = eachSchedule.isRequested;
                            tnr.isClashing = (tnr.isRequested == 1) && ((from a in allMyBusySchedule where a.fk_day_Id == i && a.fk_time_id == tnr.timeId select a).Count() > 0);
                            timeList.Add(tnr);
                        }
                        ds._timeandRequest = timeList;
                        schList.Add(ds);
                    }
                    msm._schedule = schList;

            return msm;
        }