public JsonResult AddClassGroupMember(string classId, string groupTitle, string accountIds) { try { var param_classId = Dianda.Common.QueryString.Decrypt(classId).ToInt(); var gbll = new Class_GroupBLL(); var gmbll = new Class_GroupMemberBLL(); var groupNameCheck = new Class_GroupBLL().GetList(" Delflag=0 and ClassId=" + param_classId + " and Title='" + groupTitle.Trim() + "'", ""); if (groupNameCheck != null && groupNameCheck.Count > 0) return Json(new { Code = 0, Msg = "班级内存在此小组名称!" }, JsonRequestBehavior.AllowGet); var gModel = new Class_Group(); gModel.ClassId = param_classId; gModel.CreateDate = DateTime.Now; gModel.Display = true; gModel.Delflag = false; gModel.Title = groupTitle; gbll.Add(gModel); var ids = accountIds.Split(','); foreach (var item in ids) { if (!string.IsNullOrEmpty(item)) { var gmModel = new Class_GroupMember(); gmModel.AccountId = item.ToInt(); gmModel.GroupId = gModel.Id; gmModel.Delflag = false; gmModel.CreateDate = DateTime.Now; gmbll.Add(gmModel); } } return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet); } }
public JsonResult AddMemberToClassGroup(string groupId, string accountIds) { try { var gmbll = new Class_GroupMemberBLL(); var ids = accountIds.Split(','); foreach (var item in ids) { if (!string.IsNullOrEmpty(item)) { var gmModel = new Class_GroupMember(); gmModel.AccountId = item.ToInt(); gmModel.GroupId = groupId.ToInt(); gmModel.Delflag = false; gmModel.CreateDate = DateTime.Now; gmbll.Add(gmModel); } } return Json(new { Code = 0, Msg = "提交成功" }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new { Code = -1, Msg = ex.Message }, JsonRequestBehavior.AllowGet); } }