public ActionResult GetListByCoursesId(Guid?coursesId) { ViewBag.coursesId = coursesId; var list = new CoursesJournalBCL().GetJoin().OrderByDescending(q => q.DayOf.GetValueOrDefault()).Where(x => x.CoId.Equals(coursesId)).ToList(); return(PartialView(list)); }
public ActionResult Edit(Guid Id, int IsOption = 0) { CoursesJournalObjects objCourses = new CoursesJournalBCL().GetByCJId(Id); objCourses.CoursesJoin = new CoursesBCL().GetByCoId(objCourses.CoId.Value); List <CoursesObjects> lstCourse = new CoursesBCL().GetAll(); ViewBag.ListCourse = lstCourse; ViewBag.IsOption = IsOption; return(View(objCourses)); }
public JsonResult NhatKi(Guid idLopHoc) { string rs = ""; var data = new CoursesJournalBCL().GetJoin().Where(q => q.CoursesJoin.Status == false && q.CoursesJoin.CoId == idLopHoc).OrderByDescending(m => m.DayOf.Value).ToList(); if (data.Count > 0) { rs += "<option value>Chọn một nhật kí</option>"; } foreach (var item in data) { rs += string.Format(@"<option {0} value='{1}'>{2}</option>", item.CoId == idLopHoc ? "selected" : "", item.CJId, item.CoursesJoin.CourseName + " - " + item.DayOf.Value.ToString("dd/mm/yyyy")); } return(Json(rs)); }
// GET: CoursesJournal public ActionResult Index(Guid?coId) { var list = new List <CoursesJournalObjects>(); ViewBag.ALL = new CoursesBCL().GetAll(); if (coId == null || coId.Equals(Guid.Empty)) { list = new CoursesJournalBCL().GetJoin().OrderByDescending(q => q.DayOf.Value).ToList(); } else { list = new CoursesJournalBCL().GetJoin().Where(x => x.CoId.Equals(coId)).OrderByDescending(q => q.DayOf.Value).ToList(); ViewBag.check = coId; } return(View(list)); }
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)); }
public ActionResult Edit(CoursesJournalObjects model, int IsOption) { var b = new CoursesJournalBCL().Update(model); if (b) { if (IsOption == 1) { return(RedirectToAction("Edit", "Courses", new { Id = model.CoId })); } else { return(RedirectToAction("Index", "CoursesJournal", new { })); } } else { ModelState.AddModelError("", "them moi that bai"); } return(View()); }
public ActionResult Create(CoursesJournalObjects objCJ, int IsOption = 0) { var b = new CoursesJournalBCL().Insert(objCJ); if (b) { if (IsOption == 0) { return(RedirectToAction("Index", "CoursesJournal")); } else { return(RedirectToAction("Edit", "Courses", new { Id = objCJ.CoId })); } } else { ModelState.AddModelError("", "them moi that bai"); } return(View()); }
// GET: CoursesJournal/Create public ActionResult Create(Guid?Coursesid = null) { if (Coursesid.HasValue) { var nk = new CoursesJournalBCL().GetAll().FirstOrDefault(q => q.CoId.Value == Coursesid.Value && q.DayOf.Value.ToShortDateString().Equals(DateTime.Now.ToShortDateString())); if (nk != null) { return(RedirectToAction("Edit", new { Id = nk.CJId })); } } ViewBag.Coursesid = Coursesid; if (Coursesid == null) { Coursesid = (Guid) new CoursesBCL().GetAll().Select(x => x.CoId).FirstOrDefault(); } ViewBag.LisStudent = new StudentDetailtBCL().GetJoin().Where(x => x.CoId.Equals(Coursesid)).ToList(); CoursesJournalObjects ob = new CoursesJournalObjects() { CJId = Guid.NewGuid() }; return(View(ob)); }
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 })); }
public JsonResult LopHoc(Guid?id_lop) { string r = ""; IEnumerable <CoursesJournalObjects> data; if (id_lop.HasValue) { data = new CoursesJournalBCL().GetJoin().Where(q => q.CoursesJoin.CoId == id_lop.Value).OrderByDescending(m => m.DayOf.Value); } else { data = new CoursesJournalBCL().GetJoin().OrderByDescending(m => m.DayOf.Value); } var per = new Models.Permission(); foreach (var item in data) { r += string.Format(@" <tr> <td> {2} </td> <td> {0} - {1} </td> <td> {3} </td> <td> {4} </td> <td> {5} {6} {7} </td> </tr> ", item.CoursesJoin.CourseId , item.CoursesJoin.CourseName , item.DayOf.Value.ToString("dd/MM/YYYY") , item.Contents , item.Description , per.IsAllow(eAction.Search, eFea.QLCTHV) ? "<a href='" + @Url.Action("Index", "CoursesStudentDetailt", new { ID = item.CJId }) + "' class='btn btn-info'>DSHV Vắng</a>" : "" , per.IsAllow(eAction.Edit, eFea.QLNKGD) ? "<a href=" + Url.Action("Edit", "CoursesJournal", new { ID = item.CJId }) + " class='btn btn-default'>Sửa</a>" : "" , per.IsAllow(eAction.Delete, eFea.QLNKGD) ? "<span class='btn btn-warning btn-delete' data-value='" + item.CJId + "'>Xóa</span>" : "" ); } r += @"<div class='modal fade' id='myModal' role='dialog'> <div class='modal-dialog'> <!-- Modal content--> <div class='modal-content'> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal'>×</button> <h4 class='modal-title'><i class='fa fa-warning'>Chú ý</i></h4> </div> <div class='modal-body'> <div class='modal-body-contents'> </div> </div> <div class='modal-footer'> <button type='button' class='btn btn-warning btn-ajax'>Xác nhận</button> <button type='button' class='btn btn-default' data-dismiss='modal'>Hủy</button> </div> </div> </div> </div> <script> $('.btn-delete').click(function () { if(confirm('Bạn có chắc chắn xóa?')!=true) return; let elementDelete = $(this); myAjax('Delete', { ID: $('this'.data('value')) }, function (d, xhr, r) { if(d){ if (elementDelete) { $(elementDelete).parents('tr').first().hide(); elementDelete = undefined; } else{ alert('Xảy ra lỗi, Trang sẽ được tải lại') } }else{ alert('Xóa thất bại'); } }, function (d) { alert('Xảy ra lỗi, Trang sẽ được tải lại') window.location.reload(); }, function (d) { }); }); </script>"; return(Json(r)); }