public Summary <GroupInfoDto> GetPageGroups(string strWhere, string orderby) { var summary = new Summary <GroupInfoDto>(); List <GroupInfoDto> grouplist = new List <GroupInfoDto>(); List <UserGroup> list = BGroup.GetModelList(strWhere + " order by " + orderby); List <UserInfo> userList = BUser.GetModelList(""); GroupInfoDto dto = null; foreach (UserGroup group in list) { dto = new GroupInfoDto(); dto.AddTime = group.AddTime; dto.GroupID = group.GroupID; dto.GroupName = group.GroupName; dto.UserID = group.UserID; dto.UserIds = group.Users; List <UserInfo> users = userList.Where(m => group.Users.Contains(m.UserID.ToString())).ToList(); foreach (UserInfo info in users) { dto.Users += info.RealName + ","; } dto.Users = dto.Users.TrimEnd(','); grouplist.Add(dto); } summary.rows = grouplist; return(summary); }
public int Insert(GroupInfoDto model) { return(Connection(connection => { var sql = "insert into GroupInfo(Title,ProjectId,AdminId,AdminName,CreateTime) output inserted.id values (@Title,@ProjectId,@AdminId,@AdminName,@CreateTime)"; model.AdminId = _user.UserId; model.AdminName = _user.UserName; model.CreateTime = DateTime.Now; return connection.Execute(sql, model); })); }
/// <summary> /// 保存组信息 /// </summary> /// <param name="groupId">组标识</param> /// <param name="groupName">组名</param> /// <param name="groupMaxCapacity">组内用户上限</param> /// <param name="groupPicture">组图片</param> /// <param name="groupUserTypes">组内用户类型</param> /// <param name="storageStatus">持久化状态</param> /// <param name="remark"></param> /// <returns></returns> public ActionResult Save(string groupId, string groupName, string groupMaxCapacity, string groupPicture, string groupUserTypes, string storageStatus, string remark) { var dto = new GroupInfoDto(); dto.GroupId = groupId.ToGuid(); dto.GroupName = groupName; dto.GroupMaxCapacity = groupMaxCapacity.ToInt32(); dto.GroupPicture = groupPicture; dto.GroupUserTypes = groupUserTypes; dto.Remark = remark; dto.StorageStatus = storageStatus.ToInt32(); var groupid = _groupInfoService.Save(dto); if (groupid.IsNullGuid()) { return(ToJsonResult(new { status = -1, msg = "保存出错" })); } else { return(ToJsonResult(new { status = 0, msg = "ok" })); } }