public bool Insert(CoursesObjects ob) { var db = new eTrainingScheduleEntities(); var data = db.sp_tbl_S07_Courses_INSERT(ob.CoId, ob.CourseId, ob.CourseName, ob.TotalNumber, ob.StartDate, ob.EndDate, ob.Status, ob.Description, ob.Deleted); return(true); }
public CoursesObjects GetByCoId(Guid ID) { var db = new eTrainingScheduleEntities(); var list = db.sp_tbl_S07_Courses_GetByCoId(ID); foreach (var item in list) { CoursesObjects obj = new CoursesObjects(); obj.CoId = item.CoId; obj.CourseId = item.CourseId; obj.CourseName = item.CourseName; obj.TotalNumber = item.TotalNumber; obj.StartDate = item.StartDate; obj.EndDate = item.EndDate; obj.Status = item.Status == true; obj.Description = item.Description; obj.Deleted = item.Deleted; return(obj); } return(null); }
public ActionResult Edit(CoursesObjects ob, FormCollection collection) { try { // TODO: Add update logic here ob.Deleted = false; if (ob != null && new CoursesBCL().Update(ob)) { return(RedirectToAction("Index")); } } catch { } return(View()); }
public List <CoursesObjects> GetAll() { List <CoursesObjects> lst = new List <CoursesObjects>(); var db = new eTrainingScheduleEntities(); var list = db.sp_tbl_S07_Courses_GetAll(); foreach (var item in list) { if (item.Deleted == true) { continue; } CoursesObjects ob = new CoursesObjects(); ob.CoId = item.CoId; ob.CourseId = item.CourseId; ob.CourseName = item.CourseName; ob.TotalNumber = item.TotalNumber; ob.StartDate = item.StartDate; ob.EndDate = item.EndDate; ob.Status = item.Status == true; ob.Description = item.Description; ob.Deleted = item.Deleted; lst.Add(ob); } return(lst); }
/// <summary> /// Khi thiết lập cho 1 khóa học trạng thái: "Khóa đã tốt nghiệp" --> thì cập nhật trạng thái cho /// tất cả các học viên từ "Đang theo học" --> "Đã hoàn thành" nếu học viên đó ko thuộc của lớp /// nào nữa. /// </summary> /// <param name="ob"></param> /// <returns></returns> public bool Update(CoursesObjects ob) { if (ob.Status == true) { var allDetail = new StudentDetailtBCL().GetJoin(); var grstd = allDetail.GroupBy(q => q.StudetId); var bcl = new StudentBCL(); foreach (var item in grstd) { if (item.Count(q => q.CoursesJoin.Status == false) == 1) { var std = bcl.GetByStudetId(item.Key.Value); std.Status = true; bcl.Update(std); } } } return(new CoursesDao().Update(ob)); }
public ActionResult Create(CoursesObjects ob, FormCollection collection) { try { // TODO: Add insert logic here if (ob != null) { ob.CoId = Guid.NewGuid(); ob.Deleted = false; ob.Status = false; if (new CoursesBCL().Insert(ob)) { return(RedirectToAction("Index")); } } } catch { } return(View()); }
public bool Insert(CoursesObjects ob) { return(new CoursesDao().Insert(ob)); }
public bool Update(CoursesObjects ob) { return(new CoursesDao().Update(ob)); }