Example #1
0
        public static string DeleteProfile(long userId, long groupId, Helper.Cache _redisCache, Model.DatabaseRepository dbr, Helper.AppSettings _appSettings)
        {
            Domain.Socioboard.Models.Groups grp = dbr.Find <Domain.Socioboard.Models.Groups>(t => t.id == groupId).FirstOrDefault();
            IList <Domain.Socioboard.Models.Groupprofiles> grpProfiles = dbr.Find <Groupprofiles>(t => t.groupId == groupId);

            if (grpProfiles.Count != 0)
            {
                foreach (Domain.Socioboard.Models.Groupprofiles grpProfile in grpProfiles)
                {
                    string res = string.Empty;
                    if (grpProfile != null)
                    {
                        try
                        {
                            switch (grpProfile.profileType)
                            {
                            case Domain.Socioboard.Enum.SocialProfileType.Facebook:
                            {
                                res = FacebookRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage:
                            {
                                res = FacebookRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.FacebookPublicPage:
                            {
                                res = FacebookRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.Twitter:
                            {
                                res = TwitterRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.LinkedIn:
                            {
                                res = LinkedInAccountRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage:
                            {
                                res = LinkedInAccountRepository.DeleteCompanyPageProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.Instagram:
                            {
                                res = InstagramRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.GoogleAnalytics:
                            {
                                res = GplusRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.GPlus:
                            {
                                res = GplusRepository.DeleteGplusProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.YouTube:
                            {
                                res = GplusRepository.DeleteYoutubeChannelProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }

                            case Domain.Socioboard.Enum.SocialProfileType.Pinterest:
                            {
                                res = PinterestRepository.DeleteProfile(dbr, grpProfile.profileId, userId, _redisCache, _appSettings);
                                break;
                            }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                        try
                        {
                            if (res.Equals("Deleted"))
                            {
                                dbr.Delete <Domain.Socioboard.Models.Groupprofiles>(grpProfile);
                                // dbr.Delete<Domain.Socioboard.Models.Groups>(t => t.id == groupId);
                                _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId);
                                _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheUserProfileCount + userId);
                            }
                            else
                            {
                                if (grpProfile != null)
                                {
                                    dbr.Delete <Domain.Socioboard.Models.Groupprofiles>(grpProfile);
                                    //dbr.Delete<Domain.Socioboard.Models.Groups>(t => t.id == groupId);
                                    _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId);
                                    _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheUserProfileCount + userId);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                    else
                    {
                        return("Issue while deleting Profile");
                    }
                }
                dbr.Delete <Domain.Socioboard.Models.Groups>(grp);
                return("Deleted");
            }
            else
            {
                dbr.Delete <Domain.Socioboard.Models.Groups>(grp);
            }


            return("Deleted");
        }
Example #2
0
        private static string DeleteGroup(long userId, string profileId, Cache _redisCache, DatabaseRepository dbr, AppSettings _appSettings, Groupprofiles grpProfile, string res)
        {
            switch (grpProfile.profileType)
            {
            case SocialProfileType.Facebook:
            {
                res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.FacebookFanPage:
            {
                res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.FacebookPublicPage:
            {
                res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.Twitter:
            {
                res = TwitterRepository.DeleteProfile(dbr, profileId, userId, _redisCache);
                break;
            }

            case SocialProfileType.LinkedIn:
            {
                res = LinkedInAccountRepository.DeleteProfile(dbr, profileId, userId, _redisCache,
                                                              _appSettings);
                break;
            }

            case SocialProfileType.LinkedInComapanyPage:
            {
                res = LinkedInAccountRepository.DeleteCompanyPageProfile(dbr, profileId, userId,
                                                                         _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.Instagram:
            {
                res = InstagramRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.GoogleAnalytics:
            {
                res = GplusRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.GPlus:
            {
                res = GplusRepository.DeleteGplusProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }

            case SocialProfileType.YouTube:
            {
                res = GplusRepository.DeleteYoutubeChannelProfile(dbr, profileId, userId, _redisCache,
                                                                  _appSettings);
                break;
            }

            case SocialProfileType.Pinterest:
            {
                res = PinterestRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                break;
            }
            }

            return(res);
        }
        public static string DeleteProfile(long groupId, long userId, string profileId, Helper.Cache _redisCache, Model.DatabaseRepository dbr, Helper.AppSettings _appSettings)
        {
            Domain.Socioboard.Models.Groupprofiles grpProfile = dbr.Find <Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId && t.profileId.Equals(profileId)).FirstOrDefault();
            Domain.Socioboard.Models.Groups        grp        = dbr.Find <Domain.Socioboard.Models.Groups>(t => t.id == groupId).FirstOrDefault();
            string res = string.Empty;

            if (grpProfile != null)
            {
                if (grp.groupName.Equals(Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName))
                {
                    switch (grpProfile.profileType)
                    {
                    case Domain.Socioboard.Enum.SocialProfileType.Facebook:
                    {
                        res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage:
                    {
                        res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.FacebookPublicPage:
                    {
                        res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.Twitter:
                    {
                        res = TwitterRepository.DeleteProfile(dbr, profileId, userId, _redisCache);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.LinkedIn:
                    {
                        res = LinkedInAccountRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage:
                    {
                        res = LinkedInAccountRepository.DeleteCompanyPageProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.Instagram:
                    {
                        res = InstagramRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.GoogleAnalytics:
                    {
                        res = GplusRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }

                    case Domain.Socioboard.Enum.SocialProfileType.GPlus:
                    {
                        res = GplusRepository.DeleteGplusProfile(dbr, profileId, userId, _redisCache, _appSettings);
                        break;
                    }
                    }
                }
                else
                {
                    Groups defaultGroup = GroupsRepository.getAllGroupsofUser(userId, _redisCache, dbr).Find(t => t.groupName.Equals(Domain.Socioboard.Consatants.SocioboardConsts.DefaultGroupName));
                    List <Groupprofiles> defalutGroupProfiles = getGroupProfiles(defaultGroup.id, _redisCache, dbr);
                    if (defalutGroupProfiles != null && defalutGroupProfiles.Count(t => t.profileId.Equals(profileId)) <= 0)
                    {
                        switch (grpProfile.profileType)
                        {
                        case Domain.Socioboard.Enum.SocialProfileType.Facebook:
                        {
                            res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.FacebookFanPage:
                        {
                            res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.FacebookPublicPage:
                        {
                            res = FacebookRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.Twitter:
                        {
                            res = TwitterRepository.DeleteProfile(dbr, profileId, userId, _redisCache);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.LinkedIn:
                        {
                            res = LinkedInAccountRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage:
                        {
                            res = LinkedInAccountRepository.DeleteCompanyPageProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.Instagram:
                        {
                            res = InstagramRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.GoogleAnalytics:
                        {
                            res = GplusRepository.DeleteProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }

                        case Domain.Socioboard.Enum.SocialProfileType.GPlus:
                        {
                            res = GplusRepository.DeleteGplusProfile(dbr, profileId, userId, _redisCache, _appSettings);
                            break;
                        }
                        }
                    }
                    else
                    {
                        res = "Deleted";
                    }
                }

                if (res.Equals("Deleted"))
                {
                    dbr.Delete <Domain.Socioboard.Models.Groupprofiles>(grpProfile);
                    _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId);
                    _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheUserProfileCount + userId);
                    return("Deleted");
                }
                else
                {
                    if (grpProfile != null)
                    {
                        dbr.Delete <Domain.Socioboard.Models.Groupprofiles>(grpProfile);
                        _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId);
                        _redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheUserProfileCount + userId);
                        return("Deleted");
                    }
                    return(res);
                }
            }
            else
            {
                return("Issue while deleting Profile");
            }
        }
Example #4
0
        private static void AddedProfileDetails(Cache redisCache, DatabaseRepository dbr, List <profilesdetail> groupProfiles, Groupprofiles profile)
        {
            switch (profile.profileType)
            {
            case SocialProfileType.Facebook:
            {
                var fbAcc          = FacebookRepository.getFacebookAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    Fbaccount = fbAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.FacebookFanPage:
            {
                var fbPageAcc      = FacebookRepository.getFacebookAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    Fbaccount = fbPageAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.Twitter:
            {
                var twtAcc         = TwitterRepository.getTwitterAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    Twtaccount = twtAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.Instagram:
            {
                var insAcc         = InstagramRepository.getInstagramAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    Instaaccount = insAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.GPlus:
            {
                var gPlusAcc       = GplusRepository.getGPlusAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    Gplusaccount = gPlusAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.LinkedIn:
            {
                var linkedInAcc    = LinkedInAccountRepository.getLinkedInAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    LinkdInaccount = linkedInAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.LinkedInComapanyPage:
            {
                var linkedCompanyAcc = LinkedInAccountRepository.getLinkedinCompanyPage(profile.profileId, redisCache, dbr);
                var profileDetails   = new profilesdetail {
                    LinkdINcompanyaccount = linkedCompanyAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.YouTube:
            {
                var youtubeChannel = GplusRepository.getYTChannel(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    Ytubeaccount = youtubeChannel
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.GoogleAnalytics:
            {
                var gAAcc          = GplusRepository.getGAAccount(profile.profileId, redisCache, dbr);
                var profileDetails = new profilesdetail {
                    GAaccount = gAAcc
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.Pinterest:
            {
                var pInterestAccountDetail = PinterestRepository.getPinterestAccountDetail(profile.profileId, redisCache, dbr);
                var profileDetails         = new profilesdetail {
                    Pintrestaccount = pInterestAccountDetail
                };
                groupProfiles.Add(profileDetails);
                break;
            }

            case SocialProfileType.GplusPage:
                break;

            case SocialProfileType.Tumblr:
                break;

            case SocialProfileType.FacebookPublicPage:
                break;

            case SocialProfileType.DropBox:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }