示例#1
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());
 }
示例#2
0
        public bool Insert(SchedulersObjects ob)
        {
            var db   = new eTrainingScheduleEntities();
            var data = db.sp_tbl_S07_Schedulers_INSERT(ob.ScId, ob.WeId, ob.ShiftId, ob.CoId, ob.Description);

            return(true);
        }
示例#3
0
 public ActionResult Edit(SchedulersObjects ob)
 {
     if (ob != null && new SchedulersBCL().Update(ob))
     {
         return(RedirectToAction("Index"));
     }
     return(View());
 }
示例#4
0
        public SchedulersObjects GetByScId(Guid ID)
        {
            var db   = new eTrainingScheduleEntities();
            var list = db.sp_tbl_S07_Schedulers_GetByScId(ID);

            foreach (var item in list)
            {
                SchedulersObjects obj = new SchedulersObjects();
                obj.ScId = item.ScId; obj.WeId = item.WeId; obj.ShiftId = item.ShiftId; obj.CoId = item.CoId; obj.Description = item.Description;
                return(obj);
            }
            return(null);
        }
示例#5
0
        public List <SchedulersObjects> GetAll()
        {
            List <SchedulersObjects> lst = new List <SchedulersObjects>();
            var db   = new eTrainingScheduleEntities();
            var list = db.sp_tbl_S07_Schedulers_GetAll();

            foreach (var item in list)
            {
                SchedulersObjects ob = new SchedulersObjects();
                ob.ScId        = item.ScId;
                ob.Description = item.Description;
                ob.CoId        = item.CoId;
                ob.ShiftId     = item.ShiftId;
                ob.WeId        = item.WeId;
                ob.WeId        = item.WeId;
                lst.Add(ob);
            }
            return(lst);
        }
示例#6
0
        public List <SchedulersObjects> GetJoin()
        {
            List <SchedulersObjects> lst = new List <SchedulersObjects>();
            var db   = new eTrainingScheduleEntities();
            var list = db.sp_Schedulers_Join();

            foreach (var item in list)
            {
                SchedulersObjects ob = new SchedulersObjects();
                ob.ScId        = item.ScId; ob.WeId = item.WeId; ob.ShiftId = item.ShiftId; ob.CoId = item.CoId; ob.Description = item.DescriptionSchedulers;
                ob.CoursesJoin = new CoursesObjects()
                {
                    CoId        = (Guid)item.CoId,
                    CourseId    = item.CourseId,
                    CourseName  = item.CourseName,
                    Deleted     = item.Deleted,
                    Description = item.DescriptionCourses,
                    EndDate     = item.EndDate,
                    StartDate   = item.StartDate,
                    Status      = item.Status == true,
                    TotalNumber = item.TotalNumber
                };
                ob.ShiftDayJoin = new ShiftDayObjects()
                {
                    Description = item.DescriptionShift,
                    ShiftId     = (Guid)item.ShiftId,
                    ShiftName   = item.ShiftName
                };
                ob.WeekdaysJoin = new WeekdaysObjects()
                {
                    Description = item.DescriptionWeekday,
                    WeId        = (Guid)item.WeId,
                    WeName      = item.WeName
                };
                lst.Add(ob);
            }
            return(lst);
        }
示例#7
0
 public bool Insert(SchedulersObjects ob)
 {
     return(new SchedulersDao().Insert(ob));
 }
示例#8
0
 public bool Update(SchedulersObjects ob)
 {
     return(new SchedulersDao().Update(ob));
 }