예제 #1
0
        public IHttpActionResult TeamProfileTOGroupProfileService()
        {
            TeamRepository              Tr   = new TeamRepository();
            GroupProfileRepository      GpR  = new GroupProfileRepository();
            TeamMemberProfileRepository TMPR = new TeamMemberProfileRepository();

            List <Domain.Socioboard.Domain.Team> lstTeam = Tr.GetAllActiveTeam();

            foreach (var item in lstTeam)
            {
                List <Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberprofiles = TMPR.getAllTeamMemberProfilesOfTeam(item.Id);
                foreach (var memProfile in lstTeamMemberprofiles)
                {
                    Domain.Socioboard.Domain.GroupProfile grpProfile = new Domain.Socioboard.Domain.GroupProfile();
                    grpProfile.Id           = Guid.NewGuid();
                    grpProfile.EntryDate    = memProfile.StatusUpdateDate;
                    grpProfile.GroupId      = item.GroupId;
                    grpProfile.GroupOwnerId = item.UserId;
                    grpProfile.ProfileId    = memProfile.ProfileId;
                    grpProfile.ProfileName  = memProfile.ProfileName;
                    grpProfile.ProfileType  = memProfile.ProfileType;
                    grpProfile.ProfilePic   = memProfile.ProfilePicUrl;
                    if (!GpR.checkProfileExistsingroup(grpProfile.GroupId, grpProfile.ProfileId))
                    {
                        GpR.AddGroupProfile(grpProfile);
                    }
                }
            }

            return(Ok());
        }
 public string DeleteYoutubeAccount(string UserId, string ProfileId, string GroupId)
 {
     try
     {
         objYoutubeAccountRepository.deleteYoutubeUser(Guid.Parse(UserId), ProfileId);
         objYoutubeChannelRepository.DeleteProfileDataByUserid(ProfileId, Guid.Parse(UserId));
         Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId));
         GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
         objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(UserId), ProfileId, Guid.Parse(GroupId));
         objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id);
         objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId);
         return new JavaScriptSerializer().Serialize("Success");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return "Something Went Wrong";
     }
 }
 public string DeleteTumblrAccount(string UserId, string ProfileId, string GroupId)
 {
     try
     {
         objTumblrAccountRepository.deleteTumblrUser(ProfileId, Guid.Parse(UserId));
         objTumblrFeedRepository.DeleteTumblrDataByUserid(Guid.Parse(UserId), ProfileId);
         Domain.Myfashion.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId));
         GroupProfileRepository       objGroupProfileRepository = new GroupProfileRepository();
         objGroupProfileRepository.DeleteGroupProfile(Guid.Parse(UserId), ProfileId, Guid.Parse(GroupId));
         objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(ProfileId, objTeam.Id);
         objSocialProfilesRepository.deleteProfile(Guid.Parse(UserId), ProfileId);
         return(new JavaScriptSerializer().Serialize("Success"));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return("Something Went Wrong");
     }
 }
