public JsonResult ClassRegisterAll(int ClassId, string Members, string MembersNames)
        {
            Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
            string[] members = Members.Trim().Substring(1, Members.Length - 2).Split(',');
            string[] membersNames = MembersNames.Trim().Substring(1, MembersNames.Length - 2).Split(',');
            string names = "";
            string namespass = "";
            string namescannotmessage = "";
            string message = "";

            for (int i = 0; i < members.Length; i++)
            {
                Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
                Member_ClassRegister member_ClassRegister = new Member_ClassRegister();

                List<Member_ClassRegister> listno = member_ClassRegisterBLL.GetList(" ClassId='" + ClassId + "' and AccountId='" + members[i] + "' and delflag='false' and Status in (1,2,4)", "");
                if (listno.Count > 0)
                {
                    names += membersNames[i] + ",";
                }

                List<Member_ClassRegister> listpass = member_ClassRegisterBLL.GetList(" TrainingId='" + member_ClassRegister.TrainingId + "' and AccountId='" + members[i] + "' and delflag='false' and (Result=1 or (Result is NULL and Status in(1,2,4)))", "");
                if (listpass.Count > 0)
                {
                    namespass += membersNames[i] + ",";
                }
                string checkmessage = IsCanRegisterAll(ClassId, false, Convert.ToInt32(members[i]));
                if (checkmessage != "")
                {
                    namescannotmessage += membersNames[i] + checkmessage;
                }
            }

            if (names != "")
            {
                message += names.Trim(',') + "已报名该课程;";
            }
            if (namespass != "")
            {
                message += namespass.Trim(',') + "已学过该课程;";
            }
            if (namescannotmessage != "")
            {
                message += namescannotmessage;
            }
            if (message != "")
            {
                return Json(new { Code = -1, Msg = message }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                Class_Detail class_Detail = new Class_Detail();
                class_Detail = class_DetailBLL.GetModel(ClassId);
                class_Detail.People += members.Length;
                class_DetailBLL.Update(class_Detail);
                for (int i = 0; i < members.Length; i++)
                {
                    Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
                    Member_ClassRegister member_ClassRegister = new Member_ClassRegister();

                    member_ClassRegister.ClassId = ClassId;
                    member_ClassRegister.PlanId = Code.SiteCache.Instance.PlanId;
                    member_ClassRegister.TrainingId = class_DetailBLL.GetModel(ClassId).TraningId;
                    member_ClassRegister.AccountId = Convert.ToInt32(members[i]);
                    member_ClassRegister.Status = 2;
                    member_ClassRegister.BatchCode = Guid.NewGuid();
                    member_ClassRegister.ManagerId = Code.SiteCache.Instance.LoginInfo.UserId;
                    member_ClassRegister.Delflag = false;
                    member_ClassRegister.CreateDate = DateTime.Now;
                    Course_UnitDetailBLL course_UnitDetailBLL = new Course_UnitDetailBLL();
                    member_ClassRegister.TotalSchedule = course_UnitDetailBLL.GetList(" TrainingId='" + class_DetailBLL.GetModel(ClassId).TraningId + "' and ParentId=0 and Display=1 and Delflag='false'", "").Count;

                    List<Member_ClassRegister> listup = member_ClassRegisterBLL.GetList(" ClassId='" + ClassId + "' and AccountId='" + members[i] + "' and delflag='false' and Status in (3,5)", "");
                    if (listup.Count > 0)
                    {
                        member_ClassRegister.Id = listup[0].Id;
                        member_ClassRegister.Status = 2;
                        member_ClassRegisterBLL.Update(member_ClassRegister);
                        if (member_ClassRegister.Id > 0)
                        {
                            Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL();
                            Member_ClassRegisterApplication member_ClassRegisterApplication = new Member_ClassRegisterApplication();
                            member_ClassRegisterApplication.ClassRegisterId = member_ClassRegister.Id;
                            member_ClassRegisterApplication.Status = 2;
                            member_ClassRegisterApplication.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                            member_ClassRegisterApplication.CreateDate = DateTime.Now;
                            member_ClassRegisterApplication.Delflag = false;
                            member_ClassRegisterApplicationBLL.Add(member_ClassRegisterApplication);
                        }
                        else { return Json(new { Code = -1, Msg = "提交失败" }, JsonRequestBehavior.AllowGet); }
                    }
                    else
                    {
                        int RegisterId = member_ClassRegisterBLL.Add(member_ClassRegister);
                        if (RegisterId > 0)
                        {
                            Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL();
                            Member_ClassRegisterApplication member_ClassRegisterApplication = new Member_ClassRegisterApplication();
                            member_ClassRegisterApplication.ClassRegisterId = RegisterId;
                            member_ClassRegisterApplication.Status = 2;
                            member_ClassRegisterApplication.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                            member_ClassRegisterApplication.CreateDate = DateTime.Now;
                            member_ClassRegisterApplication.Delflag = false;
                            member_ClassRegisterApplicationBLL.Add(member_ClassRegisterApplication);
                        }
                        else { return Json(new { Code = -1, Msg = "提交失败" }, JsonRequestBehavior.AllowGet); }
                    }
                }
            }
            return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
        }
        public JsonResult ClassRegister(int ClassId)
        {
            Class_Detail class_Detail = new Class_Detail();
            Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
            Member_ClassRegister member_ClassRegister = new Member_ClassRegister();
            member_ClassRegister.ClassId = ClassId;
            member_ClassRegister.PlanId = Code.SiteCache.Instance.PlanId;
            Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
            member_ClassRegister.TrainingId = class_DetailBLL.GetModel(ClassId).TraningId;
            member_ClassRegister.AccountId = Code.SiteCache.Instance.LoginInfo.UserId;
            member_ClassRegister.Status = 1;
            member_ClassRegister.ManagerId = Code.SiteCache.Instance.LoginInfo.UserId;
            member_ClassRegister.Delflag = false;
            member_ClassRegister.CreateDate = DateTime.Now;
            Course_UnitDetailBLL course_UnitDetailBLL = new Course_UnitDetailBLL();
            member_ClassRegister.TotalSchedule = course_UnitDetailBLL.GetList(" TrainingId='" + class_DetailBLL.GetModel(ClassId).TraningId + "' and ParentId=0 and Display=1 and Delflag='false'", "").Count;

            //if (!IsCanRegister(ClassId, true, Code.SiteCache.Instance.LoginInfo.UserId))
            string checkmessage = IsCanRegisterAll(ClassId, true, Code.SiteCache.Instance.LoginInfo.UserId);
            if (checkmessage != "")
            {
                return Json(new { Code = -1, Msg = checkmessage }, JsonRequestBehavior.AllowGet);
            }

            List<Member_ClassRegister> listno = member_ClassRegisterBLL.GetList(" ClassId='" + ClassId + "' and AccountId='" + Code.SiteCache.Instance.LoginInfo.UserId + "' and delflag='false' and Status in (1,2,4)", "");
            if (listno.Count > 0)
            {
                return Json(new { Code = -1, Msg = "您已经提交了报名申请" }, JsonRequestBehavior.AllowGet);
            }

            List<Member_ClassRegister> listpass = member_ClassRegisterBLL.GetList(" TrainingId='" + member_ClassRegister.TrainingId + "' and AccountId='" + Code.SiteCache.Instance.LoginInfo.UserId + "' and delflag='false' and (Result=1 or (Result is NULL and Status in(1,2,4)))", "");
            if (listpass.Count > 0)
            {
                return Json(new { Code = -1, Msg = "您已经学过该课程或已报名该课程下的其他班级" }, JsonRequestBehavior.AllowGet);
            }

            List<Member_ClassRegister> listup = member_ClassRegisterBLL.GetList(" ClassId='" + ClassId + "' and AccountId='" + Code.SiteCache.Instance.LoginInfo.UserId + "' and delflag='false' and Status in (3,5)", "");
            if (listup.Count > 0)
            {
                member_ClassRegister.Id = listup[0].Id;
                member_ClassRegister.Status = 1;
                member_ClassRegisterBLL.Update(member_ClassRegister);

                if (member_ClassRegister.Id > 0)
                {
                    class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId);
                    class_Detail.People += 1;
                    class_DetailBLL.Update(class_Detail);

                    Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL();
                    Member_ClassRegisterApplication member_ClassRegisterApplication = new Member_ClassRegisterApplication();
                    member_ClassRegisterApplication.ClassRegisterId = member_ClassRegister.Id;
                    member_ClassRegisterApplication.Status = 1;
                    member_ClassRegisterApplication.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                    member_ClassRegisterApplication.CreateDate = DateTime.Now;
                    member_ClassRegisterApplication.Delflag = false;
                    member_ClassRegisterApplicationBLL.Add(member_ClassRegisterApplication);
                    return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
                }
                else { return Json(new { Code = -1, Msg = "提交失败" }, JsonRequestBehavior.AllowGet); }
            }
            else
            {
                int RegisterId = member_ClassRegisterBLL.Add(member_ClassRegister);
                class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId);
                class_Detail.People += 1;
                class_DetailBLL.Update(class_Detail);
                if (RegisterId > 0)
                {
                    Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL();
                    Member_ClassRegisterApplication member_ClassRegisterApplication = new Member_ClassRegisterApplication();
                    member_ClassRegisterApplication.ClassRegisterId = RegisterId;
                    member_ClassRegisterApplication.Status = 1;
                    member_ClassRegisterApplication.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                    member_ClassRegisterApplication.CreateDate = DateTime.Now;
                    member_ClassRegisterApplication.Delflag = false;
                    member_ClassRegisterApplicationBLL.Add(member_ClassRegisterApplication);
                    return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
                }
                else { return Json(new { Code = -1, Msg = "提交失败" }, JsonRequestBehavior.AllowGet); }
            }
        }