Пример #1
0
        public static string CheckSubjectSlotAvialability(string levels)
        {
            string[] theLEvel          = levels.Split(';');
            string   subject           = theLEvel[0];
            string   level             = theLEvel[1];
            string   StartHourclinet   = theLEvel[2];
            string   StartMinuteclinet = theLEvel[3];
            string   day1 = theLEvel[4];
            //  string day1 = theLEvel[5];
            Day       day = DayHelper.GetDay(day1);
            smContext db  = new smContext();

            // db.TeachingClass.Include("TheTeachingDay").Where(a => a.ClassName == level).ToList();

            //  List<TeachingSubject> theTeachingSubject = work.TeachingSubjectRepository.Get().ToList();
            List <TeachingClass> theTeachingClass = db.TeachingClass.Include("TheTeachingDay").Where(a => a.ClassName == level).ToList(); //work.TeachingClassRepository.Get(a => a.ClassName == level).ToList();

            foreach (TeachingClass c in theTeachingClass)
            {
                //  foreach (TeachingDay td in c.TheTeachingDay)
                // {
                List <TeachingDay> theTeachingDay = db.TeachingDay.Include("TeachingSubject").Where(a => a.TeachingClass.TeachingClassID == c.TeachingClassID && a.theDay == day).ToList();

                foreach (TeachingDay td in theTeachingDay)
                {
                    foreach (TeachingSubject ts in td.TeachingSubject)
                    {
                        String Day        = ts.TeachingDay.theDay.ToString();
                        string theSubject = ts.SubjectName;
                        string EndHour    = ts.TeachingDay.EndTimeHour;
                        string EndMinutes = ts.TeachingDay.EndTimeMinute;

                        string StartHour    = ts.TeachingDay.StratTimeHour;
                        string StartMinutes = ts.TeachingDay.StratTimeMinute;

                        StringBuilder EndHourEndMinutes = new StringBuilder();

                        EndHourEndMinutes.Append(EndHour);
                        EndHourEndMinutes.Append(EndMinutes);


                        int           time = Convert.ToInt16(EndHourEndMinutes.ToString()); //= Convert.ToInt16(EndHour) + Convert.ToInt16(EndMinutes);
                        StringBuilder StartHourStartMinuteclinets = new StringBuilder();
                        StartHourStartMinuteclinets.Append(StartHourclinet).Append(StartMinuteclinet);
                        int timeClient = Convert.ToInt16(StartHourStartMinuteclinets.ToString());//Conve

                        if (theSubject == subject && timeClient < time)
                        {
                            string theAlert = theSubject + " " + "has been fixed  for this class and which ends at " + EndHour + ":" + EndMinutes;
                            return(theAlert);
                        }
                    }
                }
            }


            return("");
        }
