Exemplo n.º 1
0
        public ActionResult AddAssignment(Agent agent, Assignment assin)
        {
            AssignmentRepo assign = new AssignmentRepo();

            assign.Add(assin, agent);

            return(Redirect("/"));
        }
Exemplo n.º 2
0
        public ActionResult CekEmail(string email = "")
        {
            bool hasil = AssignmentRepo.cekEmail(email) == null;

            return(Json(new
            {
                success = hasil
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult Edit(long id)
        {
            AssignmentViewModel assignment = new AssignmentViewModel();

            assignment             = AssignmentRepo.ById(id);
            ViewBag.tanggalmulai   = assignment.start_date.ToString("yyyy'-'MM'-'dd");
            ViewBag.tanggalselesai = assignment.end_date.ToString("yyyy'-'MM'-'dd");
            ViewBag.BiodataList    = new SelectList(MonitoringRepo.ByNameBiodataforEdit(assignment.biodata_id), "id", "name");
            return(PartialView("_Edit", assignment));
        }
Exemplo n.º 4
0
        public ActionResult Hold(AssignmentViewModel model)
        {
            ResponResultViewModel result = AssignmentRepo.CreateHold(model);

            return(Json(new
            {
                success = result.Success,
                message = result.Message,
                entity = result.Entity
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public ActionResult Delete(AssignmentViewModel model)
        {
            ResponseResult result = AssignmentRepo.Delete(model);

            return(Json(new
            {
                success = result.Success,
                message = result.ErrorMessage,
                entity = result.Entity
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public ActionResult Search(DateTime search = default(DateTime))
        {
            ViewBag.tanggalharini = DateTime.Now.ToString("yyyy'-'MM'-'dd");
            List <AssignmentViewModel> Assignment = new List <AssignmentViewModel>(
                AssignmentRepo.Search(search)
                );

            foreach (var item in Assignment)
            {
                item.TanggalMulai   = item.start_date.ToString("dd'-'MM'-'yyyy");
                item.TanggalSelesai = item.end_date.ToString("dd'-'MM'-'yyyy");
            }
            return(PartialView("_Search", Assignment));
        }
Exemplo n.º 7
0
        public bool AssignedHomework(AssignedHomework objModelClass)
        {
            bool isAssigned = false;

            try
            {
                if (HwAdded)
                {
                    isAssigned = new AssignmentRepo().AddAssignment(new Assignment
                    {
                        HomeWorkID = objModelClass.HomeworkID,
                        CourseID   = objModelClass.CourseID,
                        TeacherID  = objModelClass.TeacherID
                    });
                }
            }
            catch
            {
                throw;
            }
            return(isAssigned);
        }
Exemplo n.º 8
0
        public List <ExtendedHomeworkPlan> GetExtendedHomeworkPlan(int id)
        {
            try
            {
                List <Assignment>   assignments   = new AssignmentRepo().GetAllAssignments();
                List <Homework>     homeworks     = new HomeworkRepo().GetAllHomework();
                List <HomeworkPlan> homeworkPlans = new HomeworkPlanRepo().GetHomeworkPlans()
                                                    .Where(homeworkPlan => homeworkPlan.StudentID == id).ToList();

                var result = from plan in homeworkPlans
                             join homework in homeworks
                             on plan.HomeworkID equals homework.HomeworkID
                             select new ExtendedHomeworkPlan
                {
                    StudentID     = id,
                    HomeworkID    = homework.HomeworkID,
                    Description   = homework.Description,
                    Deadline      = homework.Deadline,
                    ReqTime       = homework.ReqTime,
                    PriorityLevel = plan.PriorityLevel,
                    isCompleted   = plan.isCompleted
                };

                if (result.Any())
                {
                    return(result.ToList());
                }
                else
                {
                    throw new PrometheusException("No Plans Found!");
                    //DeviseHomeworkPlanByDeadline(id);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 9
0
        public List <AssignedHomework> GetAssignedHomework(int id)
        {
            try
            {
                List <EnrolledCourse> enrolledCourses = GetCoursesByStudentID(id);
                List <Assignment>     assignments     = new AssignmentRepo().GetAllAssignments();
                List <Homework>       homeworks       = new HomeworkRepo().GetAllHomework();

                var result = from course in enrolledCourses
                             join assignment in assignments
                             on course.CourseID equals assignment.CourseID
                             join homework in homeworks
                             on assignment.HomeWorkID equals homework.HomeworkID
                             select new AssignedHomework
                {
                    AssignmentID    = assignment.AssignmentID,
                    Description     = homework.Description,
                    Deadline        = homework.Deadline,
                    ReqTime         = homework.ReqTime,
                    LongDescription = homework.LongDescription,
                    CourseName      = course.Name,
                    HomeworkID      = homework.HomeworkID
                };
                if (result.Any())
                {
                    return(result.ToList());
                }
                else
                {
                    throw new PrometheusException("No Assignments Found !");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 10
0
 public ActionResult Delete(int id)
 {
     return(PartialView("_IsDelete", AssignmentRepo.GetAssignment(id)));
 }
Exemplo n.º 11
0
 public ActionResult Hold(int id)
 {
     return(PartialView("_Hold", AssignmentRepo.GetAssignment(id)));
 }
Exemplo n.º 12
0
 public ActionResult MarkAsDone(int id)
 {
     return(PartialView("_MarkAsDone", AssignmentRepo.GetAssignment(id)));
 }
Exemplo n.º 13
0
 public ActionResult Edit(int id)
 {
     ViewBag.Biodatalist = new SelectList(BiodataRepo.All(""), "id", "name");
     return(PartialView("_Edit", AssignmentRepo.GetAssignment(id)));
 }
Exemplo n.º 14
0
 // GET: Assignment
 public ActionResult Index()
 {
     return(View(AssignmentRepo.All("")));
 }
Exemplo n.º 15
0
 public ActionResult Delete(long id)
 {
     return(PartialView("_Delete", AssignmentRepo.ById(id)));
 }
Exemplo n.º 16
0
 public ActionResult Hold(long id)
 {
     return(PartialView("_Hold", AssignmentRepo.ById(id)));
 }
Exemplo n.º 17
0
 public AssignmentsController()
 {
     assignmentRepo = unit.AssignmentRepo();
 }
Exemplo n.º 18
0
 public ActionResult List(string search)
 {
     return(PartialView("_List", AssignmentRepo.All(search)));
 }