예제 #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 static string 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)
            {
                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(theAlert);
                    }
                }
            }


            return("");
        }