예제 #4
0
        public void getFacebookUserProfile(dynamic data, string accesstoken, long friends, Guid user)
        {
            SocialProfile             socioprofile     = new SocialProfile();
            SocialProfilesRepository  socioprofilerepo = new SocialProfilesRepository();
            FacebookAccount           fbAccount        = new FacebookAccount();
            FacebookAccountRepository fbrepo           = new FacebookAccountRepository();

            try
            {
                try
                {
                    fbAccount.AccessToken = accesstoken;
                }
                catch
                {
                }
                try
                {
                    fbAccount.EmailId = data["email"].ToString();
                }
                catch
                {
                }
                try
                {
                    fbAccount.FbUserId = data["id"].ToString();
                }
                catch
                {
                }

                try
                {
                    fbAccount.ProfileUrl = data["link"].ToString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }


                try
                {
                    fbAccount.FbUserName = data["name"].ToString();
                }
                catch
                {
                }
                try
                {
                    fbAccount.Friends = Convert.ToInt32(friends);
                }
                catch
                {
                }
                try
                {
                    fbAccount.Id = Guid.NewGuid();
                }
                catch
                {
                }
                fbAccount.IsActive = 1;
                try
                {
                    if (HttpContext.Current.Session["fbSocial"] != null)
                    {
                        if (HttpContext.Current.Session["fbSocial"] == "p")
                        {
                            //FacebookClient fbClient = new FacebookClient(accesstoken);
                            //int fancountPage = 0;
                            //dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + fbAccount.FbUserId });
                            //foreach (var friend in fancount.data)
                            //{
                            //    fancountPage = friend.fan_count;

                            //}
                            //fbAccount.Friends = Convert.ToInt32(fancountPage);
                            fbAccount.Type = "page";
                        }
                        else
                        {
                            fbAccount.Type = "account";
                        }
                        fbAccount.UserId = user;
                    }

                    if (HttpContext.Current.Session["UserAndGroupsForFacebook"] != null)
                    {
                        try
                        {
                            fbAccount.UserId = user;
                            fbAccount.Type   = "account";
                        }
                        catch (Exception ex)
                        {
                        }
                    }
                }
                catch
                {
                }

                #region unused
                //if (HttpContext.Current.Session["login"] != null)
                //{
                //    if (HttpContext.Current.Session["login"].ToString().Equals("facebook"))
                //    {
                //        User usr = new User();
                //        UserRepository userrepo = new UserRepository();
                //        Registration regObject = new Registration();
                //        usr.AccountType = "free";
                //        usr.CreateDate = DateTime.Now;
                //        usr.ExpiryDate = DateTime.Now.AddMonths(1);
                //        usr.Id = Guid.NewGuid();
                //        usr.UserName = data["name"].ToString();
                //        usr.Password = regObject.MD5Hash(data["name"].ToString());
                //        usr.EmailId = data["email"].ToString();
                //        usr.UserStatus = 1;
                //        if (!userrepo.IsUserExist(data["email"].ToString()))
                //        {
                //            UserRepository.Add(usr);
                //        }
                //    }
                //}
                #endregion
                try
                {
                    socioprofile.UserId = user;
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileType = "facebook";
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileId = data["id"].ToString();
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileStatus = 1;
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileDate = DateTime.Now;
                }
                catch
                {
                }
                try
                {
                    socioprofile.Id = Guid.NewGuid();
                }
                catch
                {
                }
                if (HttpContext.Current.Session["fbSocial"] != null)
                {
                    if (HttpContext.Current.Session["fbSocial"] == "p")
                    {
                        HttpContext.Current.Session["fbpagedetail"] = fbAccount;
                    }
                    else
                    {
                        if (!fbrepo.checkFacebookUserExists(fbAccount.FbUserId, user))
                        {
                            fbrepo.addFacebookUser(fbAccount);
                            if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                            {
                                socioprofilerepo.addNewProfileForUser(socioprofile);

                                GroupRepository        objGroupRepository = new GroupRepository();
                                SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)HttpContext.Current.Session["GroupName"];
                                Groups lstDetails           = objGroupRepository.getGroupName(team.GroupId);
                                if (lstDetails.GroupName == "Socioboard")
                                {
                                    TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                                    TeamMemberProfile           teammemberprofile = new TeamMemberProfile();
                                    teammemberprofile.Id               = Guid.NewGuid();
                                    teammemberprofile.TeamId           = team.Id;
                                    teammemberprofile.ProfileId        = fbAccount.FbUserId;
                                    teammemberprofile.ProfileType      = "facebook";
                                    teammemberprofile.StatusUpdateDate = DateTime.Now;

                                    objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);
                                }
                            }
                            else
                            {
                                socioprofilerepo.updateSocialProfile(socioprofile);
                            }
                        }
                        else
                        {
                            HttpContext.Current.Session["alreadyexist"] = fbAccount;
                            fbrepo.updateFacebookUser(fbAccount);
                            if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                            {
                                socioprofilerepo.addNewProfileForUser(socioprofile);
                            }
                            else
                            {
                                socioprofilerepo.updateSocialProfile(socioprofile);
                            }
                        }
                    }
                }

                if (HttpContext.Current.Session["UserAndGroupsForFacebook"] != null)
                {
                    if (HttpContext.Current.Session["UserAndGroupsForFacebook"].ToString() == "facebook")
                    {
                        try
                        {
                            if (!fbrepo.checkFacebookUserExists(fbAccount.FbUserId, user))
                            {
                                fbrepo.addFacebookUser(fbAccount);
                                if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                                {
                                    socioprofilerepo.addNewProfileForUser(socioprofile);
                                }
                                else
                                {
                                    socioprofilerepo.updateSocialProfile(socioprofile);
                                }
                            }
                            else
                            {
                                fbrepo.updateFacebookUser(fbAccount);
                                if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                                {
                                    socioprofilerepo.addNewProfileForUser(socioprofile);
                                }
                                else
                                {
                                    socioprofilerepo.updateSocialProfile(socioprofile);
                                }
                            }
                            if (HttpContext.Current.Session["GroupName"] != null)
                            {
                                GroupProfile           groupprofile     = new GroupProfile();
                                GroupProfileRepository groupprofilerepo = new GroupProfileRepository();
                                Groups group = (Groups)HttpContext.Current.Session["GroupName"];
                                groupprofile.Id           = Guid.NewGuid();
                                groupprofile.GroupOwnerId = user;
                                groupprofile.ProfileId    = socioprofile.ProfileId;
                                groupprofile.ProfileType  = "facebook";
                                groupprofile.GroupId      = group.Id;
                                groupprofile.EntryDate    = DateTime.Now;
                                if (!groupprofilerepo.checkGroupProfileExists(user, group.Id, groupprofile.ProfileId))
                                {
                                    groupprofilerepo.AddGroupProfile(groupprofile);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
        public string GetTicketsofGroup(string GroupId, string UserId)
        {
            string AssignedUser = string.Empty;
            try
            {
                GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
                FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                TwitterFeedRepository objTwitterFeedRepository = new TwitterFeedRepository();
                List<Domain.Socioboard.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List<Domain.Socioboard.Domain.FeedSentimentalAnalysis>();
                List<Domain.Socioboard.Domain.GroupProfile> objGroupProfile = new List<Domain.Socioboard.Domain.GroupProfile>();
                List<FBTwitterFeeds> objListFBTwitterFeeds = new List<FBTwitterFeeds>();

                objGroupProfile = objGroupProfileRepository.getAllGroupProfiles(Guid.Parse(UserId), Guid.Parse(GroupId));

                if (objGroupProfile.Count > 0)
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getAllNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                else
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                if (lstNegativeFeedsOfUser != null)
                {
                    foreach (var item in lstNegativeFeedsOfUser)
                    {
                        FBTwitterFeeds objFBTwitterFeeds = new FBTwitterFeeds();
                        UserRepository objUserRepository = new UserRepository();
                        Domain.Socioboard.Domain.User user = objUserRepository.getUsersById(item.AssigneUserId);
                        if (objGroupProfileRepository.checkProfileExistsingroup(Guid.Parse(GroupId), item.ProfileId))
                        {
                            string Network = item.Network;
                            if (Network == "facebook")
                            {
                                Domain.Socioboard.Domain.FacebookFeed facebookfeed = objFacebookFeedRepository.getFacebookFeedByProfileId(item.ProfileId, item.FeedId);
                                if (facebookfeed != null)
                                {
                                    objFBTwitterFeeds.FacebookFeed = facebookfeed;
                                }
                            }
                            if (Network == "twitter")
                            {
                                Domain.Socioboard.Domain.TwitterFeed twtfeed = objTwitterFeedRepository.getTwitterFeedByProfileId(item.ProfileId, item.FeedId);
                                if (twtfeed != null)
                                {
                                    objFBTwitterFeeds.TwitterFeed = twtfeed;
                                }
                            }
                            if (objFBTwitterFeeds.TwitterFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            if (objFBTwitterFeeds.FacebookFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                    } 
                }
               
                return new JavaScriptSerializer().Serialize(objListFBTwitterFeeds);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "SomethingWentWrong";
            }

        }
        public string GetTicketsofGroup(string GroupId, string UserId)
        {
            string AssignedUser = string.Empty;

            try
            {
                GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository();
                FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository();
                TwitterFeedRepository  objTwitterFeedRepository  = new TwitterFeedRepository();
                List <Domain.Myfashion.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List <Domain.Myfashion.Domain.FeedSentimentalAnalysis>();
                List <Domain.Myfashion.Domain.GroupProfile>            objGroupProfile        = new List <Domain.Myfashion.Domain.GroupProfile>();
                List <FBTwitterFeeds> objListFBTwitterFeeds = new List <FBTwitterFeeds>();

                objGroupProfile = objGroupProfileRepository.getAllGroupProfiles(Guid.Parse(UserId), Guid.Parse(GroupId));

                if (objGroupProfile.Count > 0)
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getAllNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                else
                {
                    lstNegativeFeedsOfUser = _FeedSentimentalAnalysisRepository.getNegativeFeedsOfUser(Guid.Parse(UserId));
                }
                if (lstNegativeFeedsOfUser != null)
                {
                    foreach (var item in lstNegativeFeedsOfUser)
                    {
                        FBTwitterFeeds objFBTwitterFeeds  = new FBTwitterFeeds();
                        UserRepository objUserRepository  = new UserRepository();
                        Domain.Myfashion.Domain.User user = objUserRepository.getUsersById(item.AssigneUserId);
                        if (objGroupProfileRepository.checkProfileExistsingroup(Guid.Parse(GroupId), item.ProfileId))
                        {
                            string Network = item.Network;
                            if (Network == "facebook")
                            {
                                Domain.Myfashion.Domain.FacebookFeed facebookfeed = objFacebookFeedRepository.getFacebookFeedByProfileId(item.ProfileId, item.FeedId);
                                if (facebookfeed != null)
                                {
                                    objFBTwitterFeeds.FacebookFeed = facebookfeed;
                                }
                            }
                            if (Network == "twitter")
                            {
                                Domain.Myfashion.Domain.TwitterFeed twtfeed = objTwitterFeedRepository.getTwitterFeedByProfileId(item.ProfileId, item.FeedId);
                                if (twtfeed != null)
                                {
                                    objFBTwitterFeeds.TwitterFeed = twtfeed;
                                }
                            }
                            if (objFBTwitterFeeds.TwitterFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            if (objFBTwitterFeeds.FacebookFeed != null)
                            {
                                try
                                {
                                    objFBTwitterFeeds.TicketNo = item.TicketNo;
                                    if (user != null)
                                    {
                                        objFBTwitterFeeds.AssignedUser = user.UserName;
                                    }
                                    else
                                    {
                                        objFBTwitterFeeds.AssignedUser = "";
                                    }
                                    objListFBTwitterFeeds.Add(objFBTwitterFeeds);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                        }
                    }
                }

                return(new JavaScriptSerializer().Serialize(objListFBTwitterFeeds));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("SomethingWentWrong");
            }
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        private void getTwitterUserProfile()
        {
            var requestToken    = (String)Request.QueryString["oauth_token"];
            var requestSecret   = (String)Session["requestSecret"];
            var requestVerifier = (String)Request.QueryString["oauth_verifier"];


            OAuth.AccessToken       = requestToken;
            OAuth.AccessTokenSecret = requestVerifier;
            OAuth.AccessTokenGet(requestToken, requestVerifier);

            JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);
            User   user    = (User)Session["LoggedUser"];
            SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
            SocialProfile            socioprofile     = new SocialProfile();

            #region for managing referrals
            ManageReferrals(OAuth);
            #endregion

            foreach (var item in profile)
            {
                try
                {
                    twitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                twitterAccount.Id          = Guid.NewGuid();
                twitterAccount.IsActive    = true;
                twitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                twitterAccount.OAuthToken  = OAuth.AccessToken;
                try
                {
                    twitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twitterAccount.ProfileUrl = string.Empty;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception er)
                {
                    try
                    {
                        twitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception err)
                    {
                        Console.WriteLine(err.StackTrace);
                    }
                    Console.WriteLine(er.StackTrace);
                }

                try
                {
                    twitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                twitterAccount.UserId = user.Id;

                socioprofile.Id          = Guid.NewGuid();
                socioprofile.ProfileDate = DateTime.Now;
                socioprofile.ProfileId   = twitterAccount.TwitterUserId;
                socioprofile.ProfileType = "twitter";
                socioprofile.UserId      = user.Id;

                if (HttpContext.Current.Session["login"] != null)
                {
                    if (HttpContext.Current.Session["login"].ToString().Equals("twitter"))
                    {
                        User           usr       = new User();
                        UserRepository userrepo  = new UserRepository();
                        Registration   regObject = new Registration();
                        usr.AccountType = "free";
                        usr.CreateDate  = DateTime.Now;
                        usr.ExpiryDate  = DateTime.Now.AddMonths(1);
                        usr.Id          = Guid.NewGuid();
                        usr.UserName    = twitterAccount.TwitterName;
                        usr.Password    = regObject.MD5Hash(twitterAccount.TwitterName);
                        usr.EmailId     = "";
                        usr.UserStatus  = 1;
                        if (!userrepo.IsUserExist(usr.EmailId))
                        {
                            UserRepository.Add(usr);
                        }
                    }
                }

                TwitterStatsRepository objTwtstats = new TwitterStatsRepository();
                TwitterStats           objStats    = new TwitterStats();
                Random rNum = new Random();
                objStats.Id             = Guid.NewGuid();
                objStats.TwitterId      = twitterAccount.TwitterUserId;
                objStats.UserId         = user.Id;
                objStats.FollowingCount = twitterAccount.FollowingCount;
                objStats.FollowerCount  = twitterAccount.FollowersCount;
                objStats.Age1820        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age2124        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age2534        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age3544        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age4554        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age5564        = rNum.Next(twitterAccount.FollowersCount);
                objStats.Age65          = rNum.Next(twitterAccount.FollowersCount);
                objStats.EntryDate      = DateTime.Now;
                if (!objTwtstats.checkTwitterStatsExists(twitterAccount.TwitterUserId, user.Id))
                {
                    objTwtstats.addTwitterStats(objStats);
                }
                if (!twtrepo.checkTwitterUserExists(twitterAccount.TwitterUserId, user.Id))
                {
                    twtrepo.addTwitterkUser(twitterAccount);
                    if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                    {
                        socioprofilerepo.addNewProfileForUser(socioprofile);


                        GroupRepository        objGroupRepository = new GroupRepository();
                        SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)HttpContext.Current.Session["GroupName"];
                        Groups lstDetails           = objGroupRepository.getGroupName(team.GroupId);
                        if (lstDetails.GroupName == "Socioboard")
                        {
                            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
                            TeamMemberProfile           teammemberprofile = new TeamMemberProfile();
                            teammemberprofile.Id               = Guid.NewGuid();
                            teammemberprofile.TeamId           = team.Id;
                            teammemberprofile.ProfileId        = twitterAccount.TwitterUserId;
                            teammemberprofile.ProfileType      = "twitter";
                            teammemberprofile.StatusUpdateDate = DateTime.Now;

                            objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);
                        }
                    }
                    else
                    {
                        socioprofilerepo.updateSocialProfile(socioprofile);
                    }
                }
                else
                {
                    HttpContext.Current.Session["alreadyexist"] = twitterAccount;
                    twtrepo.updateTwitterUser(twitterAccount);
                    TwitterMessageRepository twtmsgreponew = new TwitterMessageRepository();
                    twtmsgreponew.updateScreenName(twitterAccount.TwitterUserId, twitterAccount.TwitterScreenName);
                    if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                    {
                        socioprofilerepo.addNewProfileForUser(socioprofile);
                    }
                    else
                    {
                        socioprofilerepo.updateSocialProfile(socioprofile);
                    }
                }
                if (Session["UserAndGroupsForTwitter"] != null)
                {
                    if (Session["UserAndGroupsForTwitter"].ToString() == "twitter")
                    {
                        try
                        {
                            if (Session["GroupName"] != null)
                            {
                                Groups                 group            = (Groups)Session["GroupName"];
                                GroupProfile           groupprofile     = new GroupProfile();
                                GroupProfileRepository groupprofilerepo = new GroupProfileRepository();
                                groupprofile.Id           = Guid.NewGuid();
                                groupprofile.ProfileId    = socioprofile.ProfileId;
                                groupprofile.ProfileType  = "twitter";
                                groupprofile.GroupOwnerId = user.Id;
                                groupprofile.EntryDate    = DateTime.Now;
                                groupprofile.GroupId      = group.Id;
                                if (!groupprofilerepo.checkGroupProfileExists(user.Id, group.Id, groupprofile.ProfileId))
                                {
                                    groupprofilerepo.AddGroupProfile(groupprofile);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e.StackTrace);
                        }
                    }
                }
            }
        }
        public IHttpActionResult TeamProfileTOGroupProfileService() 
        {
            TeamRepository Tr = new TeamRepository();
                GroupProfileRepository GpR = new GroupProfileRepository();
            TeamMemberProfileRepository TMPR = new TeamMemberProfileRepository();

            List<Domain.Socioboard.Domain.Team> lstTeam = Tr.GetAllActiveTeam();
            foreach(var item in lstTeam)
            {
                List<Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberprofiles = TMPR.getAllTeamMemberProfilesOfTeam(item.Id);
                foreach (var memProfile in lstTeamMemberprofiles) 
                {
                    Domain.Socioboard.Domain.GroupProfile grpProfile = new Domain.Socioboard.Domain.GroupProfile();
                    grpProfile.Id = Guid.NewGuid();
                    grpProfile.EntryDate = memProfile.StatusUpdateDate;
                    grpProfile.GroupId = item.GroupId;
                    grpProfile.GroupOwnerId = item.UserId;
                    grpProfile.ProfileId = memProfile.ProfileId;
                    grpProfile.ProfileName = memProfile.ProfileName;
                    grpProfile.ProfileType = memProfile.ProfileType;
                    grpProfile.ProfilePic = memProfile.ProfilePicUrl;
                    if (!GpR.checkProfileExistsingroup(grpProfile.GroupId, grpProfile.ProfileId)) 
                    {
                        GpR.AddGroupProfile(grpProfile);
                    }
                }

            }

            return Ok();
        }
예제 #9
0
        //protected void rbAdmin_CheckedChanged(object sender, EventArgs e)
        //{
        //    rbAdmin.Checked = true;
        //    rbUser.Checked = false;
        //    if (rbAdmin.Checked == true && rbUser.Checked == false)
        //    {
        //        AccessLevel = "admin";
        //    }
        //    else
        //    {
        //        AccessLevel = "user";
        //    }
        //}



        //protected void rbUser_CheckedChanged(object sender, EventArgs e)
        //{
        //    rbAdmin.Checked = false;
        //    rbUser.Checked = true;

        //    if (rbAdmin.Checked == false && rbUser.Checked == true)
        //    {
        //        AccessLevel = "user";
        //    }
        //    else
        //    {
        //        AccessLevel = "admin";
        //    }
        //}

        public void BindSocialProfiles()
        {
            User user = (User)Session["LoggedUser"];

            if (Session["GroupId"] != null)
            {
                Guid groupid = (Guid)Session["GroupId"];
                GroupProfileRepository groupprofilesrepo = new GroupProfileRepository();
                GroupRepository        grouprepo         = new GroupRepository();
                Groups groups = grouprepo.getGroupDetailsbyId(user.Id, groupid);

                List <GroupProfile> lstgroupprofile = groupprofilesrepo.getAllGroupProfiles(user.Id, groupid);

                string bindfacebookprofiles  = string.Empty;
                string bindtwitterprofiles   = string.Empty;
                string bindlinkedinprofiles  = string.Empty;
                string bindinstagramprofiles = string.Empty;
                string bindtumblrprofiles    = string.Empty;
                int    i = 0;

                foreach (GroupProfile item in lstgroupprofile)
                {
                    if (item.ProfileType == "facebook")
                    {
                        FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository();
                        FacebookAccount           account       = fbaccountrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id);

                        if (account != null)
                        {
                            bindfacebookprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + account.FbUserName + "</div>" +
                                                    "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"facebook_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"facebookcheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>";
                        }
                    }
                    else if (item.ProfileType == "twitter")
                    {
                        TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                        TwitterAccount           twtaccount     = twtaccountrepo.getUserInformation(user.Id, item.ProfileId);

                        if (twtaccount != null)
                        {
                            bindtwitterprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + twtaccount.TwitterScreenName + "</div>" +
                                                   "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"twitter_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"twittercheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>";
                        }
                    }
                    else if (item.ProfileType == "linkedin")
                    {
                        LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository();
                        LinkedInAccount           linkedaccount = linkedaccrepo.getUserInformation(user.Id, item.ProfileId);
                        if (linkedaccount != null)
                        {
                            bindlinkedinprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + linkedaccount.LinkedinUserName + "</div>" +
                                                    "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"linkedin_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"linkedincheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>";
                        }
                    }


                    else if (item.ProfileType == "tumblr")
                    {
                        TumblrAccountRepository tumblraccrepo = new TumblrAccountRepository();
                        TumblrAccount           tumblraccount = tumblraccrepo.getTumblrAccountDetailsById(item.ProfileId, user.Id);
                        if (tumblraccount != null)
                        {
                            bindtumblrprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + tumblraccount.tblrUserName + "</div>" +
                                                  "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"tumblr_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"tumblrcheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>";
                        }
                    }

                    else if (item.ProfileType == "instagram")
                    {
                        InstagramAccountRepository instagramrepo = new InstagramAccountRepository();
                        InstagramAccount           instaaccount  = instagramrepo.getInstagramAccountDetailsById(item.ProfileId, user.Id);
                        if (instaaccount != null)
                        {
                            bindinstagramprofiles += "<div class=\"ws_tm_network_one\"><div class=\"ws_tm_user_name\">" + instaaccount.InsUserName + "</div>" +
                                                     "<div class=\"ws_tm_chkbx\"><input type=\"checkbox\" value=\"instagram_" + item.ProfileId + "\" onclick=\"isProfileID('" + item.ProfileId + "')\" id=\"instagramcheck_" + i + "\" name=\"chkbox_" + i + "\"></div></div>";
                        }
                    }
                    i++;
                }

                if (!string.IsNullOrEmpty(bindfacebookprofiles))
                {
                    FacebookAc.InnerHtml = bindfacebookprofiles;
                }
                else
                {
                    FacebookAc.InnerHtml = "No Facebook Profiles for " + groups.GroupName + " Group";
                }

                if (!string.IsNullOrEmpty(bindtwitterprofiles))
                {
                    TwitterAc.InnerHtml = bindtwitterprofiles;
                }
                else
                {
                    TwitterAc.InnerHtml = "No Twitter Profiles for " + groups.GroupName + " Group";
                }
                if (!string.IsNullOrEmpty(bindinstagramprofiles))
                {
                    InstagramAc.InnerHtml = bindinstagramprofiles;
                }
                else
                {
                    InstagramAc.InnerHtml = "No Instagram Profiles for " + groups.GroupName + " Group";
                }
                if (!string.IsNullOrEmpty(bindlinkedinprofiles))
                {
                    LinkedInAc.InnerHtml = bindlinkedinprofiles;
                }
                else
                {
                    LinkedInAc.InnerHtml = "No LinkedIn Profiles for " + groups.GroupName + " Group";
                }
                if (!string.IsNullOrEmpty(bindtumblrprofiles))
                {
                    TumblrAc.InnerHtml = bindtumblrprofiles;
                }
                else
                {
                    TumblrAc.InnerHtml = "No Tumblr Profiles for " + groups.GroupName + " Group";
                }
                totalaccountscheck.InnerHtml = i.ToString();
            }
        }
예제 #10
0
        public string DeleteAllUsersByCreateDate(string date)
        {
            int                                i                                     = 0;
            int                                count                                 = 0;
            UserRepository                     objUserRepository                     = new UserRepository();
            List <User>                        lstuser                               = objUserRepository.GetAllUsersByCreateDate(date);
            ArchiveMessageRepository           objArchiveMessageRepository           = new ArchiveMessageRepository();
            DiscoverySearchRepository          objDiscoverySearchRepository          = new DiscoverySearchRepository();
            DraftsRepository                   objDraftsRepository                   = new DraftsRepository();
            FacebookAccountRepository          objFacebookAccountRepository          = new FacebookAccountRepository();
            FacebookFeedRepository             objFacebookFeedRepository             = new FacebookFeedRepository();
            FacebookInsightPostStatsRepository objFacebookInsightPostStatsRepository = new FacebookInsightPostStatsRepository();
            FacebookInsightStatsRepository     objFacebookInsightStatsRepository     = new FacebookInsightStatsRepository();
            FacebookMessageRepository          objFacebookMessageRepository          = new FacebookMessageRepository();
            FacebookStatsRepository            objFacebookStatsRepository            = new FacebookStatsRepository();
            GoogleAnalyticsAccountRepository   objGoogleAnalyticsAccountRepository   = new GoogleAnalyticsAccountRepository();
            GoogleAnalyticsStatsRepository     objGoogleAnalyticsStatsRepository     = new GoogleAnalyticsStatsRepository();
            GooglePlusAccountRepository        objGooglePlusAccountRepository        = new GooglePlusAccountRepository();
            GooglePlusActivitiesRepository     objGooglePlusActivitiesRepository     = new GooglePlusActivitiesRepository();
            GroupProfileRepository             objGroupProfileRepository             = new GroupProfileRepository();
            GroupRepository                    objGroupRepository                    = new GroupRepository();
            InstagramAccountRepository         objInstagramAccountRepository         = new InstagramAccountRepository();
            InstagramCommentRepository         objInstagramCommentRepository         = new InstagramCommentRepository();
            InstagramFeedRepository            objInstagramFeedRepository            = new InstagramFeedRepository();
            LinkedInAccountRepository          objLinkedInAccountRepository          = new LinkedInAccountRepository();
            LinkedInFeedRepository             objLinkedInFeedRepository             = new LinkedInFeedRepository();
            LogRepository                      objLogRepository                      = new LogRepository();
            RssFeedsRepository                 objRssFeedsRepository                 = new RssFeedsRepository();
            RssReaderRepository                objRssReaderRepository                = new RssReaderRepository();
            ScheduledMessageRepository         objScheduledMessageRepository         = new ScheduledMessageRepository();
            SocialProfilesRepository           objSocialProfilesRepository           = new SocialProfilesRepository();
            TaskCommentRepository              objTaskCommentRepository              = new TaskCommentRepository();
            TaskRepository                     objTaskRepository                     = new TaskRepository();
            TeamRepository                     objTeamRepository                     = new TeamRepository();
            TeamMemberProfileRepository        objTeamMemberProfileRepository        = new TeamMemberProfileRepository();
            TwitterAccountRepository           objTwitterAccountRepository           = new TwitterAccountRepository();
            TwitterDirectMessageRepository     objTwitterDirectMessageRepository     = new TwitterDirectMessageRepository();
            TwitterFeedRepository              objTwitterFeedRepository              = new TwitterFeedRepository();
            TwitterMessageRepository           objTwitterMessageRepository           = new TwitterMessageRepository();
            TwitterStatsRepository             objTwitterStatsRepository             = new TwitterStatsRepository();
            UserActivationRepository           objUserActivationRepository           = new UserActivationRepository();
            UserPackageRelationRepository      objUserPackageRelationRepository      = new UserPackageRelationRepository();



            count = lstuser.Count();


            foreach (var item in lstuser)
            {
                i++;
                try
                {
                    if (item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**")
                    {
                    }
                    else
                    {
                        objArchiveMessageRepository.DeleteArchiveMessageByUserid(item.Id);
                        objDiscoverySearchRepository.DeleteDiscoverySearchByUserid(item.Id);
                        objDraftsRepository.DeleteDraftsByUserid(item.Id);
                        objFacebookAccountRepository.DeleteFacebookAccountByUserid(item.Id);
                        objFacebookFeedRepository.DeleteFacebookFeedByUserid(item.Id);
                        objFacebookInsightPostStatsRepository.DeleteFacebookInsightPostStatsByUserid(item.Id);
                        objFacebookInsightStatsRepository.DeleteFacebookInsightStatsByUserid(item.Id);
                        objFacebookMessageRepository.DeleteFacebookMessageByUserid(item.Id);
                        objFacebookStatsRepository.DeleteFacebookStatsByUserid(item.Id);
                        objGoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(item.Id);
                        objGoogleAnalyticsStatsRepository.DeleteGoogleAnalyticsStatsByUserid(item.Id);
                        objGooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(item.Id);
                        objGooglePlusActivitiesRepository.DeleteGooglePlusActivitiesByUserid(item.Id);
                        objGroupProfileRepository.DeleteGroupProfileByUserid(item.Id);
                        objGroupRepository.DeleteGroupsByUserid(item.Id);
                        objInstagramAccountRepository.DeleteInstagramAccountByUserid(item.Id);
                        objInstagramCommentRepository.DeleteInstagramCommentByUserid(item.Id);
                        objInstagramFeedRepository.DeleteInstagramFeedByUserid(item.Id);
                        objLinkedInAccountRepository.DeleteLinkedInAccountByUserid(item.Id);
                        objLinkedInFeedRepository.DeleteLinkedInFeedByUserid(item.Id);
                        objLogRepository.DeleteLogByUserid(item.Id);
                        objRssFeedsRepository.DeleteRssFeedsByUserid(item.Id);
                        objRssReaderRepository.DeleteRssReaderByUserid(item.Id);
                        objScheduledMessageRepository.DeleteScheduledMessageByUserid(item.Id);
                        objSocialProfilesRepository.DeleteSocialProfileByUserid(item.Id);
                        objTaskCommentRepository.DeleteTaskCommentByUserid(item.Id);
                        objTaskRepository.DeleteTasksByUserid(item.Id);
                        objTeamRepository.DeleteTeamByUserid(item.Id);
                        objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(item.Id);
                        objTwitterAccountRepository.DeleteTwitterAccountByUserid(item.Id);
                        objTwitterDirectMessageRepository.DeleteTwitterDirectMessagesByUserid(item.Id);
                        objTwitterFeedRepository.DeleteTwitterFeedByUserid(item.Id);
                        objTwitterMessageRepository.DeleteTwitterMessageByUserid(item.Id);
                        objTwitterStatsRepository.DeleteTwitterStatsByUserid(item.Id);
                        objUserActivationRepository.DeleteUserActivationByUserid(item.Id);
                        objUserPackageRelationRepository.DeleteuserPackageRelationByUserid(item.Id);
                        objUserRepository.DeleteUserByUserid(item.Id);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            return(i + " " + count);
        }
예제 #11
0
        public void getFacebookUserProfile(dynamic data, string accesstoken, long friends, Guid user)
        {
            SocialProfile socioprofile = new SocialProfile();
            //SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
            Api.SocialProfile.SocialProfile ApiObjSocialProfile = new Api.SocialProfile.SocialProfile();
            FacebookAccount fbAccount = new FacebookAccount();
            //FacebookAccountRepository fbrepo = new FacebookAccountRepository();
            Api.FacebookFeed.FacebookFeed ApiObjFacebookFeed = new Api.FacebookFeed.FacebookFeed();
            try
            {
                try
                {
                    fbAccount.AccessToken = accesstoken;
                }
                catch
                {
                }
                try
                {
                    fbAccount.EmailId = data["email"].ToString();
                }
                catch
                {
                }
                try
                {
                    fbAccount.FbUserId = data["id"].ToString();
                }
                catch
                {
                }

                try
                {
                    fbAccount.ProfileUrl = data["link"].ToString();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }


                try
                {
                    fbAccount.FbUserName = data["name"].ToString();
                }
                catch
                {
                }
                try
                {
                    fbAccount.Friends = Convert.ToInt32(friends);
                }
                catch
                {
                }
                try
                {
                    fbAccount.Id = Guid.NewGuid();
                }
                catch
                {
                }
                fbAccount.IsActive = 1;
                try
                {
                    if (HttpContext.Current.Session["fbSocial"] != null)
                    {
                        if (HttpContext.Current.Session["fbSocial"] == "p")
                        {
                            //FacebookClient fbClient = new FacebookClient(accesstoken);
                            //int fancountPage = 0;
                            //dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + fbAccount.FbUserId });
                            //foreach (var friend in fancount.data)
                            //{
                            //    fancountPage = friend.fan_count;

                            //}
                            //fbAccount.Friends = Convert.ToInt32(fancountPage);
                            fbAccount.Type = "page";
                        }
                        else
                        {
                            fbAccount.Type = "account";
                        }
                        fbAccount.UserId = user;
                    }

                    if (HttpContext.Current.Session["UserAndGroupsForFacebook"] != null)
                    {
                        try
                        {
                            fbAccount.UserId = user;
                            fbAccount.Type = "account";
                        }
                        catch (Exception ex)
                        {

                        }
                    }
                }
                catch
                {
                }

                #region unused
                //if (HttpContext.Current.Session["login"] != null)
                //{
                //    if (HttpContext.Current.Session["login"].ToString().Equals("facebook"))
                //    {
                //        User usr = new User();
                //        UserRepository userrepo = new UserRepository();
                //        Registration regObject = new Registration();
                //        usr.AccountType = "free";
                //        usr.CreateDate = DateTime.Now;
                //        usr.ExpiryDate = DateTime.Now.AddMonths(1);
                //        usr.Id = Guid.NewGuid();
                //        usr.UserName = data["name"].ToString();
                //        usr.Password = regObject.MD5Hash(data["name"].ToString());
                //        usr.EmailId = data["email"].ToString();
                //        usr.UserStatus = 1;
                //        if (!userrepo.IsUserExist(data["email"].ToString()))
                //        {
                //            UserRepository.Add(usr);
                //        }
                //    }
                //} 
                #endregion
                try
                {
                    socioprofile.UserId = user;
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileType = "facebook";
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileId = data["id"].ToString();
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileStatus = 1;
                }
                catch
                {
                }
                try
                {
                    socioprofile.ProfileDate = DateTime.Now;
                }
                catch
                {
                }
                try
                {
                    socioprofile.Id = Guid.NewGuid();
                }
                catch
                {
                }
                if (HttpContext.Current.Session["fbSocial"] != null)
                {
                    if (HttpContext.Current.Session["fbSocial"] == "p")
                    {

                        HttpContext.Current.Session["fbpagedetail"] = fbAccount;
                    }
                    else
                    {
                        if (!fbrepo.checkFacebookUserExists(fbAccount.FbUserId, user))
                        {
                            fbrepo.addFacebookUser(fbAccount);
                            if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                            {
                               
                                socioprofilerepo.addNewProfileForUser(socioprofile);

                                GroupRepository objGroupRepository = new GroupRepository();
                                SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)HttpContext.Current.Session["GroupName"];
                                Groups lstDetails = objGroupRepository.getGroupName(team.GroupId);
                                if (lstDetails.GroupName == "Socioboard")
                                {                                   
                                    TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();                                  
                                    TeamMemberProfile teammemberprofile = new TeamMemberProfile();
                                    teammemberprofile.Id = Guid.NewGuid();
                                    teammemberprofile.TeamId = team.Id;
                                    teammemberprofile.ProfileId = fbAccount.FbUserId;
                                    teammemberprofile.ProfileType = "facebook";
                                    teammemberprofile.StatusUpdateDate = DateTime.Now;

                                    objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);

                                }




                            }
                            else
                            {
                                socioprofilerepo.updateSocialProfile(socioprofile);
                            }

                           

                        }
                        else
                        {
                            HttpContext.Current.Session["alreadyexist"] = fbAccount;
                            fbrepo.updateFacebookUser(fbAccount);
                            if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                            {
                                socioprofilerepo.addNewProfileForUser(socioprofile);
                            }
                            else
                            {
                                socioprofilerepo.updateSocialProfile(socioprofile);
                            }
                        }

                    }
                }

                if (HttpContext.Current.Session["UserAndGroupsForFacebook"] != null)
                {
                    if (HttpContext.Current.Session["UserAndGroupsForFacebook"].ToString() == "facebook")
                    {
                        try
                        {
                            if (!fbrepo.checkFacebookUserExists(fbAccount.FbUserId, user))
                            {
                                fbrepo.addFacebookUser(fbAccount);
                                if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                                {
                                    socioprofilerepo.addNewProfileForUser(socioprofile);
                                }
                                else
                                {
                                    socioprofilerepo.updateSocialProfile(socioprofile);
                                }
                            }
                            else
                            {
                                fbrepo.updateFacebookUser(fbAccount);
                                if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                                {
                                    socioprofilerepo.addNewProfileForUser(socioprofile);
                                }
                                else
                                {
                                    socioprofilerepo.updateSocialProfile(socioprofile);
                                }
                            
                            }
                            if (HttpContext.Current.Session["GroupName"] != null)
                            {
                                GroupProfile groupprofile = new GroupProfile();
                                GroupProfileRepository groupprofilerepo = new GroupProfileRepository();
                                Groups group = (Groups)HttpContext.Current.Session["GroupName"];
                                groupprofile.Id = Guid.NewGuid();
                                groupprofile.GroupOwnerId = user;
                                groupprofile.ProfileId = socioprofile.ProfileId;
                                groupprofile.ProfileType = "facebook";
                                groupprofile.GroupId = group.Id;
                                groupprofile.EntryDate = DateTime.Now;
                                if (!groupprofilerepo.checkGroupProfileExists(user, group.Id, groupprofile.ProfileId))
                                {
                                    groupprofilerepo.AddGroupProfile(groupprofile);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
 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);
 }
예제 #13
0
        public void ProcessRequest()
        {
            TeamRepository objTeamRepository = new TeamRepository();
            TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository();
            FacebookAccountRepository   fbaccountrepo    = new FacebookAccountRepository();
            TwitterAccountRepository    twtaccountrepo   = new TwitterAccountRepository();
            LinkedInAccountRepository   linkedaccrepo    = new LinkedInAccountRepository();
            InstagramAccountRepository  instagramrepo    = new InstagramAccountRepository();
            GroupProfileRepository      groupprofilerepo = new GroupProfileRepository();
            BusinessSettingRepository   objbsnsrepo      = new BusinessSettingRepository();
            TumblrAccountRepository     tumblrrepo       = new TumblrAccountRepository();



            User user = (User)Session["LoggedUser"];

            if (Request.QueryString["op"] != null)
            {
                if (Request.QueryString["op"] == "SaveGroupName")
                {
                    string          groupName = Request.QueryString["groupname"];
                    GroupRepository grouprepo = new GroupRepository();
                    Groups          group     = new Groups();
                    group.Id        = Guid.NewGuid();
                    group.GroupName = groupName;
                    group.UserId    = user.Id;
                    group.EntryDate = DateTime.Now;

                    if (!grouprepo.checkGroupExists(user.Id, groupName))
                    {
                        grouprepo.AddGroup(group);
                        Groups grou = grouprepo.getGroupDetails(user.Id, groupName);
                        Session["GroupName"] = grou;
                    }
                    else
                    {
                        Groups grou = grouprepo.getGroupDetails(user.Id, groupName);
                        Session["GroupName"] = grou;
                    }
                }
                else if (Request.QueryString["op"] == "bindGroupProfiles")
                {
                    string bindprofiles = string.Empty;
                    Guid   groupid      = Guid.Parse(Request.QueryString["groupId"]);
                    Session["GroupId"] = groupid;
                    GroupProfileRepository groupprofilesrepo = new GroupProfileRepository();
                    List <GroupProfile>    lstgroupprofile   = groupprofilesrepo.getAllGroupProfiles(user.Id, groupid);
                    foreach (GroupProfile item in lstgroupprofile)
                    {
                        if (item.ProfileType == "facebook")
                        {
                            FacebookAccount account = fbaccountrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id);
                            if (account != null)
                            {
                                bindprofiles += "<div id=\"facebook_" + item.ProfileId + "\" class=\"ws_conct\"> <span class=\"img\"><img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\"><i><img width=\"16\" height=\"16\" src=\"../Contents/img/fb_icon.png\" alt=\"\"></i></span><div class=\"fourfifth\">" +
                                                "<div class=\"location-container\">" + account.FbUserName + "</div><span onclick=\"AddProfileInInviteTeamMember('" + account.FbUserId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }
                        else if (item.ProfileType == "twitter")
                        {
                            TwitterAccount twtaccount    = twtaccountrepo.getUserInformation(user.Id, item.ProfileId);
                            string         profileimgurl = string.Empty;
                            if (twtaccount != null)
                            {
                                if (twtaccount.ProfileImageUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = twtaccount.ProfileImageUrl;
                                }

                                bindprofiles +=
                                    "<div id=\"twitter_" + item.ProfileId + "\" class=\"ws_conct active\"> <span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"><i><img width=\"16\" height=\"16\" src=\"../Contents/img/twticon.png\" alt=\"\"></i></span><div class=\"fourfifth\">" +
                                    "<div class=\"location-container\">" + twtaccount.TwitterScreenName + "</div><span onclick=\"AddProfileInInviteTeamMember('" + twtaccount.TwitterUserId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\"  class=\"add remove\">✖</span></div></div>";
                            }
                        }
                        else if (item.ProfileType == "linkedin")
                        {
                            LinkedInAccount linkedaccount = linkedaccrepo.getUserInformation(user.Id, item.ProfileId);
                            string          profileimgurl = string.Empty;
                            if (linkedaccount != null)
                            {
                                if (linkedaccount.ProfileUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = linkedaccount.ProfileImageUrl;
                                }
                                bindprofiles += "<div id=\"linkedin_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" alt=\"\" src=\"" + profileimgurl + "\" ><i>" +
                                                "<img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/link_icon.png\"></i></span>" +
                                                "<div class=\"fourfifth\"><div class=\"location-container\">" + linkedaccount.LinkedinUserName + "</div>" +
                                                "<span onclick=\"AddProfileInInviteTeamMember('" + linkedaccount.LinkedinUserId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }

                        else if (item.ProfileType == "tumblr")
                        {
                            TumblrAccount tumblraccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId, user.Id);
                            string        profileimgurl = string.Empty;
                            if (tumblraccount != null)
                            {
                                if (tumblraccount.tblrProfilePicUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = "http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar";
                                }
                                bindprofiles += "<div id=\"tumblr_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" alt=\"\" src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" ><i>" +
                                                "<img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/tumblr.png\"></i></span>" +
                                                "<div class=\"fourfifth\"><div class=\"location-container\">" + tumblraccount.tblrUserName + "</div>" +
                                                "<span onclick=\"AddProfileInInviteTeamMember('" + tumblraccount.tblrUserName + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }



                        else if (item.ProfileType == "instagram")
                        {
                            string profileimgurl = string.Empty;

                            InstagramAccount instaaccount = instagramrepo.getInstagramAccountDetailsById(item.ProfileId, user.Id);
                            if (instaaccount != null)
                            {
                                if (instaaccount.ProfileUrl == string.Empty)
                                {
                                    profileimgurl = "../../Contents/img/blank_img.png";
                                }
                                else
                                {
                                    profileimgurl = instaaccount.ProfileUrl;
                                }

                                bindprofiles += "<div id=\"instagram_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"><i>" +
                                                "<img width=\"16\" height=\"16\" alt=\"\" src=\"../Contents/img/instagram_24X24.png\"></i></span><div class=\"fourfifth\"><div class=\"location-container\">" + instaaccount.InsUserName + "</div>" +
                                                "<span onclick=\"AddProfileInInviteTeamMember('" + instaaccount.InstagramId + "','" + groupid + "','" + item.ProfileType + "')\" class=\"add remove\">+</span><span onclick=\"RemoveProfileFromGroup('" + item.ProfileId + "')\" class=\"add remove\">✖</span></div></div>";
                            }
                        }
                    }
                    Response.Write(bindprofiles);
                }
                else if (Request.QueryString["op"] == "deleteGroupName")
                {
                    Guid groupid = Guid.Parse(Request.QueryString["groupId"]);

                    GroupRepository grouprepo = new GroupRepository();
                    grouprepo.DeleteGroup(groupid);
                    int count = groupprofilerepo.DeleteAllGroupProfile(groupid);
                    int cnt   = objbsnsrepo.DeleteBusinessSettingByUserid(groupid);

                    List <Team> objTeamId = objTeamRepository.getAllDetailsUserEmail(groupid);
                    foreach (Team item in objTeamId)
                    {
                        int deteleTeamMember = objTeamMemberProfileRepository.deleteTeamMember(item.Id);
                    }
                    int deleteTeam = objTeamRepository.deleteGroupRelatedTeam(groupid);
                }
                else if (Request.QueryString["op"] == "addProfilestoGroup")
                {
                    string       network      = Request.QueryString["network"];
                    string       id           = Request.QueryString["profileid"];
                    Guid         groupid      = (Guid)Session["GroupId"];
                    GroupProfile groupprofile = new GroupProfile();
                    groupprofile.EntryDate    = DateTime.Now;
                    groupprofile.GroupId      = groupid;
                    groupprofile.Id           = Guid.NewGuid();
                    groupprofile.ProfileId    = id;
                    groupprofile.ProfileType  = network;
                    groupprofile.GroupOwnerId = user.Id;

                    GroupProfileRepository grouprepo = new GroupProfileRepository();

                    if (!grouprepo.checkGroupProfileExists(user.Id, groupid, id))
                    {
                        grouprepo.AddGroupProfile(groupprofile);
                    }

                    Response.Write(groupid);
                }
                else if (Request.QueryString["op"] == "deleteGroupProfiles")
                {
                    Guid groupid = (Guid)Session["GroupId"];
                    try
                    {
                        string profileid = Request.QueryString["profileid"];
                        GroupProfileRepository grouprepo = new GroupProfileRepository();
                        grouprepo.DeleteGroupProfile(user.Id, profileid, groupid);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    Response.Write(groupid);
                }

                if (Request.QueryString["op"] == "GetInviteMember")
                {
                    string bindprofiles  = string.Empty;
                    string profileimgurl = string.Empty;

                    try
                    {
                        string gp      = Request.QueryString["groupId"];
                        Guid   GroupId = Guid.Parse(gp);
                        // TeamRepository objTeamRepository = new TeamRepository();
                        List <Team> objTeam = objTeamRepository.getAllDetailsUserEmail(GroupId);

                        if (objTeam.Count != 0)
                        {
                            foreach (Team item in objTeam)
                            {
                                UserRepository objUserRepository = new UserRepository();
                                User           ObjUserDetails    = objUserRepository.getUserInfoByEmail(item.EmailId);
                                if (ObjUserDetails != null)
                                {
                                    if (string.IsNullOrEmpty(ObjUserDetails.ProfileUrl))
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = ObjUserDetails.ProfileUrl;
                                    }

                                    bindprofiles += "<div style=\"float:left; margin-right:18%\"id=\"" + item.Id + "\">" +
                                                    "<div style=\"float:left\"><span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></span>" +
                                                    "</div><div style=\"float:left\" class=\"fourfifth\"><div style=\"font-size:small \">" + ObjUserDetails.UserName + "</div> </div><div style=\"float:left;margin-left:3px\" onclick=\"ShowInviteMemberProfileDetails('" + GroupId + "','" + ObjUserDetails.EmailId + "','" + user.Id + "')\"><input class=\"abc\" type=\"radio\" name=\"sex\" value=" + item.Id + "></div>" +
                                                    "<span onclick=\"RemoveInviteMemberFromGroup('" + item.Id + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";

                                    //bindprofiles += "<div id=\"" + item.Id + "\" class=\"ws_conct active\"> <span class=\"img\"><img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"><i><img width=\"16\" height=\"16\" src=\"../Contents/img/twticon.png\" alt=\"\"></i></span><div class=\"fourfifth\">" +
                                    //  "<div class=\"location-container\">" + ObjUserDetails.UserName + "</div><span class=\"add remove\" onclick=\"ShowInviteMemberProfileDetails('" + GroupId + "','" + ObjUserDetails.EmailId + "','" + user.Id + "')\"><input class=\"abc\" type=\"radio\" name=\"sex\" value=" + item.Id + "></span><span onclick=\"RemoveInviteMemberFromGroup('" + item.Id + "')\"  class=\"add remove\">✖</span></div></div>";
                                }
                            }
                        }

                        Response.Write(bindprofiles);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

                if (Request.QueryString["op"] == "RemoveInviteMemberFromGroup")
                {
                    if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
                    {
                        try
                        {
                            string ide            = Request.QueryString["Id"];
                            Guid   id             = Guid.Parse(ide);
                            int    deleteTeam     = objTeamRepository.deleteinviteteamMember(id);
                            int    deleteProfiles = objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamId(id);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                    }
                }

                //modified by hozefa 4-7-2014
                if (Request.QueryString["op"] == "ShowInviteMemberProfileDetails")
                {
                    string bindprofiles = string.Empty;
                    string gpId         = Request.QueryString["groupId"];
                    Guid   gpid         = Guid.Parse(gpId);
                    string emailId      = Request.QueryString["emailid"];
                    string userId       = Request.QueryString["userid"];

                    Team teamdata = objTeamRepository.getAllDetails(gpid, emailId);

                    List <TeamMemberProfile> objTeamMemProfile = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(teamdata.Id);
                    try
                    {
                        foreach (TeamMemberProfile item in objTeamMemProfile)
                        {
                            if (item.ProfileType == "facebook")
                            {
                                FacebookAccount account = fbaccountrepo.getFacebookAccountDetailsById(item.ProfileId);
                                if (account != null)
                                {
                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px;margin-top:6px\"  id=\"facebook_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/fb_icon.png\" alt=\"\"></img></i>" +
                                                    "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + account.FbUserName + "</div></div>" +
                                                    "<span  onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }
                            else if (item.ProfileType == "twitter")
                            {
                                TwitterAccount twtaccount    = twtaccountrepo.getUserInformation(item.ProfileId);
                                string         profileimgurl = string.Empty;
                                if (twtaccount != null)
                                {
                                    if (twtaccount.ProfileImageUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = twtaccount.ProfileImageUrl;
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left; width:170px;margin-top:6px\"   id=\"twitter_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/twticon.png\" alt=\"\"></img></i>" +
                                                    "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + twtaccount.TwitterScreenName + "</div></div>" +
                                                    "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }

                            else if (item.ProfileType == "linkedin")
                            {
                                LinkedInAccount linkedaccount = linkedaccrepo.getUserInformation(item.ProfileId);
                                string          profileimgurl = string.Empty;
                                if (linkedaccount != null)
                                {
                                    if (linkedaccount.ProfileUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = linkedaccount.ProfileImageUrl;
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px;margin-top:6px\"   id=\"linkedin_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/link_icon.png\" alt=\"\"></img></i>" +
                                                    "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + linkedaccount.LinkedinUserName + "</div></div>" +
                                                    "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }

                            else if (item.ProfileType == "instagram")
                            {
                                string profileimgurl = string.Empty;

                                InstagramAccount instaaccount = instagramrepo.getInstagramAccountDetailsById(item.ProfileId);
                                if (instaaccount != null)
                                {
                                    if (instaaccount.ProfileUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = instaaccount.ProfileUrl;
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px; margin-top:6px\"   id=\"instagram_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\"></img></i>" +
                                                    "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + instaaccount.InsUserName + "</div></div>" +
                                                    "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }



                            else if (item.ProfileType == "tumblr")
                            {
                                string profileimgurl = string.Empty;

                                TumblrAccount tumblraccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId);
                                if (tumblraccount != null)
                                {
                                    if (tumblraccount.tblrProfilePicUrl == string.Empty)
                                    {
                                        profileimgurl = "../../Contents/img/blank_img.png";
                                    }
                                    else
                                    {
                                        profileimgurl = "http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar";
                                    }

                                    bindprofiles += "<div id=\"item\" style=\"float:left;width:170px; margin-top:6px\"   id=\"tumblr_" + item.ProfileId + "\"><div style=\"float:left\"<span class=\"img\">" +
                                                    "<img width=\"48\" height=\"48\" src=\"" + profileimgurl + "\" alt=\"\"></img><i><img style=\"margin-left:-18px\" width=\"16\" height=\"16\" src=\"../Contents/img/tumblr.png\" alt=\"\"></img></i>" +
                                                    "</span></div><div style=\"float:left\"><div style=\"font-size:small\">" + tumblraccount.tblrUserName + "</div></div>" +
                                                    "<span onclick=\"RemoveInviteMemberProfileFromTeamMember('" + teamdata.Id + "','" + item.ProfileId + "','" + gpId + "','" + emailId + "','" + userId + "')\" style=\"margin-left:25px;font-size:small;cursor:pointer;position: absolute; margin-top: 28px;margin-left:10px\">x</span></div>";
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }

                    Response.Write(bindprofiles);
                }


                if (Request.QueryString["op"] == "RemoveInviteMemberProfileFromTeamMember")
                {
                    string profileId = Request.QueryString["ProfileId"];
                    Guid   teamid    = Guid.Parse(Request.QueryString["TeamId"]);
                    try
                    {
                        int deleteTeamMembeProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByTeamIdProfileId(profileId, teamid);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }

                if (Request.QueryString["op"] == "AddProfileInInviteTeamMember")
                {
                    try
                    {
                        string            EmailId = string.Empty;
                        string            Result  = string.Empty;
                        TeamMemberProfile objteam = new TeamMemberProfile();
                        objteam.ProfileId   = Request.QueryString["Profileid"];
                        objteam.ProfileType = Request.QueryString["Profiletype"];
                        string GrpId = Request.QueryString["Groupid"];
                        Guid   grpid = Guid.Parse(GrpId);

                        TeamRepository objTeamrepo = new TeamRepository();
                        Team           team        = new Team();
                        Guid           id          = Guid.NewGuid();
                        objteam.Id = id;
                        string teamid = Request.QueryString["Teamid"];
                        objteam.TeamId           = Guid.Parse(teamid);
                        objteam.StatusUpdateDate = DateTime.Now;
                        objteam.Status           = 0;
                        team    = objTeamrepo.getAllDetailsByTeamID(objteam.TeamId, grpid);
                        EmailId = team.EmailId;
                        try
                        {
                            if (!objTeamMemberProfileRepository.checkTeamMemberProfile(objteam.TeamId, objteam.ProfileId))
                            {
                                objTeamMemberProfileRepository.addNewTeamMember(objteam);
                                Result = "Success";
                            }
                            else
                            {
                                //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Profile Already Added.');", true);
                                Result = "Fail";
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        Response.Write(Result + "_" + EmailId);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                }
            }
        }
예제 #14
0
        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));
        }
        public string GetSociaoQueueMessageByUserIdAndGroupIdBetweenDates(string UserId, string GroupId, string StartDate, string EndDate)
        {
            string profileid = string.Empty;
            DateTime stDate = DateTime.Parse(StartDate);
            DateTime endDate = DateTime.Parse(EndDate);
           // TeamRepository objTeamRepository = new TeamRepository();
            try
            {
                Guid userid = Guid.Parse(UserId);
                Guid groupid = Guid.Parse(GroupId);
                List<Domain.Socioboard.Domain.ScheduledMessage> lstfianlscoailqueue = new List<Domain.Socioboard.Domain.ScheduledMessage>();


                //Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(groupid);
                //List<Domain.Socioboard.Domain.TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(objTeam.Id);
                GroupProfileRepository grpProfileRepo = new GroupProfileRepository();
                List<Domain.Socioboard.Domain.GroupProfile> allprofiles = new List<Domain.Socioboard.Domain.GroupProfile>();
                allprofiles = grpProfileRepo.GetAllGroupProfiles(groupid);
                

                ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository();
                List<Domain.Socioboard.Domain.ScheduledMessage> lstScheduledMessages = new List<Domain.Socioboard.Domain.ScheduledMessage>();
                Dictionary<string, List<Domain.Socioboard.Domain.ScheduledMessage>> objdic = new Dictionary<string, List<Domain.Socioboard.Domain.ScheduledMessage>>();
                foreach (var item in allprofiles)
                {
                    lstScheduledMessages = objScheduledMessageRepository.getAllMessagesDetailsByDate(item.ProfileId, userid,stDate,endDate);
                    if (lstScheduledMessages.Count > 0)
                    {
                        objdic.Add(item.ProfileId, lstScheduledMessages);
                    }

                }
                foreach (var item in objdic)
                {
                    foreach (var ScheduledMessage in item.Value)
                    {
                        lstfianlscoailqueue.Add(ScheduledMessage);
                    }
                }
                //FacebookAccountRepository facebookAccountRepo = new FacebookAccountRepository();
                // FacebookAccount facebook = facebookAccountRepo.getFacebookAccountDetailsById(FacebookId, userid);
                return new JavaScriptSerializer().Serialize(lstfianlscoailqueue);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                Console.WriteLine(ex.StackTrace);
                return new JavaScriptSerializer().Serialize("Please try Again");
            }

        }