public ActionResult Index() { int totalCount = 0; //待开课课程 string waitCoursewhere = string.Format(" Co_Course.IsDelete = 0 and CourseFrom=2 and Co_Course.way=1 and Co_Course.PublishFlag = 1 and Co_Course.StartTime >='{0}' ", DateTime.Now); var waitCourseList = Icourse.GetCourseCommonList(out totalCount, waitCoursewhere, 0, 5, "ORDER BY Co_Course.StartTime"); //待审批逾时申请 string timeoutApprovalwhere = string.Format(@" Co_Course.IsDelete = 0 and Co_Course.publishflag =1 and Sys_User.IsDelete = 0 and Cl_MakeUpOrder.IsTimeOut = 1 and Cl_MakeUpOrder.TimeOutPassFlag = 0"); var timeoutApprovalList = courseOrderBL.GetTimeOutApprovalList(out totalCount, timeoutApprovalwhere, 1, 5, "order by Cl_MakeUpOrder.TimeOutDateTime desc"); //课程预约情况 string courseOrderListwhere = string.Format(@" Co_Course.IsDelete = 0 and Co_Course.Publishflag = 1 and Co_Course.CourseFrom=2 and Co_Course.Way = 1 "); var courseOrderList = courseOrderBL.GetCourseSubscribeList(out totalCount, courseOrderListwhere, 1, 6, "order by Co_Course.Id desc"); ViewBag.waitCourseList = waitCourseList; ViewBag.timeoutApprovalList = timeoutApprovalList; ViewBag.courseOrderList = courseOrderList; ViewBag.UserRights = UserRights; return(View()); }
/// <summary> /// 获取我的培训首页的三种课程 /// </summary> /// <param name="type">0:集中授课;1:视频;2:CPA</param> /// <returns></returns> public JsonResult GetMyTrainIndexCourse(int type = 0) { var isOpenSub = ""; if (CurrentUser.IsMain == 1) { isOpenSub = " or IsOpenSub=1"; } var totalCount = 0; var sqlwhere = ""; switch (type) { case 0: sqlwhere = string.Format(@" Co_Course.Way=1 and Co_Course.Publishflag=1 and StartTime>=getdate() and ( (( (select count(*) from Sys_User where UserId={0} and TrainGrade in (select id from dbo.F_SplitIDs(Co_Course.OpenLevel)))>0 --or Co_Course.OpenLevel = '' or Co_Course.OpenLevel is null ) and ( ((Co_Course.OpenGroupObject = '' or Co_Course.OpenGroupObject is null) and (Co_Course.OpendepartObject = '' or Co_Course.OpendepartObject is null )) or (select count(*) from Sys_User where UserId={0} and deptid in (select id from dbo.F_SplitIDs(Co_Course.OpendepartObject)))>0 or (select count(*) from Sys_GroupUser where UserId={0} and groupid in (select id from dbo.F_SplitIDs(Co_Course.OpenGroupObject)))>0 )) or Co_Course.Id in (select CourseId from Cl_CourseOrder where Cl_CourseOrder.UserId = {0} and Cl_CourseOrder.orderstatus > 0) {1} )", CurrentUser.UserId, isOpenSub); break; case 1: sqlwhere = string.Format(@" Co_Course.Way=2 and Co_Course.Publishflag=1 and EndTime>=getdate() and ( ( (select count(*) from Sys_User where UserId={0} and TrainGrade in (select id from dbo.F_SplitIDs(Co_Course.OpenLevel)))>0 --or Co_Course.OpenLevel = '' or Co_Course.OpenLevel is null ) and ( ( (Co_Course.OpenGroupObject = '' or Co_Course.OpenGroupObject is null) and (Co_Course.OpendepartObject = '' or Co_Course.OpendepartObject is null ) ) or (select count(*) from Sys_User where UserId={0} and deptid in (select id from dbo.F_SplitIDs(Co_Course.OpendepartObject)))>0 or (select count(*) from Sys_GroupUser where UserId={0} and groupid in (select id from dbo.F_SplitIDs(Co_Course.OpenGroupObject)))>0 ) {1} )", CurrentUser.UserId, isOpenSub); break; case 2: sqlwhere = string.Format(@" Co_Course.Way=3 and Co_Course.Publishflag=1 and StartTime>=getdate() and ( ( (select count(*) from Sys_User where UserId={0} and TrainGrade in (select id from dbo.F_SplitIDs(Co_Course.OpenLevel)))>0 or Co_Course.OpenLevel = '' or Co_Course.OpenLevel is null ) and ( (Co_Course.OpenGroupObject = '' or Co_Course.OpenGroupObject is null) or (select count(*) from Sys_GroupUser where UserId={0} and groupid in (select id from dbo.F_SplitIDs(Co_Course.OpenGroupObject)))>0 ) )", CurrentUser.UserId); break; } var list = CourseBL.GetCourseCommonList(out totalCount, sqlwhere, 0, 8, " order by Co_Course.StartTime desc "); var newlist = new List <object>(); list.ForEach(p => newlist.Add(new { id = p.Id, name = p.CourseName.HtmlXssEncode(), date = p.StartTime.ToString("yyyy-MM-dd HH:mm"), picdate = p.StartTime.ToString("yyyy.MM.dd HH:mm") + "-" + p.EndTime.ToString("yyyy.MM.dd HH:mm"), length = p.CourseLength, teacher = p.TeacherStr })); return(Json(newlist, JsonRequestBehavior.AllowGet)); }