예제 #1
0
 public ActionResult Create(GroupInstance groupinstance)
 {
     if (ModelState.IsValid)
     {
         //default recurrence once a week forever
         RecurrencePattern rp = new RecurrencePattern(FrequencyType.Weekly);
         groupinstance.RecurrenceRule = "RRULE:" + rp.ToString();
         db.GroupInstances.Add(groupinstance);
         db.SaveChanges();
         return Content(Boolean.TrueString);
     }
     //TODO: review error handling. This will fail since it is not filtering dropdowns for overlapping events!!!
     ViewBag.GroupId = new SelectList(db.Groups, "GroupId", "Name", groupinstance.GroupId);
     ViewBag.ClassroomId = new SelectList(db.Classrooms, "ClassroomID", "Name", groupinstance.ClassroomId);
     return Content("Please review your form");
 }
예제 #2
0
        private void MakeFilteredDropdowns(string start, string end, GroupInstance groupinstance, int id=0)
        {
            var groups = db.Groups;
            var classrooms = db.Classrooms;

            if (start != null && end != null)
            {
                IQueryable<Group> filteredGroups;
                IQueryable<Classroom> filteredClassrooms;
                GetFilteredInfo(start, end, id, groups, classrooms, out filteredGroups, out filteredClassrooms);
                ViewBag.GroupId = new SelectList(filteredGroups, "GroupId", "Name", groupinstance.GroupId);
                ViewBag.ClassroomId = new SelectList(filteredClassrooms, "ClassroomID", "Name", groupinstance.ClassroomId);
            }
            else
            {
                    ViewBag.GroupId = new SelectList(groups, "GroupId", "Name", groupinstance.GroupId);
                    ViewBag.ClassroomId = new SelectList(classrooms, "ClassroomID", "Name", groupinstance.ClassroomId);
            }
        }
예제 #3
0
        public ActionResult EditFromResize(GroupInstance groupInstance)
        {
            if (ModelState.IsValid)
            {

            }
            return Json(true);
        }
예제 #4
0
 public String SaveDroppedGroup(int GroupId, string Date)
 {
     if (GroupId > 0 && !String.IsNullOrEmpty(Date))
     {
         var GroupInstance = new GroupInstance();
         DateTime dt = Convert.ToDateTime(Date);
         GroupInstance.StartDateTime = dt;
         GroupInstance.EndDateTime = dt.AddHours(1);
         GroupInstance.GroupId = GroupId;
         db.GroupInstances.Add(GroupInstance);
         db.SaveChanges();
         return Boolean.TrueString;
     }
     return Boolean.FalseString;
 }
예제 #5
0
        public ActionResult Edit(GroupInstance groupinstance)
        {
            if (ModelState.IsValid)
            {
                var inst = db.GroupInstances.Where(x => x.GroupInstanceId == groupinstance.GroupInstanceId).First();
                if (groupinstance.RecurrenceRule != null)
                {

                    groupinstance.StartDateTime = inst.StartDateTime.Date + new TimeSpan(groupinstance.StartDateTime.Hour, groupinstance.StartDateTime.Minute, 0);
                    groupinstance.EndDateTime = inst.EndDateTime.Date + new TimeSpan(groupinstance.EndDateTime.Hour, groupinstance.EndDateTime.Minute, 0);
                }
                db.Entry(inst).State = EntityState.Detached;
                db.Entry(groupinstance).State = EntityState.Modified;
                db.SaveChanges();
                return Content(Boolean.TrueString);
            }
            ViewBag.GroupId = new SelectList(db.Groups, "GroupId", "Name", groupinstance.GroupId);
            ViewBag.ClassroomId = new SelectList(db.Classrooms, "ClassroomID", "Name", groupinstance.ClassroomId);
            return Content("Review your form");
        }