/// <summary> /// 检测是否能报名 /// </summary> /// <param name="ClassId"></param> /// <returns></returns> public static bool CheckCanEnroll(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; 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 false; } //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=4))", ""); //if (listpass.Count > 0) //{ // return false; //} return true; }
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 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); } }
//班级操作 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); } }
//编辑班级 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); } }
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); } }
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); } }
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"); } }
public ActionResult DetailInformation(int Id) { ViewBag.Title = "报名详细信息"; Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL(); Member_ClassRegister member_ClassRegister = new Member_ClassRegister(); member_ClassRegister = member_ClassRegisterBLL.GetModel(Id, ""); Class_DetailBLL class_DetailBLL = new Class_DetailBLL(); Class_Detail class_Detail = new Class_Detail(); class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId); Member_AccountBLL member_AccountBLL = new Member_AccountBLL(); ViewBag.AcountInfo = member_AccountBLL.GetModel(member_ClassRegister.AccountId, ""); Member_BaseInfoBLL member_BaseInfoBLL = new Member_BaseInfoBLL(); ViewBag.BaseInfo = member_BaseInfoBLL.GetModelByAccountId(member_ClassRegister.AccountId); Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL(); ViewBag.CApplicationList = member_ClassRegisterApplicationBLL.GetList(" Delflag='false' and ClassRegisterId='" + member_ClassRegister.Id + "'", "CreateDate"); return View(class_Detail); }
public ActionResult CoursemarketVerifyPage(int Id) { int groupId = Code.SiteCache.Instance.GroupId;//4,学校管理7,普通教师 ViewData["groupId"] = groupId; ViewData["mId"] = Id; ViewBag.Title = "报名审核"; Member_ClassRegisterBLL member_ClassRegisterBLL = new Member_ClassRegisterBLL(); Member_ClassRegister member_ClassRegister = new Member_ClassRegister(); member_ClassRegister = member_ClassRegisterBLL.GetModel(Id, ""); Class_DetailBLL class_DetailBLL = new Class_DetailBLL(); Class_Detail class_Detail = new Class_Detail(); class_Detail = class_DetailBLL.GetModel(member_ClassRegister.ClassId); Member_AccountBLL member_AccountBLL = new Member_AccountBLL(); ViewBag.AcountInfo = member_AccountBLL.GetModel(member_ClassRegister.AccountId, ""); Member_BaseInfoBLL member_BaseInfoBLL = new Member_BaseInfoBLL(); ViewBag.BaseInfo = member_BaseInfoBLL.GetModelByAccountId(member_ClassRegister.AccountId); Member_ClassRegisterApplicationBLL member_ClassRegisterApplicationBLL = new Member_ClassRegisterApplicationBLL(); ViewBag.CApplicationList = member_ClassRegisterApplicationBLL.GetList(" Delflag='false' and ClassRegisterId='" + member_ClassRegister.Id + "'", "CreateDate"); return View(class_Detail); }
public ActionResult CoursemarketSingleEnroll(int Id) { ViewBag.Title = "课程报名"; Class_DetailBLL class_DetailBLL = new Class_DetailBLL(); Class_Detail class_Detail = new Class_Detail(); class_Detail = class_DetailBLL.GetModel(Id); return View(class_Detail); }
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); } } }
/// <summary> /// 学校--教师选择list /// </summary> /// <param name="pageIndex"></param> /// <param name="OrganId"></param> /// <returns></returns> public ActionResult ChooseTeachersList(int? pageIndex, int ClassId, int Type) { Class_DetailBLL class_DetailBLL = new Class_DetailBLL(); Class_Detail ClassModel = class_DetailBLL.GetModel(ClassId); int TrainingId = ClassModel.TraningId; int OrganId = Code.SiteCache.Instance.ManageOrganId; int Groupid = Code.SiteCache.Instance.GroupId; int i = TypeConverter.ObjectToInt(pageIndex, 1); Member_AccountBLL member_AccountBLL = new Member_AccountBLL(); List<Member_AccountBaseInfo> member_AccBaseInfoList = new List<Member_AccountBaseInfo>(); int total = 0; member_AccBaseInfoList = member_AccountBLL.GetMarketMemberList(12, i, Type, ClassModel, TrainingId, OrganId, Groupid, "Id", out total); ViewBag.pageIndex = i; ViewBag.totalPage = total; ViewBag.Type = Type; ViewBag.ClassId = ClassId; return View(member_AccBaseInfoList); }