コード例 #1
0
        public async Task <IActionResult> Move(int cid, CourseActions direction)
        {
            var curUser = await _userManager.GetUserAsync(this.User);

            int sid = curUser.StudentId;

            if (direction == CourseActions.WishlistPriorityUp)
            {
                await _wishlistService.updatePriority(sid, cid, MoveDirection.MoveUp);
            }
            else if (direction == CourseActions.WishlistPriorityDown)
            {
                await _wishlistService.updatePriority(sid, cid, MoveDirection.MoveDown);
            }
            return(RedirectToAction("Wishlist", "Home"));
        }
コード例 #2
0
        public void addCourse(string name, string teacher, string room, string selectedday, string from, string to)
        {
            try
            {
                string[] dateFrom  = from.Split(':');
                DateTime dateBegin = new DateTime();
                dateBegin = dateBegin.AddHours(double.Parse(dateFrom[0]));
                dateBegin = dateBegin.AddMinutes(double.Parse(dateFrom[1]));
                dateBegin = dateBegin.AddYears(2018);

                string[] dateTo  = to.Split(':');
                DateTime dateEnd = new DateTime();
                dateEnd = dateEnd.AddHours(double.Parse(dateTo[0]));
                dateEnd = dateEnd.AddMinutes(double.Parse(dateTo[1]));
                dateEnd = dateEnd.AddYears(2018);

                if (CourseActions.CourseAdd(name, teacher, room, int.Parse(selectedday), dateBegin, dateEnd, GetSubjectId))
                {
                    MessageBox.Show("Course has been added successfully!");
                    SendMessage("Course added");
                }
                else
                {
                    MessageBox.Show("An unknown error as occoured!");
                }
            }
            catch (CourseAlreadyExistsException ex)
            {
                ExceptionLogger.LogException(ex);
                MessageBox.Show("A course with this name on this subject already exists!");
            }
            catch (TeacherBusyException ex)
            {
                ExceptionLogger.LogException(ex);
                MessageBox.Show("This teacher has another course at this time!");
            }
            catch (InvalidTimeException ex)
            {
                ExceptionLogger.LogException(ex);
                MessageBox.Show("The start time of the Course cannot be greater than the end time of the Course.");
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
                MessageBox.Show(e.Message);
            }
        }
コード例 #3
0
 public void delCourse(int id)
 {
     try
     {
         CourseActions.DeleteCourse(id);
         MessageBox.Show("The course has been successfully removed!");
         NotifyPropertyChanged("Subjects");
         GetCoursesFromLoggedInUsers();
         NotifyPropertyChanged("MondayCourses");
         NotifyPropertyChanged("TuesdayCourses");
         NotifyPropertyChanged("WednesdayCourses");
         NotifyPropertyChanged("ThursdayCourses");
         NotifyPropertyChanged("FridayCourses");
         NotifyPropertyChanged("SaturdayCourses");
         NotifyPropertyChanged("SundayCourses");
     }
     catch (Exception e)
     {
         ExceptionLogger.LogException(e);
         MessageBox.Show(e.Message);
     }
 }
コード例 #4
0
ファイル: Index.cshtml.cs プロジェクト: HuyHuy0933/Azure_Lab
 public IndexModel(ILogger <IndexModel> logger, IMemoryCache cache)
 {
     this.cache = cache;
     _logger    = logger;
     action     = new CourseActions((List <Course>)cache.Get("dtset"));
 }
コード例 #5
0
 public CreateModel(IMemoryCache cache)
 {
     this.cache = cache;
     action     = new CourseActions((List <Course>)cache.Get("dtset"));
     count      = (int)cache.Get("count");
 }
コード例 #6
0
 public EditModel(IMemoryCache cache)
 {
     this.cache = cache;
     action     = new CourseActions((List <Course>)cache.Get("dtset"));
 }