Ejemplo n.º 1
0
        public void Execute()
        {
            InstructorBusiness InsBO   = new InstructorBusiness();
            CalendarBusiness   CalenBO = new CalendarBusiness();
            //Tim nhung instructor co API Token
            List <Instructor> InstructorsWithAPI = InsBO.Find(ins => ins.ApiToken != null);

            foreach (var Instructor in InstructorsWithAPI)
            {
                CalenBO.SyncInstructorCalendar(Instructor.InstructorID);
            }

            SimpleLog.Info("Calendar for " + InstructorsWithAPI.Count + " instructors synced.");
        }
        public ActionResult SyncManual()
        {
            //Tim instructor da dang nhạp vao
            string     Username             = this.HttpContext.User.Identity.Name;
            User       User                 = AccBO.GetUserByUsername(Username);
            Instructor AuthorizedInstructor = InsBO.GetInstructorByUserID(User.UserID);

            CalendarBusiness CalBO = new CalendarBusiness();

            CalBO.SyncInstructorCalendar(AuthorizedInstructor.InstructorID);

            TempData["Message"] = "Your calendar was synced to Google Calendar at "
                                  + DateTime.Now.ToString("dd-MM-yyyy  HH:mm:ss");
            return(RedirectToAction("TeachingCalendar"));
        }