public bool GrpMem(Domain.Socioboard.Domain.User user) { GroupsRepository grpRep = new GroupsRepository(); GroupMembersRepository grpMemRep = new GroupMembersRepository(); UserRepository userRepo = new UserRepository(); // Domain.Socioboard.Domain.User user = userRepo.getUserInfoByEmail(Email); //foreach (var user in lstUser) //{ try { List<Domain.Socioboard.Domain.Groups> lstGroups = grpRep.getAlluserGroups(user.Id); foreach (var item in lstGroups) { try { if (user != null) { Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers(); grpMember.Id = Guid.NewGuid(); grpMember.Emailid = user.EmailId; grpMember.Groupid = item.Id.ToString(); grpMember.IsAdmin = true; grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted; grpMember.Userid = item.UserId.ToString(); if (!grpMemRep.checkMemberExistsingroup(grpMember.Groupid, grpMember.Userid)) { grpMemRep.AddGroupMemeber(grpMember); } } } catch (Exception ex) { logger.Error(ex.Message); logger.Error(ex.StackTrace); } } } catch (Exception e) { } //} return true; }
private static Domain.Socioboard.Domain.Groups AddGroupByUserId(Guid userId) { Domain.Socioboard.Domain.Groups groups = new Domain.Socioboard.Domain.Groups(); GroupsRepository objGroupRepository = new GroupsRepository(); UserRepository userRepo = new UserRepository(); GroupMembersRepository grpMemberRepo = new GroupMembersRepository(); groups.Id = Guid.NewGuid(); groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"]; groups.UserId = userId; groups.EntryDate = DateTime.UtcNow; objGroupRepository.AddGroup(groups); Domain.Socioboard.Domain.User objUser = userRepo.getUsersById(groups.UserId); Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers(); grpMember.Id = Guid.NewGuid(); grpMember.Groupid = groups.Id.ToString(); grpMember.Userid = groups.UserId.ToString(); grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted; grpMember.Emailid = objUser.EmailId; grpMember.IsAdmin = true; grpMemberRepo.AddGroupMemeber(grpMember); return groups; }
public IHttpActionResult DeleteUserDetails(string user) { GroupsRepository _GroupsRepository=new GroupsRepository(); GroupMembersRepository _GroupMembersRepository = new GroupMembersRepository(); GroupProfileRepository _GroupProfileRepository = new GroupProfileRepository(); TaskRepository _TaskRepository = new TaskRepository(); TaskCommentRepository _TaskCommentRepository = new TaskCommentRepository(); InboxMessagesRepository _InboxMessagesRepository=new InboxMessagesRepository(); FacebookAccountRepository _FacebookAccountRepository=new FacebookAccountRepository(); GoogleAnalyticsAccountRepository _GoogleAnalyticsAccountRepository=new GoogleAnalyticsAccountRepository(); GooglePlusAccountRepository _GooglePlusAccountRepository=new GooglePlusAccountRepository(); InstagramAccountRepository _InstagramAccountRepository=new InstagramAccountRepository(); LinkedInAccountRepository _LinkedInAccountRepository=new LinkedInAccountRepository(); LinkedinCompanyPageRepository _LinkedinCompanyPageRepository=new LinkedinCompanyPageRepository(); ScheduledMessageRepository _ScheduledMessageRepository=new ScheduledMessageRepository(); SocialProfilesRepository _SocialProfilesRepository = new SocialProfilesRepository(); TwitterAccountRepository _TwitterAccountRepository=new TwitterAccountRepository(); TumblrAccountRepository _TumblrAccountRepository = new TumblrAccountRepository(); YoutubeAccountRepository _YoutubeAccountRepository = new YoutubeAccountRepository(); YoutubeChannelRepository _YoutubeChannelRepository = new YoutubeChannelRepository(); try { Domain.Socioboard.Domain.User _User = userrepo.getUserInfoByEmail(user); if (_User != null) { List<Domain.Socioboard.Domain.Groups> lstGroups = _GroupsRepository.getAllGroups(_User.Id); foreach (Domain.Socioboard.Domain.Groups item_group in lstGroups) { int i = _GroupMembersRepository.DeleteGroupMember(item_group.Id.ToString()); int j = _GroupProfileRepository.DeleteAllGroupProfile(item_group.Id); bool rt = _GroupProfileRepository.DeleteGroupReport(item_group.Id); int k = _TaskRepository.DeleteTaskOfGroup(item_group.Id); } int g = _GroupMembersRepository.DeleteGroupMemberByUserId(user); int h = _GroupsRepository.DeleteGroupsByUserid(_User.Id); int l = _TaskCommentRepository.DeleteTaskCommentByUserid(_User.Id); int m = _InboxMessagesRepository.DeleteInboxMessages(_User.Id); int n = _FacebookAccountRepository.DeleteAllFacebookAccount(_User.Id); int o = _GoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(_User.Id); int p = _GooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(_User.Id); int q = _InstagramAccountRepository.DeleteInstagramAccountByUserid(_User.Id); int r = _LinkedInAccountRepository.DeleteLinkedInAccountByUserid(_User.Id); int s = _LinkedinCompanyPageRepository.DeleteLinkedinCompanyPage(_User.Id); int t = _ScheduledMessageRepository.DeleteScheduledMessageByUserid(_User.Id); int u = _SocialProfilesRepository.DeleteSocialProfileByUserid(_User.Id); int v = _TwitterAccountRepository.DeleteTwitterAccountByUserid(_User.Id); int w = _TumblrAccountRepository.DeletetumblraccountByUserid(_User.Id); int x = _YoutubeAccountRepository.DeleteYoutubeAccount(_User.Id); int y = _YoutubeChannelRepository.DeleteYoutubeChannelByUserid(_User.Id); int z = userrepo.DeleteUser(_User.Id); } else { return Ok(false); } } catch (Exception ex) { return BadRequest(ex.StackTrace); } return Ok(true); }