Exemplo n.º 1
0
        public ActionResult GetData(string n, string v)
        {
            object result = null;
            Guid   ID     = Guid.Parse(v);

            switch (n)
            {
            case "MaLop":
            case "KhoaHoc":
                var c = new CoursesBCL().GetByCoId(ID);
                result = new { c.CoId, c.CourseId, c.CourseName, c.StartDate, c.EndDate, c.TotalNumber, c.Status, c.Description };
                break;

            case "GiaoVien":
                result = (from g in new ExpertsDetailtBCL().GetByCoId(ID)
                          where g.CoursesJoin.Status == false
                          select new { g.ExpertsJoin.FullName, g.ExpertsJoin.Address, g.ExpertsJoin.Mobile, g.ExpertsJoin.Status }).ToList();
                break;

            case "Delete":
                result = new SchedulersBCL().Delete(ID);
                break;

            default:
                break;
            }
            return(Json(result));
        }
Exemplo n.º 2
0
 public ActionResult Create(SchedulersObjects ob)
 {
     if (ob != null)
     {
         ob.ScId = Guid.NewGuid();
         var  allsc = new SchedulersBCL().GetJoin();
         bool oke   = !allsc.Any(q => q.CoId == ob.CoId && q.WeId == ob.WeId && q.ShiftId == ob.ShiftId);
         if (!oke)
         {
             ModelState.AddModelError("", "Một khóa học ko thể xuất hiện 2 lần trong 1 ca học");
         }
         else
         {
             if (new SchedulersBCL().Insert(ob))
             {
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ModelState.AddModelError("", "Thêm thất bại");
             }
         }
     }
     return(View());
 }
Exemplo n.º 3
0
        public List <SchedulersObjects> GetScheduler(Guid ID_Expert)
        {
            List <SchedulersObjects> lst = new List <SchedulersObjects>();
            var listExpertDetail         = new ExpertsDetailtBCL().GetJoin().Where(q => q.ExpertId == ID_Expert);
            var listSchedeler            = new SchedulersBCL().GetJoin();

            foreach (var expd in listExpertDetail)
            {
                lst.AddRange(listSchedeler.Where(q => q.CoursesJoin.Status == false && q.CoId == expd.CoursesJoin.CoId));
            }
            return(lst);
        }