public ActionResult DetailedSchedule(string studentId)
        {
            if (studentId == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            User student = usersRepo.UserById(studentId);

            if (student == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            WeekDays weekDay = schedRepo.GetCurrentDay();

            ViewBag.StudentsName = student.ToString();

            return(View(schedRepo.StudentSchedules(studentId)
                        .Where(s => s.WeekDay == weekDay)
                        .Select(s => new PartialScheduleVM
            {
                SubjectName = s.Course.Subject.Name,
                TeacherName = s.Course.Teacher.ToString(),
                Classroom = s.Classroom.Name + " (" + s.Classroom.Location + ")",
                WeekDay = weekDay.ToString() + "s",
                BeginningTime = s.BeginningTime,
                EndingTime = s.EndingTime
            })
                        .ToList()));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Dog jango = new Dog()
            {
                Id   = 1,
                Name = "Jango",
                //Type = "Dog",
                Race = "Poodle"
            };

            jango.PrintInfo();
            jango.Eat();

            jango.Bark();

            Console.WriteLine();

            Animal dambo = new Animal()
            {
                Id   = 2,
                Name = "Dambo",
                Type = AnimalTypes.Other
            };

            dambo.PrintInfo();
            dambo.Eat();

            Console.WriteLine();

            Cat kitty = new Cat()
            {
                Id   = 3,
                Name = "Kitty",
                //Type = "Cat",
                Laziness = "Very lazy"
            };

            kitty.PrintInfo();
            kitty.Meow();
            kitty.Eat();

            Console.WriteLine();

            WeekDays tuesday = WeekDays.Tuesday;

            Console.WriteLine(tuesday);
            Console.WriteLine(tuesday.ToString() == "Tuesday");
            Console.WriteLine(tuesday == (WeekDays)2);

            Console.WriteLine();

            Mouse mouse = new Mouse();
        }
Beispiel #3
0
        public void ShowDays(WeekDays?weekDays, Show showFormat = Show.Names)
        {
            //WeekDays daysToShow;

            //Traditional switch
            //switch (weekDays)
            //{
            //    case WeekDays.Weekend:
            //        daysToShow = _weekend;
            //        break;
            //    case WeekDays.Workdays:
            //        daysToShow = _workdays;
            //        break;
            //    case WeekDays.Week:
            //        daysToShow = _week;
            //        break;
            //    default:
            //        break;
            //}

            //C# Switch expression
            WeekDays daysToShow = weekDays switch
            {
                WeekDays.Weekend => _weekend,
                WeekDays.Workdays => _workdays,
                WeekDays.Week => _week,
                _ => default
            };


            foreach (string day in getDays(showFormat == Show.Names ? daysToShow.ToString() : ((int)daysToShow).ToString()))
            {
                Console.WriteLine(day);
            }

            IEnumerable <string> getDays(string days)
            {
                return(days.Split(", "));
            }
        }
Beispiel #4
0
        static void CreateOrderFile(WeekDays day, OrderFileType orderFileType)
        {
            string dayOrderFilePath = Path.Combine(WORK_PATH, $"{day.ToString()}_{orderFileType.ToString()}.html");

            int           numberOfColumns = COLUMNS_COLD;
            List <string> dayOrders       = new List <string>
            {
                "<html><link rel='stylesheet' type='text/css' href='pageCold.css'/><body><table cellpadding='0' cellspacing='0' >"
            };

            if (orderFileType == OrderFileType.Hot)
            {
                numberOfColumns = COLUMNS_HOT;
                dayOrders       = new List <string>
                {
                    "<html><link rel='stylesheet' type='text/css' href='pageHot.css'/><body><table cellpadding='0' cellspacing='0' >"
                };
            }

            int columnCounter = 0;

            foreach (Food foodChoice in WeekMenu[day])
            {
                foreach (string personLocation in PersonLocationChoices[day].Keys)
                {
                    string personName = personLocation.Split('@')[0];
                    string location   = personLocation.Split('@')[1];

                    IEnumerable <Food> choices;
                    if (orderFileType == OrderFileType.Hot)
                    {
                        choices = PersonLocationChoices[day][personLocation].Where(f => f.MainDish == foodChoice.MainDish && f.IsHot);
                    }
                    else if (orderFileType == OrderFileType.Cold)
                    {
                        choices = PersonLocationChoices[day][personLocation].Where(f => f.MainDish == foodChoice.MainDish && !f.IsHot);
                    }
                    else
                    {
                        choices = PersonLocationChoices[day][personLocation].Where(f => f.MainDish == foodChoice.MainDish && f.SideDish != null);
                    }

                    foreach (Food food in choices)
                    {
                        if (columnCounter % numberOfColumns == 0)
                        {
                            dayOrders.Add("<tr>");
                        }

                        if (orderFileType == OrderFileType.Side)
                        {
                            dayOrders.Add($"<td><div class='tag''><div class='foodName'>{food.SideDish}</div><div class='personName'>{personName}</div><div class='location'>{location}</div></div></td>");
                        }
                        else
                        {
                            dayOrders.Add($"<td><div class='tag''><div class='foodName'>{food.MainDish}</div><div class='personName'>{personName}</div><div class='location'>{location}</div></div></td>");
                        }

                        if (columnCounter % numberOfColumns == numberOfColumns - 1)
                        {
                            dayOrders.Add("</tr>");
                        }

                        columnCounter++;
                    }
                }
            }

            if (columnCounter > 0 && columnCounter % numberOfColumns != numberOfColumns - 1)
            {
                dayOrders.Add("</tr>");
            }

            dayOrders.Add("</table></body></html>");

            if (columnCounter > 0)
            {
                File.WriteAllLines(dayOrderFilePath, dayOrders);
            }
        }
Beispiel #5
0
        public JobTriggerContent ScheduleMonthlyJob(long jobId, DateTime startDateTime, DateTime endDateTime, List <Months> selectedMonths, OccurenceType monthlyOccurence, WeekDays weekday, int?everyHours = null, int?everyMinute = null)
        {
            if (jobId < 1 || selectedMonths.Count < 1)
            {
                return(_result.ErrorToObject(new JobTriggerContent(), "Invalid parameter(s)!"));
            }

            var requestArg = JsonConvert.SerializeObject(
                new { TriggerType = 4, JobDetailID = jobId, MonthlyType = 2, MonthlyOccurance = (short)monthlyOccurence, SelectedMonths = string.Join(",", selectedMonths), StartDateTime = startDateTime, EndDateTime = endDateTime, EveryHours = everyHours, EveryMinute = everyMinute, Weekday = weekday.ToString() });

            requestArg = JsonConvert.SerializeObject(new { Data = requestArg });
            Task <Result> x = RequestHandler.SendRequestAsync(
                string.Empty,
                "api/UserSchedule/ScheduleJob",
                HttpMethod.Post,
                RouteStyle.Rpc,
                requestArg);

            x.Wait();
            return(x.Result.JsonToObject(new JobTriggerContent(), "TriggerContent"));
        }
Beispiel #6
0
        public override XmlElement Export(XmlDocument doc, XmlElement parent)
        {
            XmlElement current = base.Export(doc, parent);

            if (ActiveFrom != null)
            {
                current.SetAttribute("ACTIVE_FROM", ActiveFrom.ToString());
            }
            if (ActiveTill != null)
            {
                current.SetAttribute("ACTIVE_TILL", ActiveTill.ToString());
            }
            if (Confcal != null)
            {
                current.SetAttribute("CONFCAL", Confcal.ToString());
            }
            if (Date != null)
            {
                current.SetAttribute("DATE", Date.ToString());
            }
            if (Days != null)
            {
                current.SetAttribute("DAYS", Days.ToString());
            }
            if (DaysAndOr != null)
            {
                current.SetAttribute("DAYS_AND_OR", DaysAndOr.ToString());
            }
            if (DaysCal != null)
            {
                current.SetAttribute("DAYSCAL", DaysCal.ToString());
            }
            if (Level != null)
            {
                current.SetAttribute("LEVEL", Level.ToString());
            }
            if (MaxWait != null)
            {
                current.SetAttribute("MAXWAIT", MaxWait.ToString());
            }
            if (Retro != null)
            {
                current.SetAttribute("RETRO", Retro.ToString());
            }
            if (Shift != null)
            {
                current.SetAttribute("SHIFT", Shift.ToString());
            }
            if (ShiftNum != null)
            {
                current.SetAttribute("SHIFTNUM", ShiftNum.ToString());
            }
            if (TagsActiveFrom != null)
            {
                current.SetAttribute("TAGS_ACTIVE_FROM", TagsActiveFrom.ToString());
            }
            if (TagsActiveTill != null)
            {
                current.SetAttribute("TAGS_ACTIVE_TILL", TagsActiveTill.ToString());
            }
            if (WeekDays != null)
            {
                current.SetAttribute("WEEKDAYS", WeekDays.ToString());
            }
            if (Weekscal != null)
            {
                current.SetAttribute("WEEKSCAL", Weekscal.ToString());
            }
            if (JAN != null)
            {
                current.SetAttribute("JAN", JAN.ToString());
            }
            if (FEB != null)
            {
                current.SetAttribute("FEB", FEB.ToString());
            }
            if (MAR != null)
            {
                current.SetAttribute("MAR", MAR.ToString());
            }
            if (APR != null)
            {
                current.SetAttribute("APR", APR.ToString());
            }
            if (MAY != null)
            {
                current.SetAttribute("MAY", MAY.ToString());
            }
            if (JUN != null)
            {
                current.SetAttribute("JUN", JUN.ToString());
            }
            if (JUL != null)
            {
                current.SetAttribute("JUL", JUL.ToString());
            }
            if (AUG != null)
            {
                current.SetAttribute("AUG", AUG.ToString());
            }
            if (SEP != null)
            {
                current.SetAttribute("SEP", SEP.ToString());
            }
            if (OCT != null)
            {
                current.SetAttribute("OCT", OCT.ToString());
            }
            if (NOV != null)
            {
                current.SetAttribute("NOV", NOV.ToString());
            }
            if (DEC != null)
            {
                current.SetAttribute("DEC", DEC.ToString());
            }
            return(current);
        }