public JsonResult PublishYear(int id) { if (Iyear.IsYearUser(id)) { Tr_YearPlan Ymodel = Iyear.GetYearModel(id); Ymodel.PublishFlag = 1; bool result = Iyear.UpdateYearByID(Ymodel); if (result) { return(Json(new { result = 1, content = "发布成功" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { result = 0, content = "发布失败" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { result = 0, content = "发布失败,一些课程不存在授课讲师" }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 导出年度计划课程信息 /// </summary> public void OutYearCourse(int id, string name, string Way, string Teaname, string isMust, string isSystem, string openLevel, string Order) { Tr_YearPlan year = Iyear.GetYearModel(id); string where = "1=1"; if (!string.IsNullOrEmpty(openLevel)) { where += string.Format(" And (SELECT count(*) FROM dbo.F_SplitIDs(OpenLevel) WHERE ID IN (SELECT ID FROM dbo.F_SplitIDs('{0}')) )>0", openLevel); } if (!string.IsNullOrEmpty(isMust)) { where += string.Format(" and cc.IsMust ={0}", Convert.ToInt32(isMust)); } if (!string.IsNullOrEmpty(isSystem)) { if (Convert.ToInt32(isSystem) == 0) { where += string.Format(" and tp.IsSystem=0 "); } else { where += string.Format(" and tp.IsSystem>0 "); } } if (!string.IsNullOrEmpty(Teaname)) { where += string.Format(" and su.Realname LIKE '%{0}%'", Teaname.ReplaceSql()); } if (!string.IsNullOrEmpty(name)) { where += string.Format(" and cc.CourseName LIKE '%{0}%'", name.ReplaceSql()); } if (Way != "-1") { where += string.Format(" and cc.Way={0}", Convert.ToInt32(Way)); } List <Tr_YearPlanCourse> yearList = Iyear.GetAllYearCourseList(id, Order, where); DataTable outTable = new DataTable(); outTable.Columns.Add("课程名称", typeof(string)); outTable.Columns.Add("学时", typeof(string)); outTable.Columns.Add("预计开课时间", typeof(string)); outTable.Columns.Add("开放级别", typeof(string)); outTable.Columns.Add("培训形式", typeof(string)); outTable.Columns.Add("授课讲师", typeof(string)); outTable.Columns.Add("讲师薪酬", typeof(string)); outTable.Columns.Add("必修/选修", typeof(string)); outTable.Columns.Add("是否折算CPA学时", typeof(string)); outTable.Columns.Add("框架内/外", typeof(string)); //outTable.Columns.Add("框架类别", typeof(string)); //foreach (Tr_YearPlanCourse v in yearList) //{ // outTable.Rows.Add(v.CourseName, v.OpenTime, v.OpenLevel, v.WayStr, v.Realname, // v.PayGrade, v.IsMustStr, v.IsSystemStr, v.SystemTree); //} foreach (Tr_YearPlanCourse v in yearList) { outTable.Rows.Add(v.CourseName, v.CourseLength, v.OpenTime, v.OpenLevel, v.WayStr, v.Realname, v.PayGrade, v.IsMustStr, v.IsCPAStr, v.IsSystemStr); } new Spreadsheet().Template(year.Year + "年度计划课程安排", null, outTable, HttpContext, "年度计划课程", "年度计划"); }