/// <summary> /// Create a new Group object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="createdByUserId">Initial value of the CreatedByUserId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="createdDateTimeStamp">Initial value of the CreatedDateTimeStamp property.</param> /// <param name="active">Initial value of the Active property.</param> /// <param name="autoAccept">Initial value of the AutoAccept property.</param> /// <param name="makePublic">Initial value of the MakePublic property.</param> public static Group CreateGroup(global::System.Int32 id, global::System.Int32 createdByUserId, global::System.String name, global::System.String description, global::System.DateTime createdDateTimeStamp, global::System.Boolean active, global::System.Boolean autoAccept, global::System.Boolean makePublic) { Group group = new Group(); group.Id = id; group.CreatedByUserId = createdByUserId; group.Name = name; group.Description = description; group.CreatedDateTimeStamp = createdDateTimeStamp; group.Active = active; group.AutoAccept = autoAccept; group.MakePublic = makePublic; return group; }
public static string GroupUrl(Group aGroup) { return "/Group/Details/" + aGroup.Id; }
public static bool IsAllowedToEdit(UserInformationModel<User> myUserInfo, Group aGroup) { int myAdminCount = aGroup.GroupMembers.Where(m => m.MemberUserId == myUserInfo.Details.Id).Where(m => m.Administrator).Count<GroupMember>(); return myAdminCount > 0 || PermissionHelper<User>.AllowedToPerformAction(myUserInfo, SocialPermission.Edit_Any_Group); }
/// <summary> /// Deprecated Method for adding a new object to the Groups EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToGroups(Group group) { base.AddObject("Groups", group); }
public static IEnumerable<GroupAdminFeed> GetAdminFeed(Group aGroup, int aLimit) { IEnumerable<GroupMember> myGroupMembers = aGroup.GroupMembers.OrderByDescending(gm => gm.DateTimeStamp); List<GroupAdminFeed> myFeed = new List<GroupAdminFeed>(); myFeed.AddRange(from gm in myGroupMembers.Where(gm2 => gm2.Approved == HAVConstants.PENDING) select new GroupAdminFeed() { GroupMemberId = gm.Id, GroupId = gm.GroupId, MemberUser = gm.MemberUser, DateTimeStamp = gm.DateTimeStamp, HasDetails = true, Status = Status.Pending, FeedType = FeedType.Member }); myFeed.AddRange(from gm in myGroupMembers.Where(gm2 => gm2.Approved == HAVConstants.DENIED) select new GroupAdminFeed() { GroupMemberId = gm.Id, GroupId = gm.GroupId, MemberUser = gm.MemberUser, AdminUser = gm.DeniedByUser, DateTimeStamp = gm.DeniedByDateTimeStamp, Status = Status.Denied, FeedType = FeedType.Member }); myFeed.AddRange(from gm in myGroupMembers .Where(gm2 => gm2.Approved == HAVConstants.APPROVED) .Where(gm2 => !gm2.OldRecord) .Where(gm2 => !gm2.AutoAccepted) select new GroupAdminFeed() { GroupMemberId = gm.Id, GroupId = gm.GroupId, MemberUser = gm.MemberUser, AdminUser = gm.ApprovedByUser, DateTimeStamp = gm.ApprovedDateTimeStamp, Status = Status.Approved, FeedType = FeedType.Member }); myFeed.AddRange(from gm in myGroupMembers .Where(gm2 => gm2.Approved == HAVConstants.APPROVED) .Where(gm2 => !gm2.OldRecord) .Where(gm2 => gm2.AutoAccepted) select new GroupAdminFeed() { GroupMemberId = gm.Id, GroupId = gm.GroupId, MemberUser = gm.MemberUser, DateTimeStamp = gm.DateTimeStamp, Status = Status.Approved, FeedType = FeedType.AutoAcceptedMember }); if (aGroup.LastEditedByUser != null) { myFeed.Add(new GroupAdminFeed() { AdminUser = aGroup.LastEditedByUser, DateTimeStamp = aGroup.LastEditedDateTimeStamp, FeedType = FeedType.Edited }); } if (aGroup.DeactivatedByUser != null) { myFeed.Add(new GroupAdminFeed() { AdminUser = aGroup.DeactivatedByUser, DateTimeStamp = aGroup.DeactivatedDateTimeStamp, FeedType = FeedType.Deactivated }); } return myFeed.OrderByDescending(f => f.DateTimeStamp).Take<GroupAdminFeed>(aLimit); }
private void CreateEmailJobForRequestingMemberToJoinGroupForAdminWithoutSave(Group aGroup, User aMemberJoining, User anAdmin) { string mySubject = EmailContent.NewGroupMemberSubject(aGroup); string myBody = EmailContent.NewGroupMemberBody(aMemberJoining, aGroup); EmailJob myEmailJob = EmailJob.CreateEmailJob(0, EmailType.MEMBER_REQUEST_JOIN_GROUP.ToString(), SiteConfiguration.NotificationsEmail(), anAdmin.Email, mySubject, myBody, DateTime.UtcNow, false, false); theEntities.AddToEmailJobs(myEmailJob); }
private void CreateEmailJobForGroupBoardPostForUserWithoutSave(Group aGroup, string aToEmail) { string mySubject = EmailContent.GroupBoardSubject(aGroup); string myBody = EmailContent.GroupBoardBody(aGroup); EmailJob myEmailJob = EmailJob.CreateEmailJob(0, EmailType.BOARD_POST_TO_GROUP.ToString(), SiteConfiguration.NotificationsEmail(), aToEmail, mySubject, myBody, DateTime.UtcNow, false, false); theEntities.AddToEmailJobs(myEmailJob); }
private void CreateEmailJobForAcceptingMemberIntoGroupWithoutSave(Group aGroup, User aUser) { string mySubject = EmailContent.AcceptedIntoGroupSubject(aGroup); string myBody = EmailContent.AcceptedIntoGroupBody(aGroup); EmailJob myEmailJob = EmailJob.CreateEmailJob(0, EmailType.ACCEPTED_INTO_GROUP.ToString(), SiteConfiguration.NotificationsEmail(), aUser.Email, mySubject, myBody, DateTime.UtcNow, false, false); theEntities.AddToEmailJobs(myEmailJob); }
public void UpdateGroup(Group aGroup) { theEntities.ApplyCurrentValues(aGroup.EntityKey.EntitySetName, aGroup); theEntities.SaveChanges(); }