Пример #2
0
        //public ActionResult CheckSubjectSlotAvialability(string subject, string level, string StartHourclinet, string StartMinuteclinet)
        public ActionResult CheckDaySlotAvialability(string levels)
        {
            //var theValue = $('#Subject').val() + ";" + $('#Class').val() + ";" + $('#StratTimeHour').val() + ";" + $('#StratTimeMinute').val() + ";" + $('#Teacher').val() + ";" + $('#Day').val();
            string[] theLEvel          = levels.Split(';');
            string   subject           = theLEvel[0];
            string   level             = theLEvel[1];
            string   StartHourclinet   = theLEvel[2];
            string   StartMinuteclinet = theLEvel[3];
            string   day1 = theLEvel[5];
            //  string day1 = theLEvel[5];
            Day       day = DayHelper.GetDay(day1);
            smContext db  = new smContext();


            List <TeachingDay> theTeachingDay = db.TeachingDay.Include("TeachingSubject").Where(a => a.TeachingClass.ClassName == level && a.theDay == day).ToList();

            foreach (TeachingDay td in theTeachingDay)
            {
                TeachingClass theTeachingClass = db.TeachingClass.Where(a => a.TeachingClassID == td.TeachingClassID).First();
                string        theClass         = theTeachingClass.ClassName;
                // string theClass = td.TeachingClass.ClassName;
                foreach (TeachingSubject ts in td.TeachingSubject)
                {
                    String Day        = ts.TeachingDay.theDay.ToString();
                    string theSubject = ts.SubjectName;
                    string EndHour    = ts.TeachingDay.EndTimeHour;
                    string EndMinutes = ts.TeachingDay.EndTimeMinute;

                    string StartHour    = ts.TeachingDay.StratTimeHour;
                    string StartMinutes = ts.TeachingDay.StratTimeMinute;

                    StringBuilder EndHourEndMinutes = new StringBuilder();

                    EndHourEndMinutes.Append(EndHour);
                    EndHourEndMinutes.Append(EndMinutes);


                    int           time = Convert.ToInt16(EndHourEndMinutes.ToString()); //= Convert.ToInt16(EndHour) + Convert.ToInt16(EndMinutes);
                    StringBuilder StartHourStartMinuteclinets = new StringBuilder();
                    StartHourStartMinuteclinets.Append(StartHourclinet).Append(StartMinuteclinet);
                    int timeClient = Convert.ToInt16(StartHourStartMinuteclinets.ToString());//Convert.ToInt16(StartHourclinet) + Convert.ToInt16(StartMinuteclinet);

                    if (timeClient < time)
                    {
                        string theAlert = theSubject + "  has been fixed  for " + theClass + " which starts " + StartHour + ":" + StartMinutes + " ends at " + EndHour + ":" + EndMinutes;
                        return(Json(theAlert, JsonRequestBehavior.AllowGet));
                    }
                }
            }

            //  }


            return(Json("", JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult Edit(string id)
        {
            Int32         theId      = Convert.ToInt32(Models.Encript.DecryptString(id, true));
            smContext     sm         = new smContext();
            List <Parent> theParentt = sm.Parent.Include("ThePrimarySchoolStudent").Where(a => a.ParentID == theId).ToList();
            List <PrimarySchoolStudent> theStudents = work.PrimarySchoolStudentRepository.Get(a => a.ParentID == theId).ToList();

            Parent theParent = theParentt[0];
            // PrimarySchoolStudent pri =
            //  Parent theParent = work.ParentRepository.GetByID(id);
            int counter = 0;

            foreach (PrimarySchoolStudent s in theStudents)
            {
                if (counter == 0)
                {
                    theParent.StudentIDOne = Convert.ToString(s.UserID);
                }
                if (counter == 1)
                {
                    theParent.StudentIDTwo = Convert.ToString(s.UserID);
                }

                if (counter == 2)
                {
                    theParent.StudentIDThree = Convert.ToString(s.UserID);
                }
                if (counter == 3)
                {
                    theParent.StudentIDFour = Convert.ToString(s.UserID);
                }
                if (counter == 4)
                {
                    theParent.StudentIDFive = Convert.ToString(s.UserID);
                }
                counter = counter + 1;
            }

            return(View("Edit Parent", theParent));
        }
Пример #4
0
        //public ActionResult CheckSubjectSlotAvialability(string subject, string level, string StartHourclinet, string StartMinuteclinet)
        public ActionResult CheckStaffSlotAvialability(string levels)
        {
            string[] theLEvel          = levels.Split(';');
            string   subject           = theLEvel[0];
            string   level             = theLEvel[1];
            string   StartHourclinet   = theLEvel[2];
            string   StartMinuteclinet = theLEvel[3];
            string   teacher           = theLEvel[4];
            //  string[] split = teacher.Split(' ');
            // int teacherID = Convert.ToInt32(split[0]);
            string    day1 = theLEvel[5];
            Day       day  = DayHelper.GetDay(day1);
            smContext db   = new smContext();

            List <Teacher> Teacher = db.Teacher.Include("TheTeachingClass").Where(a => a.TeacherName == teacher).ToList();

            foreach (Teacher t in Teacher)
            {
                //  List<TeachingSubject> theTeachingSubject = work.TeachingSubjectRepository.Get().ToList();
                // List<TeachingClass> theTeachingClass = db.TeachingClass.Include("TheTeachingDay").Where(a => a.ClassName == level && a.Teacher.TeacherID == t.TeacherID).ToList(); //work.TeachingClassRepository.Get(a => a.ClassName == level).ToList();
                List <TeachingClass> theTeachingClass = db.TeachingClass.Include("TheTeachingDay").Where(a => a.Teacher.TeacherID == t.TeacherID).ToList(); //work.TeachingClassRepository.Get(a => a.ClassName == level).ToList();
                foreach (TeachingClass c in theTeachingClass)
                {
                    string ClassName = c.ClassName;
                    //  foreach (TeachingDay td in c.TheTeachingDay)
                    // {
                    List <TeachingDay> theTeachingDay = db.TeachingDay.Include("TeachingSubject").Where(a => a.TeachingClass.TeachingClassID == c.TeachingClassID && a.theDay == day).ToList();

                    foreach (TeachingDay td in theTeachingDay)
                    {
                        foreach (TeachingSubject ts in td.TeachingSubject)
                        {
                            String Day        = ts.TeachingDay.theDay.ToString();
                            string theSubject = ts.SubjectName;
                            string EndHour    = ts.TeachingDay.EndTimeHour;
                            string EndMinutes = ts.TeachingDay.EndTimeMinute;

                            string StartHour    = ts.TeachingDay.StratTimeHour;
                            string StartMinutes = ts.TeachingDay.StratTimeMinute;

                            StringBuilder EndHourEndMinutes = new StringBuilder();

                            EndHourEndMinutes.Append(EndHour);
                            EndHourEndMinutes.Append(EndMinutes);


                            int           time = Convert.ToInt16(EndHourEndMinutes.ToString()); //= Convert.ToInt16(EndHour) + Convert.ToInt16(EndMinutes);
                            StringBuilder StartHourStartMinuteclinets = new StringBuilder();
                            StartHourStartMinuteclinets.Append(StartHourclinet).Append(StartMinuteclinet);
                            int timeClient = Convert.ToInt16(StartHourStartMinuteclinets.ToString());//Conve

                            if (theSubject == subject && timeClient < time)
                            {
                                string theAlert = theSubject + " " + "has been fixed  for " + teacher + " on " + Day + " for class " + ClassName + " which starts at " + StartHour + ":" + StartMinutes + " and which ends at " + EndHour + ":" + EndMinutes;
                                return(Json(theAlert, JsonRequestBehavior.AllowGet));
                            }

                            if (theSubject != subject && timeClient < time)
                            {
                                string theAlert = theSubject + " " + "has been fixed  for " + teacher + " on " + Day + " for class " + ClassName + " which starts at " + StartHour + ":" + StartMinutes + " and which ends at " + EndHour + ":" + EndMinutes;
                                // string theAlert = teacher + " " + "has been fixed  for this day and ends " + EndHour + ":" + EndMinutes;
                                return(Json(theAlert, JsonRequestBehavior.AllowGet));
                            }
                        }
                        // tdy.su

                        //   theTeachingDay.
                        //   foreach(TeachingSubj)
                    }
                }
            }


            return(Json("", JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public static List <List <TimeTable> > DisplayTimeTableCustomisedForStaff(int personID)
        {
            List <TimeTable> timeTable = new List <TimeTable>();

            List <List <TimeTable> > timeTableOverAll = new List <List <TimeTable> >();
            int thePersonID = Convert.ToInt16(personID);

            smContext db = new smContext();

            // List<Teacher> Teacher = db.Teacher.Include("TheTeachingClass").ToList();
            //  foreach (Teacher t in Teacher)
            // {
            // List<TeachingClass> theTeachingClass = db.TeachingClass.Include("TheTeachingDay").Where(a =>a.ClassName == level).ToList(); //work.TeachingClassRepository.Get(a => a.ClassName == level).ToList();
            //List<TeachingClass> theTeachingClass = db.TeachingClass.Include("TheTeachingDay").Where(a=> a.ClassName == level).ToList(); //work.TeachingClassRepository.Get(a => a.ClassName == level).ToList();
            //foreach (TeachingClass c in theTeachingClass)
            //{

            // string theTeacherName = c.Teacher.TeacherName;
            // string ClassName = c.ClassName;
            Day theDay = Day.SUNDAY;

            int counter = 0;

            for (int k = 0; k < 7; k++)
            {
                if (counter == 0)
                {
                    theDay = Day.SUNDAY;
                }

                if (counter == 1)
                {
                    theDay = Day.MONDAY;
                }
                if (counter == 2)
                {
                    theDay = Day.TUESDAY;
                }

                if (counter == 3)
                {
                    theDay = Day.WEDNESDAY;
                }

                if (counter == 4)
                {
                    theDay = Day.THURSDAY;
                }

                if (counter == 5)
                {
                    theDay = Day.FRIDAY;
                }

                if (counter == 6)
                {
                    theDay = Day.SATURDAY;
                }

                //   List<TeachingDay> theTeachingDay = db.TeachingDay.Include("TeachingSubject").Where(a => a.TeachingClass.TeachingClassID == c.TeachingClassID && a.theDay == theDay).OrderBy(a => a.StratTimeHour).ToList();


                List <TeachingDay> theTeachingDay = db.TeachingDay.Include("TeachingSubject").Where(a => a.TeachingClass.Teacher.ThePersonID == thePersonID && a.theDay == theDay).OrderBy(a => a.StratTimeHour).ToList();
                foreach (TeachingDay td in theTeachingDay)
                {
                    foreach (TeachingSubject ts in td.TeachingSubject)
                    {
                        TimeTable tt = new TimeTable();
                        tt.Day   = theDay.ToString();
                        tt.Class = ts.TeachingDay.TeachingClass.ClassName;
                        string[] theSplitedName = ts.TeachingDay.TeachingClass.Teacher.TeacherName.Split(' ');// theTeacherName;
                        tt.Subject = Truncate(ts.SubjectName, 21);
                        if (theSplitedName.Count() >= 2)
                        {
                            tt.Teacher = theSplitedName[0] + " " + theSplitedName[2];

                            tt.Teacher = Truncate(tt.Teacher, 16);
                            // tt.Teacher = tt.Teacher.Truncate();
                        }
                        if (theSplitedName.Count() < 2)
                        {
                            tt.Teacher = theSplitedName[0] + " " + theSplitedName[2];

                            tt.Teacher = Truncate(tt.Teacher, 16);
                        }
                        //ts.TeachingDay.TeachingClass.Teacher.TeacherName;// theTeacherName;
                        tt.StratTimeHour = ts.TeachingDay.StratTimeHour + ":" + ts.TeachingDay.StratTimeMinute;
                        tt.EndTimeHour   = ts.TeachingDay.EndTimeHour + ":" + ts.TeachingDay.EndTimeMinute;

                        timeTable.Add(tt);
                    }
                }
                if (timeTable.Count() != 0)
                {
                    timeTableOverAll.Add(timeTable);
                    timeTable = new List <TimeTable>();
                }
                counter = counter + 1;
            }

            //         break;
            //     }
            //// }


            return(timeTableOverAll);
        }
Пример #6
0
        protected override void Seed(smContext context)
        {
            //if (!Roles.RoleExists("Admin"))
            //{
            //    Roles.CreateRole("Admin");
            //}

            if (!Roles.RoleExists("SuperAdmin"))
            {
                Roles.CreateRole("SuperAdmin");
            }
            if (!Roles.RoleExists("Student"))
            {
                Roles.CreateRole("Student");
            }

            //if (!Roles.RoleExists("Teacher"))
            //{
            //    Roles.CreateRole("Teacher");
            //}



            if (Membership.GetUser("5000001") == null)
            {
                UnitOfWork work = new UnitOfWork();
                Membership.CreateUser("5000001", "ariyoo", "*****@*****.**");
                Roles.AddUserToRole("5000001", "SuperAdmin");
            }

            //    LibraryUser theLabUser = new LibraryUser
            //    {
            //        DOB = DateTime.Now,
            //        FirstName = "kayode",
            //        LastName = "kayode",
            //        Level = "",
            //        UserName = "******",
            //        LevelType = "",
            //        LevelTaught = "",
            //        LevelTaughtType = "",
            //        TelePhoneNumber = "08166196673",
            //        ClassTeacher = "",
            //        UserType = "NonTeaching-Staff",
            //        EnrollmentDate = DateTime.Now

            //    };

            //    work.LibraryUserRepository.Insert(theLabUser);
            //    work.Save();
            //    if (work.LevelRepository.Get().ToList().Count == 0)
            //    {
            //        Level theLEvel = new Level();
            //        theLEvel.Name = "JSS1";
            //        work.LevelRepository.Insert(theLEvel);

            //        Level theLEvelJSS2 = new Level();
            //        theLEvelJSS2.Name = "JSS2";
            //        work.LevelRepository.Insert(theLEvelJSS2);

            //        Level theLEvelJSS3 = new Level();
            //        theLEvelJSS3.Name = "JSS3";
            //        work.LevelRepository.Insert(theLEvelJSS3);

            //        Level theLEvelSS1 = new Level();
            //        theLEvelSS1.Name = "SS1";
            //        work.LevelRepository.Insert(theLEvelSS1);

            //        Level theLEvelSS2 = new Level();
            //        theLEvelSS2.Name = "SS2";
            //        work.LevelRepository.Insert(theLEvelSS2);

            //        Level theLEvelSS3 = new Level();
            //        theLEvelSS3.Name = "SS3";
            //        work.LevelRepository.Insert(theLEvelSS3);
            //        work.Save();

            //    }

            //    if (work.MyRoleRepository.Get().ToList().Count == 0)
            //    {
            //        MyRole theRole1 = new MyRole();
            //        theRole1.RoleName = "Student";
            //        theRole1.Upload = "";
            //        theRole1.Exam = "List-Create-";
            //        theRole1.Book = "";
            //        theRole1.BorrowedItem = "Details-";
            //        theRole1.Shelf = "Details-";
            //        theRole1.Course = "";
            //        work.MyRoleRepository.Insert(theRole1);



            //        MyRole theRole2 = new MyRole();
            //        theRole2.RoleName = "SuperAdmin";
            //        theRole2.Upload = "";
            //        theRole2.Exam = "";
            //        theRole2.Book = "";
            //        theRole2.BorrowedItem = "";
            //        theRole2.Shelf = "";
            //        theRole2.Course = "";
            //        work.MyRoleRepository.Insert(theRole2);


            //        MyRole theRole3 = new MyRole();
            //        theRole3.RoleName = "Admin";
            //        theRole3.Upload = "List-Create-Edit-";
            //        theRole3.Exam = "";
            //        theRole3.Book = "";
            //        theRole3.BorrowedItem = "List-Create-Edit-Delete-";
            //        theRole3.Shelf = "List-";
            //        theRole3.Course = "List-";
            //        work.MyRoleRepository.Insert(theRole3);


            //        MyRole theRole4 = new MyRole();
            //        theRole4.RoleName = "Teacher";
            //        theRole4.Upload = "List-Create-Edit-Delete-Details-";
            //        theRole4.Exam = "List-Create-Edit-Delete-Details-";
            //        theRole4.Book = "List-Details-";
            //        theRole4.BorrowedItem = "";
            //        theRole4.Shelf = "";
            //        theRole4.Course = "List-Create-Edit-Delete-Details-";
            //        work.MyRoleRepository.Insert(theRole4);
            //        work.Save();

            //  }
        }