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 and IsOpen=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();
            //}
            list = organBll.GetListModel(" id in ( " + model.OrganRange + ")");

            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();
        }
        /// <summary>
        /// 学校--审核列表
        /// </summary>
        /// <returns></returns>
        public ActionResult CoursemarketVerify(int? pageIndex, int? planId, int? status, int? trainingId, int? myclassId, string searchTitle)
        {
            ViewBag.Title = "教师报名管理";
            int i = TypeConverter.ObjectToInt(pageIndex, 1);
            int groupId = Code.SiteCache.Instance.GroupId;//4,学校管理7,普通教师
            //int groupId = 4;
            Organ_DetailBLL organ_DetailBLL = new Organ_DetailBLL();
            int OrganId = 0;
            string where = "";
            if (groupId == 4)
            {
                OrganId = (int)organ_DetailBLL.GetModel(Code.SiteCache.Instance.ManageOrganId).ParentId;
                ViewBag.Yes = 2;
                ViewBag.No = 3;
                where += " and ma.OrganId='" + Code.SiteCache.Instance.ManageOrganId + "'";
                //where += " and mcr.Status<=3";
            }
            else if (groupId == 2)
            {
                OrganId = Code.SiteCache.Instance.ManageOrganId;
                ViewBag.Yes = 4;
                ViewBag.No = 5;
                where += " and cd.OrganId='" + Code.SiteCache.Instance.ManageOrganId + "'";
                where += " and mcr.Status in(2,4,5)";
            }
            else if (groupId == 3)
            {
                OrganId = Code.SiteCache.Instance.ManageOrganId;
                ViewBag.Yes = 4;
                ViewBag.No = 5;
                where += " and cd.OrganId='" + Code.SiteCache.Instance.ManageOrganId + "'";
                where += " and mcr.Status in(2,4,5)";
            }
            else
            {
                where += " and 1=2";
            }
            if (planId != null && planId > 0)
            {
                where += " and mcr.PlanId='" + planId + "' ";
            }
            else { planId = -1; }
            if (status != null && status > 0)
            {
                where += " and mcr.Status='" + status + "' ";
            }
            else { status = -1; }
            if (trainingId != null && trainingId > 0)
            {
                where += " and mcr.TrainingId='" + trainingId + "' ";
            }
            else { trainingId = -1; }
            if (myclassId != null && myclassId > 0)
            {
                where += " and mcr.ClassId='" + myclassId + "' ";
            }
            else { myclassId = -1; }

            if (!string.IsNullOrEmpty(searchTitle))
            { where += " and (mbi.RealName like'%" + searchTitle.Replace("'", "''") + "%' or ma.Nickname like '%" + searchTitle.Replace("'", "''") + "%' or ma.UserName like '%" + searchTitle.Replace("'", "''") + "%' or mbi.TeacherNo like '%" + searchTitle.Replace("'", "''") + "%' or mbi.CredentialsNumber like '%" + searchTitle.Replace("'", "''") + "%' or td.Title like '%" + searchTitle.Replace("'", "''") + "%' or cd.Title like '%" + searchTitle.Replace("'", "''") + "%')"; }

            int total = 0;
            Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
            List<ClassRegisterManage> tdlist = member_ClassRegisterBLL.GetListManage(10, i, where, "CreateDate desc", out total);

            ViewData["searchTitle"] = string.IsNullOrEmpty(searchTitle) ? "" : searchTitle;
            ViewData["planId"] = planId;
            ViewData["status"] = status;
            ViewData["trainingId"] = trainingId;
            ViewData["myclassId"] = myclassId;
            ViewData["groupId"] = groupId;
            ViewBag.pageIndex = i;
            ViewBag.totalPage = total;

            Training_PlanBLL training_PlanBLL = new Training_PlanBLL();
            ViewBag.PlanList = training_PlanBLL.GetListModel(" Display=1 and Delflag='false'");

            Traning_FieldBLL traning_FieldBLL = new Traning_FieldBLL();
            ViewBag.FieldList = traning_FieldBLL.GetList(" Display=1 and Delflag='false' and IsSpec=0", " Sort");

            Traning_DetailBLL traning_DetailBLL = new Traning_DetailBLL();
            ViewBag.TraningList = traning_DetailBLL.GetList(" Display=1 and Delflag='false' and PartitionId='" + Code.SiteCache.Instance.LoginInfo.PartitionId + "' and Status=5 and (OrganId='" + OrganId + "' or Range=2)", " Id");

            Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
            ViewBag.ClassList = class_DetailBLL.GetListModel(" Display=1 and Delflag='false' ");

            return View(tdlist);
        }