Ejemplo n.º 1
0
        //班级操作
        public ActionResult ClassAction(string strAction, int Id, int? Instructor)
        {
            try
            {
                var bll = new Class_DetailBLL();
                var model = bll.GetModel(Id.ToInt());
                switch (strAction)
                {
                    case "clear"://清除
                        model.Delflag = true;
                        break;
                    case "complete"://结业
                        model.Status = 6;
                        break;
                    case "cancel"://撤销
                        model.Status = 1;
                        break;
                    case "setInstructor"://设置辅导员
                        model.Instructor = Instructor.Value;
                        break;
                    case "start"://开班
                        var traingModel=new Traning_DetailBLL().GetModel(model.TraningId,"");
                        if (traingModel.OutSideType == -1)//内部课程要有课程信息及比例
                        {
                            var list = new Course_DetailBLL().GetList(" Delflag=0 and TrainingId=" + model.TraningId, "");
                            if (list == null || list.Count == 0)
                                return Json(new { Code = -1, Msg = "请设置课程信息!" }, JsonRequestBehavior.AllowGet);
                            var courseDetail = list.First();
                            if (courseDetail.ReadingRate + courseDetail.DisscusRate + courseDetail.HomeWorkRate
                                + courseDetail.QuestionRate + courseDetail.TestingRate + courseDetail.CommentRate != 100)
                            {
                                return Json(new { Code = -1, Msg = "请设置课程考核比例!" }, JsonRequestBehavior.AllowGet);
                            }
                        }
                        model.Status = 5;
                        break;

                }

                bll.Update(model);

                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 2
0
        //班级操作
        public ActionResult ClassAction(string strAction, string Ids, int Val, string Remark)
        {
            try
            {
                var bll = new Class_DetailBLL();
                var ids = Ids.Split(',');
                foreach (var id in ids)
                {
                    if (!string.IsNullOrEmpty(id))
                    {
                        var model = bll.GetModel(id.ToInt());
                        switch (strAction)
                        {
                            case "audit"://审核
                                if (model.Status == 3)//已经通过的状态时,批量操作不再有效
                                    continue;
                                model.Status = Val == 1 ? 3 : 4;
                                if (Val != 1)
                                {
                                    model.ApplyRemark = Remark;
                                }
                                //新建审核记录
                                var apply = new Dianda.AP.Model.Class_ApplyApplication();
                                apply.ClassId = id.ToInt();
                                apply.AccountId = SiteCache.Instance.LoginInfo.UserId;
                                apply.Remark = Remark;
                                apply.CreateDate = DateTime.Now;
                                var applyBll = new Class_ApplyApplicationBLL();
                                applyBll.Add(apply);

                                var manger = new PlatformManager_DetailBLL().GetModel(model.ManagerId, "");
                                if (manger != null)
                                    Code.MsgHelper.sendMsg(manger.AccountId, SiteCache.Instance.ManagerId, model.PartitionId, "班级审核", model.Title + (Val == 1 ? "班级审核通过" : "班级审核不通过"));
                                break;
                        }
                        bll.Update(model);
                    }
                }

                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 3
0
        //编辑班级
        public JsonResult EditClass(string id, string Title, string TraningId, string PlanId, string SignUpStartTime, string SignUpEndTime
            , string OpenClassFrom, string OpenClassTo, string ClassForm, string People, string LimitPeopleCnt, string Address
            , string Content, string Subject, string StudyLevel, string TeachGrade, string TeachRank, string OrganRange
            , string Status)
        {
            try
            {
                var bll = new Class_DetailBLL();
                var model = bll.GetModel(id.ToInt());
                model.Title = Title;
                model.TraningId = TraningId.ToInt();
                model.PlanId = PlanId.ToInt();
                model.SignUpStartTime = SignUpStartTime.ToDateTime();
                model.SignUpEndTime = SignUpEndTime.ToDateTime();
                model.OpenClassFrom = OpenClassFrom.ToDateTime();
                model.OpenClassTo = OpenClassTo.ToDateTime();
                model.ClassForm = ClassForm.ToInt();
                model.People = People.ToInt();
                model.LimitPeopleCnt = LimitPeopleCnt.ToInt();
                model.Address = Address;
                model.Content = Content;
                model.Subject = Subject == "0" ? true : false;
                model.StudyLevel = StudyLevel == "0" ? true : false; ;
                model.TeachGrade = TeachGrade == "0" ? true : false; ;
                model.TeachRank = TeachRank == "0" ? true : false; ; ;
                model.OrganRange = OrganRange;
                model.ManagerId = SiteCache.Instance.LoginInfo.UserId;
                model.Status = Status.ToInt();
                model.CreateDate = DateTime.Now;

                bll.Update(model);
                if (Status == "2")//为提交状态时,新建审核记录
                {
                    var apply = new Dianda.AP.Model.Class_ApplyApplication();
                    apply.ClassId = id.ToInt();
                    apply.AccountId = SiteCache.Instance.LoginInfo.UserId;
                    apply.Remark = "提交审核";
                    apply.CreateDate = DateTime.Now;
                    var applyBll = new Class_ApplyApplicationBLL();
                    applyBll.Add(apply);
                }
                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 4
0
        public JsonResult EditClass(string id, string Title, string TraningId, string PlanId, string SignUpStartTime, string SignUpEndTime
            , string OpenClassFrom, string OpenClassTo, string ClassForm, string LimitPeopleCnt, string Address
            , string Content, string Subject, string StudyLevel, string TeachGrade, string TeachRank, string OrganRange
            , string Status)
        {
            try
            {
                var bll = new Class_DetailBLL();
                var model = bll.GetModel(id.ToInt());
                model.Title = Title;
                model.TraningId = TraningId.ToInt();
                model.PlanId = PlanId.ToInt();
                model.SignUpStartTime = SignUpStartTime.ToDateTime();
                model.SignUpEndTime = SignUpEndTime.ToDateTime();
                model.OpenClassFrom = OpenClassFrom.ToDateTime();
                model.OpenClassTo = OpenClassTo.ToDateTime();
                model.ClassForm = ClassForm.ToInt();
                model.People = 0;
                model.LimitPeopleCnt = LimitPeopleCnt.ToInt();
                model.Address = Address;
                model.Content = Content;
                model.Subject = Subject.Contains("all") ? true : false;
                model.StudyLevel = StudyLevel.Contains("all") ? true : false; ;
                model.TeachGrade = TeachGrade.Contains("all") ? true : false; ;
                model.TeachRank = TeachRank.Contains("all") ? true : false;
                model.OrganRange = OrganRange.Contains("all") ? "0" : OrganRange; ;
                model.ManagerId = SiteCache.Instance.ManagerId;
                model.Status = Status.ToInt();
                model.CreateDate = DateTime.Now;

                bll.Update(model);

                Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
                List<Member_ClassRegister> member_ClassRegisterList = member_ClassRegisterBLL.GetList("ClassId='" + id + "'", "");
                if (member_ClassRegisterList != null && member_ClassRegisterList.Count > 0)
                {
                    foreach (Member_ClassRegister m in member_ClassRegisterList)
                    {
                        m.Delflag = true;
                        member_ClassRegisterBLL.Update(m);
                    }
                }

                if (!model.StudyLevel)//不是全部则建立关联数据
                {

                    var arr = StudyLevel.Split(',');
                    var section = new Class_StudySectionBLL();

                    var oldSection = section.GetList(" Delflag=0 and ClassId=" + model.Id, "");
                    foreach (var old in oldSection)
                    {
                        var oldId = old.StudySection.ToString();
                        var exists = arr.Where(s => s == oldId);
                        if (exists == null || exists.Count() == 0)//旧的在新的里面不存,则删除
                        {
                            old.Delflag = true;
                            section.Update(old);
                        }
                    }
                    foreach (var item in arr)//新的在旧的里面不存在,则新加
                    {
                        var newid = item.ToInt();
                        var exists = oldSection.Where(s => s.StudySection == newid && s.Delflag == false);
                        if (exists == null || exists.Count() == 0)//
                        {
                            var classSection = new Dianda.AP.Model.Class_StudySection();
                            classSection.ClassId = model.Id;
                            classSection.CreateDate = DateTime.Now;
                            classSection.Delflag = false;
                            classSection.StudySection = item.ToInt();
                            section.Add(classSection);
                        }

                    }
                }
                if (!model.Subject)//不是全部则建立关联数据
                {
                    var arr = Subject.Split(',');
                    var section = new Class_TeachSubjectBLL();
                    var oldSection = section.GetList(" Delflag=0 and ClassId=" + model.Id, "");
                    foreach (var old in oldSection)
                    {
                        var oldId = old.TeachSubject.ToString();
                        var exists = arr.Where(s => s == oldId);
                        if (exists == null || exists.Count() == 0)//旧的在新的里面不存,则删除
                        {
                            old.Delflag = true;
                            section.Update(old);
                        }
                    }
                    foreach (var item in arr)
                    {
                        var newid = item.ToInt();
                        var exists = oldSection.Where(s => s.TeachSubject == newid && s.Delflag == false);
                        if (exists == null || exists.Count() == 0)//
                        {
                            var teachSubject = new Dianda.AP.Model.Class_TeachSubject();
                            teachSubject.ClassId = model.Id;
                            teachSubject.CreateDate = DateTime.Now;
                            teachSubject.Delflag = false;
                            teachSubject.TeachSubject = item.ToInt();
                            section.Add(teachSubject);
                        }
                    }
                }
                if (!model.TeachGrade)//不是全部则建立关联数据
                {
                    var arr = TeachGrade.Split(',');
                    var section = new Class_TeachGradeBLL();
                    var oldSection = section.GetList(" Delflag=0 and ClassId=" + model.Id, "");
                    foreach (var old in oldSection)
                    {
                        var oldId = old.TeachGrade.ToString();
                        var exists = arr.Where(s => s == oldId);
                        if (exists == null || exists.Count() == 0)//旧的在新的里面不存,则删除
                        {
                            old.Delflag = true;
                            section.Update(old);
                        }
                    }
                    foreach (var item in arr)
                    {
                        var newid = item.ToInt();
                        var exists = oldSection.Where(s => s.TeachGrade == newid && s.Delflag == false);
                        if (exists == null || exists.Count() == 0)//
                        {
                            var classSection = new Dianda.AP.Model.Class_TeachGrade();
                            classSection.ClassId = model.Id;
                            classSection.CreateDate = DateTime.Now;
                            classSection.Delflag = false;
                            classSection.TeachGrade = item.ToInt();
                            section.Add(classSection);
                        }
                    }
                }

                if (!model.TeachRank)//不是全部则建立关联数据
                {
                    var arr = TeachRank.Split(',');
                    var section = new Class_TeachRankBLL();
                    var oldSection = section.GetList(" Delflag=0 and ClassId=" + model.Id, "");
                    foreach (var old in oldSection)
                    {
                        var oldId = old.TeachRank.ToString();
                        var exists = arr.Where(s => s == oldId);
                        if (exists == null || exists.Count() == 0)//旧的在新的里面不存,则删除
                        {
                            old.Delflag = true;
                            section.Update(old);
                        }
                    }
                    foreach (var item in arr)
                    {
                        var newid = item.ToInt();
                        var exists = oldSection.Where(s => s.TeachRank == newid && s.Delflag == false);
                        if (exists == null || exists.Count() == 0)//
                        {
                            var classSection = new Dianda.AP.Model.Class_TeachRank();
                            classSection.ClassId = model.Id;
                            classSection.CreateDate = DateTime.Now;
                            classSection.Delflag = false;
                            classSection.TeachRank = item.ToInt();
                            section.Add(classSection);
                        }
                    }
                }

                if (Status == "2")//为提交状态时,新建审核记录
                {
                    var apply = new Dianda.AP.Model.Class_ApplyApplication();
                    apply.ClassId = id.ToInt();
                    apply.AccountId = SiteCache.Instance.LoginInfo.UserId;
                    apply.Remark = "提交审核";
                    apply.CreateDate = DateTime.Now;
                    var applyBll = new Class_ApplyApplicationBLL();
                    applyBll.Add(apply);
                }
                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 5
0
        public JsonResult MyVerifyAll(int Status, string Ids)
        {
            try
            {
                string[] myIds = Ids.Trim(',').Split(',');
                foreach (string Id in myIds)
                {
                    Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
                    Member_ClassRegister member_ClassRegister = new Member_ClassRegister();
                    member_ClassRegister = member_ClassRegisterBLL.GetModel(Convert.ToInt32(Id), "");

                    if ((Status == 3 && member_ClassRegister.Status != 3) || (Status == 5 && member_ClassRegister.Status != 5))
                    {
                        Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
                        Class_Detail class_Detail = new Class_Detail();
                        class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId);
                        class_Detail.People -= 1;
                        class_DetailBLL.Update(class_Detail);
                    }
                    else if ((Status == 2 && member_ClassRegister.Status == 3) || (Status == 4 && member_ClassRegister.Status == 5) || (Status == 2 && member_ClassRegister.Status == 5))
                    {
                        Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
                        Class_Detail class_Detail = new Class_Detail();
                        class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId);
                        class_Detail.People += 1;
                        class_DetailBLL.Update(class_Detail);
                    }
                    member_ClassRegister.Status = Status;
                    member_ClassRegisterBLL.Update(member_ClassRegister);

                    Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL();
                    Member_ClassRegisterApplication member_ClassRegisterApplication = new Member_ClassRegisterApplication();
                    member_ClassRegisterApplication.ClassRegisterId = Convert.ToInt32(Id);
                    member_ClassRegisterApplication.Status = Status;
                    member_ClassRegisterApplication.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                    member_ClassRegisterApplication.Delflag = false;
                    member_ClassRegisterApplication.CreateDate = DateTime.Now;
                    member_ClassRegisterApplicationBLL.Add(member_ClassRegisterApplication);
                }
                return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 6
0
        public ActionResult MyVerify(int Status, int mpId, string content)
        {
            try
            {
                Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL();
                Member_ClassRegister member_ClassRegister = member_ClassRegisterBLL.GetModel(mpId, "");
                member_ClassRegister = member_ClassRegisterBLL.GetModel(mpId, "");
                if ((Status == 3 && member_ClassRegister.Status != 3) || (Status == 5 && member_ClassRegister.Status != 5))
                {
                    Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
                    Class_Detail class_Detail = new Class_Detail();
                    class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId);
                    class_Detail.People -= 1;
                    class_DetailBLL.Update(class_Detail);
                }
                else if ((Status == 2 && member_ClassRegister.Status == 3) || (Status == 4 && member_ClassRegister.Status == 5) || (Status == 2 && member_ClassRegister.Status == 5))
                {
                    Class_DetailBLL class_DetailBLL = new Class_DetailBLL();
                    Class_Detail class_Detail = new Class_Detail();
                    class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId);
                    class_Detail.People += 1;
                    if (class_Detail.LimitPeopleCnt != -1)
                    {
                        if (class_Detail.LimitPeopleCnt < class_Detail.People)
                        {
                            TempData["Msg"] = "超过报名限制!";
                            return RedirectToAction("../../Market/Coursemarket/CoursemarketVerify");
                        }
                    }
                    class_DetailBLL.Update(class_Detail);
                }
                member_ClassRegister.Status = Status;
                member_ClassRegister.ApplyRemark = content;
                member_ClassRegisterBLL.Update(member_ClassRegister);

                Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL();
                Member_ClassRegisterApplication member_ClassRegisterApplication = new Member_ClassRegisterApplication();
                member_ClassRegisterApplication.ClassRegisterId = mpId;
                member_ClassRegisterApplication.Status = Status;
                member_ClassRegisterApplication.Remark = content;
                member_ClassRegisterApplication.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                member_ClassRegisterApplication.Delflag = false;
                member_ClassRegisterApplication.CreateDate = DateTime.Now;
                member_ClassRegisterApplicationBLL.Add(member_ClassRegisterApplication);
                TempData["Msg"] = "提交成功!";
                return RedirectToAction("../../Market/Coursemarket/CoursemarketVerify");
            }
            catch (Exception)
            {
                TempData["Msg"] = "提交失败!";
                return RedirectToAction("../../Market/Coursemarket/CoursemarketVerify");
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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); }
            }
        }