Exemplo n.º 1
0
        public ActionResult Edit(Guid ID)
        {
            var ob = new CoursesStudentDetailtBCL().GetByScsId(ID);

            ob.CoursesJournalJoin             = new CoursesJournalBCL().GetByCJId((Guid)ob.CJId);
            ob.CoursesJournalJoin.CoursesJoin = new CoursesBCL().GetByCoId((Guid)ob.CoursesJournalJoin.CoId);

            var dropStuden = new List <SelectListItem>();
            var old        = new CoursesStudentDetailtBCL().GetAll().Where(q => q.CJId == ob.CJId).ToList();
            var all        = new StudentDetailtBCL().GetJoin().Where(q => q.CoId == ob.CoursesJournalJoin.CoId && (!old.Any(x => x.StudetId == q.StudetId) || q.StudetId == ob.StudetId)).ToList();

            foreach (var item in all)
            {
                dropStuden.Add(new SelectListItem()
                {
                    Text     = item.StudentJoin.FullName,
                    Value    = item.StudetId.ToString(),
                    Selected = item.StudetId == ob.StudetId
                });
            }

            ViewBag.CJ         = ob;
            ViewBag.dropStuden = dropStuden;
            return(View(ob));
        }
 public ActionResult anlyzeUser_byTime(DateTime?start, DateTime?end, bool?Status)
 {
     if (start == null || end == null)
     {
         if (Status == false)
         {
             ViewBag.test = false;
             var data = new StudentDetailtBCL().GetJoin().Where(x => x.CoursesJoin.Status == false).ToList();
             return(View("Index", data));
         }
         else
         {
             ViewBag.test = true;
             return(View("Index", new StudentDetailtBCL().GetJoin().Where(x => x.CoursesJoin.Status == true)));
         }
     }
     else
     {
         if (Status == false)
         {
             return(View("Index", new StudentDetailtBCL().GetJoin().Where(x => x.CoursesJoin.Status == true && x.CoursesJoin.StartDate >= start && x.CoursesJoin.EndDate <= end)));
         }
         else
         {
             ViewBag.test = true;
             return(View("Index", new StudentDetailtBCL().GetJoin().Where(x => x.CoursesJoin.Status == true && x.CoursesJoin.StartDate >= start && x.CoursesJoin.EndDate <= end)));
         }
     }
 }
        public ActionResult ListStudentByCoursesId(Guid coursesId)
        {
            ViewBag.coursesId = coursesId;
            var list = new StudentDetailtBCL().GetJoin().Where(x => x.CoId.Equals(coursesId)).ToList();

            return(PartialView(list));
        }
Exemplo n.º 4
0
        public ActionResult ListudenAjax(Guid Coursesid, Guid CJId)
        {
            var LisStudent = new StudentDetailtBCL().GetJoin().Where(x => x.CoId.Equals(Coursesid));
            var lst        = new List <CoursesStudentDetailtObject>();

            foreach (var item in LisStudent)
            {
                lst.Add(new CoursesStudentDetailtObject()
                {
                    Selected    = false,
                    StudetId    = item.StudetId,
                    StudentJoin = item.StudentJoin,
                    CJId        = CJId,
                    Description = ""
                });
            }
            return(PartialView("pv_dsvang", lst));
        }
Exemplo n.º 5
0
        public ActionResult getHvv(Guid CJId)
        {
            var nk           = new CoursesJournalBCL().GetByCJId(CJId);
            var hv_vang      = new CoursesStudentDetailtBCL().GetByCJId(CJId);
            var lst          = new List <CoursesStudentDetailtObject>();
            var hv_trong_lop = new StudentDetailtBCL().GetJoin().Where(q => q.CoId.Equals(nk.CoId));

            foreach (var item in hv_trong_lop)
            {
                var hv = hv_vang.FirstOrDefault(q => q.StudetId.Equals(item.StudetId));
                lst.Add(new CoursesStudentDetailtObject()
                {
                    ScsId       = hv != null ? hv.ScsId : Guid.NewGuid(),
                    Selected    = hv != null,
                    StudetId    = item.StudetId,
                    CJId        = CJId,
                    StudentJoin = item.StudentJoin,
                    Description = hv != null ? hv.Description : ""
                });
            }
            return(PartialView("pv_dsvang", lst));
        }
Exemplo n.º 6
0
        public ActionResult Create(Guid?ID)
        {
            if (!ID.HasValue)
            {
                ModelState.AddModelError("", "Chọn một Nhật kí để thêm");
                return(RedirectToAction("Index"));
            }
            Guid id = (Guid)ID;
            var  ob = new CoursesJournalBCL().GetByCJId(id);

            ob.CoursesJoin = new CoursesBCL().GetByCoId((Guid)ob.CoId);
            var dropStuden = new List <SelectListItem>();
            var old        = new CoursesStudentDetailtBCL().GetAll().Where(q => q.CJId == ob.CJId).ToList();
            var all        = new StudentDetailtBCL().GetJoin().Where(q => q.CoId == ob.CoId && !old.Any(x => x.StudetId == q.StudetId)).ToList();

            foreach (var item in all)
            {
                dropStuden.Add(new SelectListItem()
                {
                    Text  = item.StudentJoin.FullName,
                    Value = item.StudetId.ToString()
                });
            }

            ViewBag.CJ         = ob;
            ViewBag.dropStuden = dropStuden;
            if (dropStuden.Count <= 0)
            {
                ModelState.AddModelError("StudetId", "Không có học viên nào trong lớp học để thêm!");
            }

            return(View(new CoursesStudentDetailtObject()
            {
                CJId = ob.CJId
            }));
        }