public ActionResult ClassList(string param_plan, string param_subject, int? param_status, string param_searchTxt, int pageIndex = 1)
        {
            int totalPage;
            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 ").Tables[0]);
            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            var organ = new Organ_DetailBLL().GetModel(SiteCache.Instance.ManageOrganId);
            //组织分区下未删除状态
            string where = " Delflag=0 and OrganId=  " + SiteCache.Instance.ManageOrganId + " and PartitionId=" + organ.PartitionId;
            if (!string.IsNullOrEmpty(param_plan))//学期计划
            {
                where += " and PlanId =" + Dianda.Common.QueryString.Decrypt(param_plan);
            }
            if (!string.IsNullOrEmpty(param_subject))//学科
            {
                where += " and (subject=1 or exists( select 1 from Class_TeachSubject where ClassId=Class_Detail.id and TeachSubject=" + Dianda.Common.QueryString.Decrypt(param_subject) + "))";
            }
            if (param_status.HasValue)//状态
            {
                where += " and Status =" + param_status.Value;
            }
            if (!string.IsNullOrEmpty(param_searchTxt))//查询条件
            {
                where += " and( Title like '%" + ExtendHelper.Split(param_searchTxt )+ "%' or exists( SELECT 1 FROM dbo.Traning_Detail WHERE Title LIKE '%"
                    + ExtendHelper.Split(param_searchTxt) + "%' AND id=Class_Detail.TraningId))";
            }
            var list = DataTableToListHelper<Dianda.AP.Model.Class_Detail>.ConvertToModel(PagingQueryBll.GetPagingDataTable("Class_Detail", where, "id", pageIndex, out totalPage));

            ViewBag.pageIndex = pageIndex;
            ViewBag.totalPage = totalPage;
            ViewBag.basecount = 10;
            ViewBag.instructorList = DataTableToListHelper<Dianda.AP.Model.Member_Account>.ConvertToModel(new Member_AccountBLL().GetAccountByMannagerGroup(organ.PartitionId, organ.Id, 6));
            return View(list);
        }
        //班级列表
        public ActionResult ClassInstructorList(int? param_plan, int? param_subject, int? param_status, string param_searchTxt, int pageIndex = 1)
        {
            int totalPage;
            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList(" IsOpen=1 and Delflag=0 and Display=1 ").Tables[0]);
            ViewBag.StatusList = new List<KeyValue> { new KeyValue { Title = "111", Id = "1" } };
            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            //为审核通过,已开班,已结业,已暂停。Display=1,delflag=0.
            string where = " Display=1 and  Delflag=0 and status in (3,5,6) ";
            where += " and Instructor=" + 3;
            if (param_plan.HasValue)//学期计划
            {
                where += " and PlanId =" + param_plan.Value;
            }
            if (param_subject.HasValue)//学科
            {
                where += " and TraningId =" + param_subject.Value;
            }
            if (param_status.HasValue)//状态
            {
                where += " and Status =" + param_status.Value;
            }
            if (!string.IsNullOrEmpty(param_searchTxt))//查询条件
            {
                where += " and( Title like '%" + param_searchTxt + "%' or exists( SELECT 1 FROM dbo.Traning_Detail WHERE Title LIKE '%"
                    + param_searchTxt + "%' AND id=Class_Detail.TraningId))";
            }
            var list = DataTableToListHelper<Dianda.AP.Model.Class_Detail>.ConvertToModel(PagingQueryBll.GetPagingDataTable("Class_Detail", where, "id", pageIndex, out totalPage));

            ViewBag.pageIndex = pageIndex;
            ViewBag.totalPage = totalPage;
            ViewBag.basecount = 10;
            return View(list);
        }
        public ActionResult ClassAuditDetail(string id, string doaction)
        {
            var param_id = Dianda.Common.QueryString.Decrypt(id);
            string param_doaction = "";
            if (doaction != null)
                param_doaction = Dianda.Common.QueryString.Decrypt(doaction);

            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            var traningDBll = new Traning_DetailBLL();
            var bll = new Class_DetailBLL();
            var model = bll.GetModel(param_id.ToInt());
            var organ = new Organ_DetailBLL().GetModel(SiteCache.Instance.ManageOrganId);
            if (organ.OType == 1)//培训机构职能选择自己机构开设的课程
            {
                ViewBag.CourseList = traningDBll.GetList(" OrganId =" + organ.Id + " and Delflag=0 and Display=1 ", "");
            }
            else//进修学院则可以选择自己机构开设的课程,也可以选择自己机构所属的区县下的所有课程。通过Traning_Detail.ParentOrganId。如果Range=2,则表面是市级共享课程。则可以无条件选择。
            {
                ViewBag.CourseList = traningDBll.GetList(" ((OrganId =" + organ.Id + " or ParentOrganId=" + organ.Id + ") or Range=2 ) and Delflag=0 and Display=1 ", "");
            }
            ViewBag.OrganId = SiteCache.Instance.ManageOrganId;
            ViewBag.PartitionId = organ.PartitionId;
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 ").Tables[0]);
            ViewBag.ClassesList = fkBll.GetList(" CategoryType=5 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.Subject = model.Subject;
            ViewBag.existSubjectList = new Class_TeachSubjectBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");
            ViewBag.StudyLevelList = fkBll.GetList(" CategoryType=4 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.StudyLevel = model.StudyLevel;
            ViewBag.existStudyLevel = new Class_StudySectionBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");
            ViewBag.TeachGradeList = fkBll.GetList(" CategoryType=7 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachGrade = model.TeachGrade;
            ViewBag.existTeachGrade = new Class_TeachGradeBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");
            ViewBag.TeachRankList = fkBll.GetList(" CategoryType=8 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachRank = model.TeachRank;
            ViewBag.existTeachRank = new Class_TeachRankBLL().GetList(" Delflag=0 and ClassId=" + param_id, "");

            var course = new Traning_DetailBLL().GetModel(model.TraningId, "");
            var organBll = new Organ_DetailBLL();
            var list = new List<Organ_Detail>();
            if (course.Range == 1) //区级
            {
                list = organBll.GetListModel("  OType IN ( 1, 2, 3 ) and PartitionId=" + course.PartitionId + " and ParentId=" + (course.OrganId.HasValue ? course.OrganId.Value : 0));
            }
            else//市级
            {
                list = organBll.GetShiOrganDetailList();
            }
            ViewBag.schoolList = list;
            ViewBag.classId = param_id;
            ViewBag.OrangRange = model.OrganRange.Split(',');
            ViewBag.doaction = param_doaction;
            return View(model);
        }
        public ActionResult ClassAuditList(string param_plan, string param_subject, string param_organ, int? param_status, string param_searchTxt, int pageIndex = 1)
        {
            int totalPage;
            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            var organBll = new Organ_DetailBLL();
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 ").Tables[0]);

            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.OrganList = new Organ_DetailBLL().GetListModel(" Delflag=0");
            //市级管理员,可以查看所有班级信息。Delflag=0,display=1.status不为1和7的。
            string where = " Delflag=0 and Display=1 and status not in(1,7) ";
            if (!string.IsNullOrEmpty(param_plan))//学期计划
            {
                where += " and PlanId =" + Dianda.Common.QueryString.Decrypt(param_plan);
            }
            if (!string.IsNullOrEmpty(param_subject))//学科
            {
                where += " and TraningId =" + Dianda.Common.QueryString.Decrypt(param_subject);
            }
            if (!string.IsNullOrEmpty(param_organ))//机构
            {
                where += " and OrganId =" + Dianda.Common.QueryString.Decrypt(param_organ);
            }
            if (param_status.HasValue)//状态
            {
                where += " and Status =" + param_status.Value;
            }
            if (!string.IsNullOrEmpty(param_searchTxt))//查询条件
            {
                where += " and( Title like '%" + ExtendHelper.Split(param_searchTxt.Trim()) + "%' or exists( SELECT 1 FROM dbo.Traning_Detail WHERE Title LIKE '%"
                    + ExtendHelper.Split(param_searchTxt.Trim()) + "%' AND id=Class_Detail.TraningId))";
            }
            var list = DataTableToListHelper<Dianda.AP.Model.Class_Detail>.ConvertToModel(PagingQueryBll.GetPagingDataTable("Class_Detail", where, "id", pageIndex, out totalPage));

            ViewBag.pageIndex = pageIndex;
            ViewBag.totalPage = totalPage;
            ViewBag.basecount = 10;
            return View(list);
        }
        public ActionResult ClassTeacherList(int? param_plan, int? param_subject, int? param_status, string param_searchTxt, int pageIndex = 1)
        {
            int totalPage;
            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 ").Tables[0]);

            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            //为审核通过,已开班,已结业,已暂停。Display=1,delflag=0.
            string where = " Display=1 and  Delflag=0 and status in (3,5,6) ";
            var gid = SiteCache.Instance.GroupId;
            if (gid == 6)//辅导员
            {
                where += " and Instructor=" + SiteCache.Instance.ManagerId;
            }
            else//教师
            {
                where += " and exists (SELECT 1 FROM dbo.Traning_Teacher WHERE  Traning_Teacher.TraningId=dbo.Class_Detail.TraningId AND PlatformManagerId=" + SiteCache.Instance.ManagerId + ")";
            }
            if (param_plan.HasValue)//学期计划
            {
                where += " and PlanId =" + param_plan.Value;
            }
            if (param_subject.HasValue)//学科
            {
                where += " and (subject=1 or (subject= 0 and exists( select 1 from Class_TeachSubject where Delflag=0 and ClassId=Class_Detail.id and TeachSubject=" + param_subject.Value + ")))";
            }
            if (param_status.HasValue)//状态
            {
                where += " and Status =" + param_status.Value;
            }
            if (!string.IsNullOrEmpty(param_searchTxt))//查询条件
            {
                where += " and( Title like '%" + ExtendHelper.Split(param_searchTxt) + "%' or exists( SELECT 1 FROM dbo.Traning_Detail WHERE Title LIKE '%"
                    + ExtendHelper.Split(param_searchTxt) + "%' AND id=Class_Detail.TraningId))";
            }
            var list = DataTableToListHelper<Dianda.AP.Model.Class_Detail>.ConvertToModel(PagingQueryBll.GetPagingDataTable("Class_Detail", where, "id", pageIndex, out totalPage));

            ViewBag.pageIndex = pageIndex;
            ViewBag.totalPage = totalPage;
            ViewBag.basecount = 10;
            return View(list);
        }
        //班级首页
        public ActionResult Index()
        {
            var fkBll = new Traning_InfoFkBLL();
            var traningBll = new Training_PlanBLL();
            var traningDBll = new Traning_DetailBLL();

            var organ = new Organ_DetailBLL().GetModel(SiteCache.Instance.ManageOrganId);
            if (organ.OType == 1)//培训机构职能选择自己机构开设的课程
            {
                ViewBag.CourseList = traningDBll.GetList(" OrganId =" + organ.Id + " and Delflag=0 and Display=1 and status=5", "");
                    //(, "");" Range=2"
            }
            else//进修学院则可以选择自己机构开设的课程,也可以选择自己机构所属的区县下的所有课程。通过Traning_Detail.ParentOrganId。如果Range=2,则表面是市级共享课程。则可以无条件选择。
            {
                ViewBag.CourseList = traningDBll.GetList(" ((OrganId =" + organ.Id + " or ParentOrganId=" + organ.Id + ")  ) and Delflag=0 and Display=1 and status=5", "");
            }//or Range=2
            ViewBag.OrganId = SiteCache.Instance.ManageOrganId;
            ViewBag.PartitionId = organ.PartitionId;
            ViewBag.PlanList = DataTableToListHelper<Dianda.AP.Model.Training_Plan>.ConvertToModel(traningBll.GetList("  Delflag=0 and Display=1 ").Tables[0]);
            ViewBag.ClassesList = fkBll.GetList(" CategoryType=5 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.SubjectList = fkBll.GetList(" CategoryType=3 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.StudyLevelList = fkBll.GetList(" CategoryType=4 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachGradeList = fkBll.GetList(" CategoryType=7 and Delflag=0 and Display=1 ", "Sort desc");
            ViewBag.TeachRankList = fkBll.GetList(" CategoryType=8 and Delflag=0 and Display=1 ", "Sort desc");

            return View();
        }