예제 #1
0
        public static bool AddInstagramAccount(InstagramAccount instagramAccount)
        {
            int res = 0;

            using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
            {
                res = cnn.Execute("insert into InstagramAccount(EmailPhone, Password, FollowedPersonLinkString, LikedPersonLinkString, UserId) " +
                                  "values (@EmailPhone, @Password, @FollowedPersonLinkString, @LikedPersonLinkString, @UserId)", instagramAccount);
            }
            if (res == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        public async Task <ActionResult> AddAccountPostAsync(InstagramAccount account)
        {
            if (CurrentUser.Points - account.Points < 0)
            {
                ModelState.AddModelError("Points", "You do not have enough points, Please earn points");
            }
            if (ModelState.IsValid)
            {
                account.ApplicationUser = CurrentUser;
                context.InstagramAccounts.Add(account);

                await context.SaveChangesAsync();

                return(RedirectToAction("Accounts"));
            }
            ViewBag.Link = account.Link;
            return(View(account));
        }
예제 #3
0
        public void StartLike(string tag, int count, InstagramAccount account)
        {
            var instagram = new InstagramControl();

            instagram.Login(account.AccountName, account.InstagramPass, false);

            Thread.Sleep(2000);

            instagram.TagPostsFind(tag);
            postUrls = new string[count];

            Thread.Sleep(1000);

            for (int i = 0; i < count; i++)
            {
                var res = instagram.GetPostUrl();
                if (i != 0)
                {
                    if (postUrls[i - 1] != res)
                    {
                        postUrls[i] = res;
                    }
                    else
                    {
                        i--;
                    }
                }
                else
                {
                    postUrls[i] = res;
                }
            }
            //instagram.ReturnHome();
            instagram.ReturnHome();

            Thread.Sleep(2000);
            foreach (var item in postUrls)
            {
                instagram.LikePost(item);
            }

            //instagram.ReturnHome();
            instagram.Logout();
        }
예제 #4
0
        public async Task SetInstagramAccounts(Page page)
        {
            var response = await _facebookClient.GetAsync <dynamic>(page.AccessToken, $"{page.Id}/instagram_accounts");

            if (response == null || response.data == null)
            {
                throw new Exception("Page not found. ");
            }

            var instagramAccounts = new List <InstagramAccount>();

            foreach (var instagramAccountDynamic in response.data)
            {
                InstagramAccount instagramAccount = _modelMapper.GetInstagramAccount(instagramAccountDynamic);
                instagramAccounts.Add(instagramAccount);
            }

            page.InstagramAccounts = instagramAccounts;
        }
예제 #5
0
        public Home PerformLogin(string emailOrPhone)
        {
            InstagramAccount instaAccount = null;

            try
            {
                instaAccount  = SQLiteDatabaseAccess.GetInstagramAccount(emailOrPhone);
                LoggedAccount = emailOrPhone;
            }
            catch (Exception ex) { }

            if (instaAccount != null)
            {
                try
                {
                    IWebElement cookiesAccept = DriverExtensions.FindElement(InstaDriver, By.XPath("//*[contains(@class,'aOOlW  bIiDR  ')]"), 20);
                    cookiesAccept.Click();

                    IWebElement loginEmail = InstaDriver.FindElementByXPath("//*[contains(@aria-label,'Phone number, username, or email')]");
                    loginEmail.SendKeys(emailOrPhone);

                    IWebElement loginPassword = InstaDriver.FindElementByXPath("//*[contains(@aria-label,'Password')]");
                    loginPassword.SendKeys(instaAccount.Password);

                    IWebElement loginButton = InstaDriver.FindElementByXPath("//*[contains(@type,'submit')]");
                    loginButton.Click();

                    if (CheckIsLoggedIn())
                    {
                        PassLoginPopUps();
                        LogHelper.Log("Succesfully logged in");

                        return(new Home(InstaDriver));
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.Log($"Some error occured trying to login..., {ex.GetType()}");
                }
            }

            return(null);
        }
예제 #6
0
        public InstagramAccount Parse(string username)
        {
            InstagramAccount instagramAccount = new InstagramAccount();

            Browser.Navigate().GoToUrl(String.Format("https://www.instagram.com/{0}", username));

            WebDriverWait ww = new WebDriverWait(Browser, TimeSpan.FromSeconds(10));

            instagramAccount.MainPhoto = ww.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("._6q-tv"))).GetAttribute("src");

            ww.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".g47SY.lOXF2")));
            List <IWebElement> webElements = Browser.FindElements(By.CssSelector(".g47SY.lOXF2")).ToList();

            instagramAccount.CountPosts     = webElements[0].Text;
            instagramAccount.CountReaders   = webElements[1].Text;
            instagramAccount.CountFollowers = webElements[2].Text;

            instagramAccount.Username = username;

            return(instagramAccount);
        }
예제 #7
0
 public InstagramAccount getInstagramAccountDetailsById(string Insuserid)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, start Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action to get Instagram Account Details.
             List <InstagramAccount> objlst = session.CreateQuery("from InstagramAccount where  InstagramId = :InstagramId ")
                                              .SetParameter("InstagramId", Insuserid)
                                              .List <InstagramAccount>().ToList <InstagramAccount>();
             InstagramAccount result = new InstagramAccount();
             if (objlst.Count > 0)
             {
                 result = objlst[0];
             }
             return(result);
         } //End Transaction
     }     //End session
 }
예제 #8
0
        private void AddFollower(string[] namesArray, InstagramAccount account)
        {
            var instagram = new InstagramControl();

            instagram.RunInstagram();
            instagram.Login(account.AccountName, account.InstagramPass, firstUse);
            Thread.Sleep(1000);
            foreach (var name in namesArray)
            {
                instagram.UserNavigate(name);
                Thread.Sleep(1000);
                instagram.FollowTap();
                Thread.Sleep(500);
            }
            instagram.Logout();
            //BrowserControl browser = new BrowserControl();
            //browser.LoginInstagram(account.AccountName, account.InstagramPass);
            //browser.OpenPage(name);
            //Thread.Sleep(2000);
            //browser.FollowTap();
            //Thread.Sleep(1000);
            //browser.ExitAccount();
        }
예제 #9
0
        public void ProfilesAvailabeforuser(Guid UserId)
        {
            string bindprofiles = string.Empty;

            SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
            List <SocialProfile>     lstsocialprofile = socioprofilerepo.getAllSocialProfilesOfUser(UserId);

            foreach (SocialProfile item in lstsocialprofile)
            {
                if (item.ProfileType == "facebook")
                {
                    if (!SelectedGroupProfiles.InnerHtml.Contains("facebook_" + item.ProfileId))
                    {
                        FacebookAccountRepository fbaccreop       = new FacebookAccountRepository();
                        FacebookAccount           facebookaccount = fbaccreop.getFacebookAccountDetailsById(item.ProfileId, UserId);

                        bindprofiles +=
                            "<div onclick=\"transfertoGroup('facebook','" + item.ProfileId + "')\" id=\"usergroups_" + item.ProfileId + "\" class=\"ws_conct active\"> <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\">" + facebookaccount.FbUserName + "</div><span class=\"add remove\">✖</span></div></div>";
                    }
                }
                else if (item.ProfileType == "twitter")
                {
                    if (!SelectedGroupProfiles.InnerHtml.Contains("twitter_" + item.ProfileId))
                    {
                        string profileimgurl = string.Empty;
                        TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository();
                        TwitterAccount           twtacco        = twtaccountrepo.getUserInformation(UserId, item.ProfileId);
                        if (twtacco.ProfileImageUrl == string.Empty)
                        {
                            profileimgurl = "../../Contents/img/blank_img.png";
                        }
                        else
                        {
                            profileimgurl = twtacco.ProfileImageUrl;
                        }
                        bindprofiles +=
                            "<div onclick=\"transfertoGroup('twitter','" + item.ProfileId + "')\" id=\"usergroups_" + 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\">" + twtacco.TwitterScreenName + "</div><span class=\"add remove\">✖</span></div></div>";
                    }
                }
                else if (item.ProfileType == "linkedin")
                {
                    if (!SelectedGroupProfiles.InnerHtml.Contains("linkedin_" + item.ProfileId))
                    {
                        LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository();
                        LinkedInAccount           linkedaccount = linkedaccrepo.getUserInformation(UserId, item.ProfileId);
                        string profileimgurl = string.Empty;
                        if (linkedaccount.ProfileUrl == string.Empty)
                        {
                            profileimgurl = "../../Contents/img/blank_img.png";
                        }
                        else
                        {
                            profileimgurl = linkedaccount.ProfileImageUrl;
                        }
                        bindprofiles += "<div onclick=\"transfertoGroup('linkedin','" + item.ProfileId + "')\" id=\"usergroups_" + 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 class=\"add remove\">✖</span></div></div>";
                    }
                }
                else if (item.ProfileType == "instagram")
                {
                    if (!SelectedGroupProfiles.InnerHtml.Contains("instagram_" + item.ProfileId))
                    {
                        string profileimgurl = string.Empty;
                        InstagramAccountRepository instagramrepo = new InstagramAccountRepository();
                        InstagramAccount           instaaccount  = instagramrepo.getInstagramAccountDetailsById(item.ProfileId, UserId);
                        if (instaaccount.ProfileUrl == string.Empty)
                        {
                            profileimgurl = "../../Contents/img/blank_img.png";
                        }
                        else
                        {
                            profileimgurl = instaaccount.ProfileUrl;
                        }

                        bindprofiles += "<div onclick=\"transfertoGroup('instagram','" + item.ProfileId + "')\" id=\"usergroups_" + 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 class=\"add remove\">✖</span></div></div>";
                    }
                }
                else if (item.ProfileType == "tumblr")
                {
                    if (!SelectedGroupProfiles.InnerHtml.Contains("tumblr_" + item.ProfileId))
                    {
                        string profileimgurl = string.Empty;
                        TumblrAccountRepository tumblrrepo    = new TumblrAccountRepository();
                        TumblrAccount           tumblraccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId, UserId);
                        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 onclick=\"transfertoGroup('tumblr','" + item.ProfileId + "')\" id=\"usergroups_" + item.ProfileId + "\" class=\"ws_conct active\"><span class=\"img\"><img width=\"48\" height=\"48\" src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" alt=\"\"><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 class=\"add remove\">✖</span></div></div>";
                    }
                }
            }
            AllGroupProfiles.InnerHtml = bindprofiles;
        }
        public ScrapeUsersByMinFolMaxFol(InstagramAccount accInUse)
        {
            InitializeComponent();

            _accountInUse = accInUse;
        }
예제 #11
0
 public string ProfilesConnected(string UserId)
 {
     try
     {
         Guid userid = Guid.Parse(UserId);
         SocialProfilesRepository socialRepo      = new SocialProfilesRepository();
         List <SocialProfile>     lstsocioprofile = socialRepo.getAllSocialProfilesOfUser(userid);
         List <profileConnected>  lstProfile      = new List <profileConnected>();
         foreach (SocialProfile sp in lstsocioprofile)
         {
             profileConnected pc = new profileConnected();
             pc.Id            = sp.Id;
             pc.ProfileDate   = sp.ProfileDate;
             pc.ProfileId     = sp.ProfileId;
             pc.ProfileStatus = sp.ProfileStatus;
             pc.ProfileType   = sp.ProfileType;
             pc.UserId        = sp.UserId;
             if (sp.ProfileType == "facebook")
             {
                 try
                 {
                     FacebookAccountRepository objFbAccRepo = new FacebookAccountRepository();
                     FacebookAccount           objFbAcc     = objFbAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objFbAcc.FbUserName;
                     pc.ProfileImgUrl = "http://graph.facebook.com/" + sp.ProfileId + "/picture?type=small";
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "twitter")
             {
                 try
                 {
                     TwitterAccountRepository objTwtAccRepo = new TwitterAccountRepository();
                     TwitterAccount           objTwtAcc     = objTwtAccRepo.getUserInfo(sp.ProfileId);
                     pc.ProfileName   = objTwtAcc.TwitterScreenName;
                     pc.ProfileImgUrl = objTwtAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "instagram")
             {
                 try
                 {
                     InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository();
                     InstagramAccount           objInsAcc     = objInsAccRepo.getInstagramAccountById(sp.ProfileId);
                     pc.ProfileName   = objInsAcc.InsUserName;
                     pc.ProfileImgUrl = objInsAcc.ProfileUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "linkedin")
             {
                 try
                 {
                     LinkedInAccountRepository objLiAccRepo = new LinkedInAccountRepository();
                     LinkedInAccount           objLiAcc     = objLiAccRepo.getLinkedinAccountDetailsById(sp.ProfileId);
                     pc.ProfileName   = objLiAcc.LinkedinUserName;
                     pc.ProfileImgUrl = objLiAcc.ProfileImageUrl;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             else if (sp.ProfileType == "googleplus")
             {
                 try
                 {
                     GooglePlusAccountRepository objGpAccRepo = new GooglePlusAccountRepository();
                     GooglePlusAccount           objGpAcc     = objGpAccRepo.getUserDetails(sp.ProfileId);
                     pc.ProfileName   = objGpAcc.GpUserName;
                     pc.ProfileImgUrl = objGpAcc.GpProfileImage;
                 }
                 catch (Exception ex)
                 {
                     Console.WriteLine(ex.StackTrace);
                 }
             }
             lstProfile.Add(pc);
         }
         return(new JavaScriptSerializer().Serialize(lstProfile));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(new JavaScriptSerializer().Serialize("Please Try Again"));
     }
 }
예제 #12
0
        public static Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > > GetUserProfilesSnapsAccordingToGroup(List <Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile)
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > > dic_profilessnap = new Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > >();
            var dicprofilefeeds = new Dictionary <object, List <object> >();

            foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile)
            {
                List <object> feeds = null;
                if (item.ProfileType == "facebook")
                {
                    feeds = new List <object>();
                    Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                    FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount)));
                    Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed();
                    List <FacebookFeed>           lstFacebookFeed    = (List <FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <FacebookFeed>)));
                    foreach (var facebookfeed in lstFacebookFeed)
                    {
                        feeds.Add(facebookfeed);
                    }
                    dicprofilefeeds.Add(objFacebookAccount, feeds);
                    dic_profilessnap.Add(item, dicprofilefeeds);
                }

                if (item.ProfileType == "twitter")
                {
                    feeds = new List <object>();
                    Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                    TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount)));
                    Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed();
                    List <TwitterFeed>          lstTwitterFeed    = (List <TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <TwitterFeed>)));
                    foreach (var twitterfeed in lstTwitterFeed)
                    {
                        feeds.Add(twitterfeed);
                    }
                    dicprofilefeeds.Add(objTwitterAccount, feeds);
                    dic_profilessnap.Add(item, dicprofilefeeds);
                }

                if (item.ProfileType == "linkedin")
                {
                    feeds = new List <object>();
                    Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                    LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount)));
                    Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed();
                    List <LinkedInFeed>           lstLinkedInFeed    = (List <LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <LinkedInFeed>)));
                    foreach (var LinkedInFeed in lstLinkedInFeed)
                    {
                        feeds.Add(LinkedInFeed);
                    }
                    dicprofilefeeds.Add(objLinkedInAccount, feeds);
                    dic_profilessnap.Add(item, dicprofilefeeds);
                }
                if (item.ProfileType == "instagram")
                {
                    feeds = new List <object>();
                    Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                    InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount)));
                    dicprofilefeeds.Add(objInstagramAccount, feeds);
                    dic_profilessnap.Add(item, dicprofilefeeds);
                }

                if (item.ProfileType == "tumblr")
                {
                    feeds = new List <object>();
                    Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                    TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount)));
                    dicprofilefeeds.Add(objTumblrAccount, feeds);
                    dic_profilessnap.Add(item, dicprofilefeeds);
                }


                if (item.ProfileType == "youtube")
                {
                    feeds = new List <object>();
                    Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                    YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount)));
                    Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel();
                    YoutubeChannel        objYoutubeChannel = (YoutubeChannel)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeChannel)));
                    List <YoutubeChannel> lstYoutubeChannel = new List <YoutubeChannel>();
                    lstYoutubeChannel.Add(objYoutubeChannel);
                    foreach (var youtubechannel in lstYoutubeChannel)
                    {
                        feeds.Add(youtubechannel);
                    }
                    dicprofilefeeds.Add(objYoutubeAccount, feeds);
                    dic_profilessnap.Add(item, dicprofilefeeds);
                }
            }
            return(dic_profilessnap);
        }
예제 #13
0
        private static async Task <ISocialSiteAccount> GetSocialAccountFromGroupProfile(Guid objUserid, Domain.Socioboard.Domain.GroupProfile objGroupProfile)
        {
            ISocialSiteAccount objSocialSiteAccount = null;
            string             accesstoken          = string.Empty;

            try {
                accesstoken = System.Web.HttpContext.Current.Session["access_token"].ToString();
            }
            catch { }

            if (objGroupProfile.ProfileType == "facebook" || objGroupProfile.ProfileType == "facebook_page")
            {
                //using (Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount())
                //{
                //    ApiobjFacebookAccount.Timeout = 300000;
                //    objSocialSiteAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(FacebookAccount)));
                //}
                FacebookAccount     fbaccount  = new FacebookAccount();
                HttpResponseMessage fbresponse = await WebApiReq.GetReq("api/ApiFacebookAccount/GetFacebookAcoount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (fbresponse.IsSuccessStatusCode)
                {
                    fbaccount = await fbresponse.Content.ReadAsAsync <Domain.Socioboard.Domain.FacebookAccount>();

                    objSocialSiteAccount = fbaccount;
                }
            }
            else if (objGroupProfile.ProfileType == "twitter")
            {
                //using (Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount())
                //{

                //    ApiobjTwitterAccount.Timeout = 300000;
                //    objSocialSiteAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(TwitterAccount)));

                //}
                TwitterAccount      twitterAcc      = new TwitterAccount();
                HttpResponseMessage twitterresponse = await WebApiReq.GetReq("api/ApiTwitterAccount/GetTwitterAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (twitterresponse.IsSuccessStatusCode)
                {
                    twitterAcc = await twitterresponse.Content.ReadAsAsync <Domain.Socioboard.Domain.TwitterAccount>();

                    objSocialSiteAccount = twitterAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "linkedin")
            {
                //using (Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount())
                //{

                //    ApiobjLinkedinAccount.Timeout = 300000;
                //    objSocialSiteAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(LinkedInAccount)));

                //}
                LinkedInAccount     LinkedinAcc      = new LinkedInAccount();
                HttpResponseMessage Linkedinresponse = await WebApiReq.GetReq("api/ApiLinkedinAccount/GetLinkedinAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (Linkedinresponse.IsSuccessStatusCode)
                {
                    LinkedinAcc = await Linkedinresponse.Content.ReadAsAsync <Domain.Socioboard.Domain.LinkedInAccount>();

                    objSocialSiteAccount = LinkedinAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "instagram")
            {
                //using (Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount())
                //{
                //    objSocialSiteAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(InstagramAccount)));

                //}
                InstagramAccount    instAcc  = new InstagramAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiInstagramAccount/GetInstagramAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (response.IsSuccessStatusCode)
                {
                    instAcc = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.InstagramAccount>();

                    objSocialSiteAccount = instAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "youtube")
            {
                //using (Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount())
                //{

                //    ApiobjYoutubeAccount.Timeout = 300000;
                //    objSocialSiteAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(YoutubeAccount)));

                //}

                YoutubeAccount      ytAcc    = new YoutubeAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiYoutubeAccount/GetYoutubeAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (response.IsSuccessStatusCode)
                {
                    ytAcc = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.YoutubeAccount>();

                    objSocialSiteAccount = ytAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "tumblr")
            {
                //using (Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount())
                //{

                //    ApiobjTumblrAccount.Timeout = 300000;
                //    objSocialSiteAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(TumblrAccount)));

                //}
                TumblrAccount       ytAcc    = new TumblrAccount();
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiTumblrAccount/GetTumblrAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (response.IsSuccessStatusCode)
                {
                    ytAcc = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.TumblrAccount>();

                    objSocialSiteAccount = ytAcc;
                }
            }
            else if (objGroupProfile.ProfileType == "linkedincompanypage")
            {
                //using (Api.LinkedinCompanyPage.LinkedinCompanyPage objLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage())
                //{

                //    objLinkedinCompanyPage.Timeout = 300000;
                //    objSocialSiteAccount = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(objLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUserid.ToString(), objGroupProfile.ProfileId.ToString()), typeof(LinkedinCompanyPage)));
                //}

                LinkedinCompanyPage licompanypage = new LinkedinCompanyPage();
                HttpResponseMessage response      = await WebApiReq.GetReq("api/ApiLinkedinCompanyPage/GetLinkedinCompanyPageDetailsByUserIdAndPageId?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (response.IsSuccessStatusCode)
                {
                    licompanypage = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.LinkedinCompanyPage>();

                    objSocialSiteAccount = licompanypage;
                }
            }
            else if (objGroupProfile.ProfileType == "gplus")
            {
                //using (Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount())
                //{

                //    ApiobjGooglePlusAccount.Timeout = 300000;
                //    objSocialSiteAccount = (GooglePlusAccount)(new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId), typeof(GooglePlusAccount)));

                //}
                GooglePlusAccount   googlePlusAccount = new GooglePlusAccount();
                HttpResponseMessage response          = await WebApiReq.GetReq("api/ApiGooglePlusAccount/GetGooglePlusAccount?ProfileId=" + objGroupProfile.ProfileId, "Bearer", accesstoken);

                if (response.IsSuccessStatusCode)
                {
                    googlePlusAccount = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.GooglePlusAccount>();

                    objSocialSiteAccount = googlePlusAccount;
                }
            }
            else if (objGroupProfile.ProfileType == "googleanalytics")
            {
                //using (Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiobjGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount())
                //{

                //    ApiobjGoogleAnalyticsAccount.Timeout = 300000;
                //    objSocialSiteAccount = (GoogleAnalyticsAccount)(new JavaScriptSerializer().Deserialize(ApiobjGoogleAnalyticsAccount.GetGooglePlusAccountDetailsById(objUserid.ToString(), objGroupProfile.ProfileId), typeof(GoogleAnalyticsAccount)));

                //}
                GoogleAnalyticsAccount googlePlusAccount = new GoogleAnalyticsAccount();
                HttpResponseMessage    response          = await WebApiReq.GetReq("api/ApiGoogleAnalyticsAccount/GetGooglePlusAccountDetailsById?ProfileId=" + objGroupProfile.ProfileId + "&UserId=" + objUserid.ToString(), "Bearer", accesstoken);

                if (response.IsSuccessStatusCode)
                {
                    googlePlusAccount = await response.Content.ReadAsAsync <Domain.Socioboard.Domain.GoogleAnalyticsAccount>();

                    objSocialSiteAccount = googlePlusAccount;
                }
            }


            return(objSocialSiteAccount);
        }
        public void getAccessToken()
        {
            GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["InstagramClientKey"].ToString(), ConfigurationManager.AppSettings["InstagramClientSec"].ToString(), ConfigurationManager.AppSettings["InstagramCallBackURL"].ToString(), "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", "");
            SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository();
            SocialProfile            socioprofile     = new SocialProfile();

            _api = oAuthInstagram.GetInstance(configi);
            AccessToken access = new AccessToken();
            string      code   = Request.QueryString["code"].ToString();

            SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"];
            access = _api.AuthGetAccessToken(code);

            UserController objusercontroller = new UserController();
            InstagramResponse <GlobusInstagramLib.App.Core.User> objuser = objusercontroller.GetUserDetails(access.user.id, access.access_token);

            InstagramAccount objInsAccount = new InstagramAccount();

            objInsAccount.AccessToken = access.access_token;
            //objInsAccount.FollowedBy=access.user.
            objInsAccount.InstagramId = access.user.id;
            objInsAccount.ProfileUrl  = access.user.profile_picture;
            objInsAccount.InsUserName = access.user.username;
            objInsAccount.TotalImages = objuser.data.counts.media;
            objInsAccount.FollowedBy  = objuser.data.counts.followed_by;
            objInsAccount.Followers   = objuser.data.counts.follows;
            objInsAccount.UserId      = user.Id;

            socioprofile.UserId        = user.Id;
            socioprofile.ProfileType   = "instagram";
            socioprofile.ProfileId     = access.user.id;
            socioprofile.ProfileStatus = 1;
            socioprofile.ProfileDate   = DateTime.Now;
            socioprofile.Id            = Guid.NewGuid();

            if (objInsRepo.checkInstagramUserExists(access.user.id, user.Id))
            {
                HttpContext.Current.Session["alreadyexist"] = objInsAccount;
                objInsRepo.updateInstagramUser(objInsAccount);
                if (!socioprofilerepo.checkUserProfileExist(socioprofile))
                {
                    socioprofilerepo.addNewProfileForUser(socioprofile);
                }
            }
            else
            {
                objInsRepo.addInstagramUser(objInsAccount);
                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        = socioprofile.ProfileId;
                        teammemberprofile.ProfileType      = "instagram";
                        teammemberprofile.StatusUpdateDate = DateTime.Now;

                        objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile);
                    }
                }
            }
            string messages = getIntagramImages(objInsAccount);


            Response.Write(messages);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool   status = false;
                string type   = Request.QueryString["type"].ToString();
                if (Session["updateData"] != null)
                {
                    if (type == "twt")
                    {
                        TwitterAccount twtAcc = (TwitterAccount)Session["updateData"];
                        //if (ddltatus.SelectedValue == "1")

                        status = true;
                        twtAcc.TwitterScreenName = txtName.Text;
                        twtAcc.IsActive          = status;
                        objTwtRepo.updateTwitterUser(twtAcc);
                    }
                    if (type == "fb")
                    {
                        FacebookAccount fbAcc = (FacebookAccount)Session["updateData"];
                        // if (ddltatus.SelectedValue == "1")
                        FBAcc.FbUserName = txtName.Text;
                        status           = true;
                        fbAcc.IsActive   = 1;
                        objFbRepo.updateFacebookUser(fbAcc);
                    }
                    if (type == "ins")
                    {
                        InstagramAccount insAcc = (InstagramAccount)Session["updateData"];
                        //if (ddltatus.SelectedValue == "1")
                        InsAcc.InsUserName = txtName.Text;
                        status             = true;
                        insAcc.IsActive    = status;
                        objInsRepo.updateInstagramUser(insAcc);
                    }
                    if (type == "li")
                    {
                        LinkedInAccount liAcc = (LinkedInAccount)Session["updateData"];
                        // if (ddltatus.SelectedValue == "1")
                        liAcc.LinkedinUserName = txtName.Text;
                        status         = true;
                        liAcc.IsActive = status;
                        objLiRepo.updateLinkedinUser(liAcc);
                    }
                    if (type == "gp")
                    {
                        GooglePlusAccount gpAcc = (GooglePlusAccount)Session["updateData"];
                        //  gpAcc.IsActive = int.Parse(ddltatus.SelectedValue);
                        GpAcc.GpUserName = txtName.Text;
                        gpAcc.IsActive   = 1;
                        objgpRepo.updateGooglePlusUser(gpAcc);
                    }
                }
            }
            catch (Exception Err)
            {
                logger.Error(Err.Message);
                Response.Write(Err.StackTrace);
            }
        }
예제 #16
0
        public void Initialize(Rendering rendering)
        {
            //Get current item
            var dataSource = rendering.DataSource;

            if (dataSource.IsNullOrEmpty())
            {
                dataSource = Sitecore.Configuration.Settings.GetSetting("FeedsDataSource", "{AF7BCA0A-4C7F-4ACA-9956-E4801143775A}");
            }

            CurrentItem = Sitecore.Context.Database.GetItem(dataSource);

            if (CurrentItem != null)
            {
                // Get all social feeds items
                var socialFeeds = CurrentItem.InnerItem.GetChildren().ToList();
                FacebookApi  = new FacebookApi();
                TwitterApi   = new TwitterApi();
                InstagramApi = new InstagramApi();
                YouTubeApi   = new YouTubeApi();
                PinterestApi = new PinterestApi();
                FlickrApi    = new FlickrApi();

                if (socialFeeds.Any())
                {
                    // Get facebook feed item and bind facebook api class properties
                    var facebookFeedItem = socialFeeds.FirstOrDefault(i => i.IsOfType(FacebookFeed.TemplateId));
                    if (facebookFeedItem != null)
                    {
                        var facebookFeed = new FacebookFeed(facebookFeedItem);
                        if (facebookFeed != null)
                        {
                            if (facebookFeed.FacebookAccount.TargetItem != null)
                            {
                                var facebookAccount = new FacebookAccount(facebookFeed.FacebookAccount.TargetItem);

                                if (facebookAccount.SocialLink != null)
                                {
                                    if (!ShowSocialFeed)
                                    {
                                        ShowSocialFeed = true;
                                    }
                                    FacebookApi.ApiId = string.Join("|",
                                                                    new string[]
                                    {
                                        facebookAccount.ApiId.Value, facebookAccount.ApiKey.Value
                                    });
                                    FacebookApi.Icon = facebookAccount.SocialLink != null
                                        ? MediaManager.GetMediaUrl(
                                        new SocialMedia(facebookAccount.SocialLink.TargetItem).SocialIcon.MediaItem)
                                        : "";

                                    // new BaseFeed()

                                    FacebookApi.Priority = GetPriority(facebookFeed.BaseFeed);
                                }
                            }
                        }
                    }

                    // Get twitter feed item and bind twitter api class properties
                    var twitterFeedItem = socialFeeds.FirstOrDefault(i => i.IsOfType(TwitterFeed.TemplateId));
                    if (twitterFeedItem != null)
                    {
                        var twitterFeed = new TwitterFeed(twitterFeedItem);
                        if (twitterFeed != null)
                        {
                            if (twitterFeed.TwitterAccount.TargetItem != null)
                            {
                                var twitterAccount = new TwitterAccount(twitterFeed.TwitterAccount.TargetItem);

                                if (!ShowSocialFeed)
                                {
                                    ShowSocialFeed = true;
                                }
                                TwitterApi.HashTagsWithTokens = string.Join("|", new string[]
                                {
                                    string.Join(",",
                                                twitterFeed.Hashtags.GetItems().Select(i => new Hashtag(i).Value.Value)),
                                    twitterAccount.TwitterToken.Value,
                                    twitterAccount.TwitterTokenSecret.Value,
                                    twitterAccount.TwitterConsumerKey.Value,
                                    twitterAccount.TwitterConsumerSecret.Value
                                });

                                TwitterApi.Icon = twitterAccount.SocialLink != null
                                    ? MediaManager.GetMediaUrl(
                                    new SocialMedia(twitterAccount.SocialLink.TargetItem).SocialIcon.MediaItem)
                                    : "";

                                TwitterApi.Priority = GetPriority(twitterFeed.BaseFeed);
                            }
                        }
                    }

                    // Get instagram feed item and bind instagram api class properties
                    var instagramFeedItem = socialFeeds.FirstOrDefault(i => i.IsOfType(InstagramFeed.TemplateId));

                    if (instagramFeedItem != null)
                    {
                        var instagramFeed = new InstagramFeed(instagramFeedItem);
                        if (instagramFeed != null)
                        {
                            if (instagramFeed.InstagramAccount.TargetItem != null)
                            {
                                var instagramAccount = new InstagramAccount(instagramFeed.InstagramAccount.TargetItem);

                                if (!ShowSocialFeed)
                                {
                                    ShowSocialFeed = true;
                                }
                                InstagramApi.HashTags = string.Join(",",
                                                                    instagramFeed.Hashtags.GetItems().Select(i => new Hashtag(i).Value.Value));
                                InstagramApi.AccessToken = instagramAccount.AccessToken.Value;
                                InstagramApi.ClientId    = instagramAccount.InstagramClientId.Value;
                                InstagramApi.Icon        = instagramAccount.SocialLink != null
                                    ? MediaManager.GetMediaUrl(
                                    new SocialMedia(instagramAccount.SocialLink.TargetItem).SocialIcon.MediaItem)
                                    : "";


                                InstagramApi.Priority = GetPriority(instagramFeed.BaseFeed);
                            }
                        }
                    }


                    // Get youtube feed item and bind youtube api class properties
                    var youTubeFeedItem = socialFeeds.FirstOrDefault(i => i.IsOfType(YoutubeFeed.TemplateId));
                    if (youTubeFeedItem != null)
                    {
                        var youTubeFeed = new YoutubeFeed(youTubeFeedItem);
                        if (youTubeFeed.YouTubeAccount.TargetItem != null)
                        {
                            var youtubeAccount = new YoutubeAccount(youTubeFeed.YouTubeAccount.TargetItem);

                            if (!ShowSocialFeed)
                            {
                                ShowSocialFeed = true;
                            }
                            YouTubeApi.AccountId     = youtubeAccount.AccountId.Value;
                            YouTubeApi.AccountApiKey = youtubeAccount.AccountApiKey.Value;

                            YouTubeApi.Icon = youtubeAccount.SocialLink != null
                                ? MediaManager.GetMediaUrl(
                                new SocialMedia(youtubeAccount.SocialLink.TargetItem).SocialIcon.MediaItem)
                                : "";

                            YouTubeApi.Priority = GetPriority(youTubeFeed.BaseFeed);
                        }
                    }

                    // Get pinterest feed item and bind pinterest api class properties
                    var pinterestFeedItem = socialFeeds.FirstOrDefault(i => i.IsOfType(PinterestFeed.TemplateId));
                    if (pinterestFeedItem != null)
                    {
                        var pinterestFeed = new PinterestFeed(pinterestFeedItem);
                        if (pinterestFeed != null && pinterestFeed.PinterestAccount.TargetItem != null)
                        {
                            var pinterestAccount = new PinterestAccount(pinterestFeed.PinterestAccount.TargetItem);


                            if (!ShowSocialFeed)
                            {
                                ShowSocialFeed = true;
                            }
                            PinterestApi.AccountId = pinterestAccount.AccountId.Value;

                            PinterestApi.Icon = pinterestAccount.SocialLink != null
                                ? MediaManager.GetMediaUrl(
                                new SocialMedia(pinterestAccount.SocialLink.TargetItem).SocialIcon.MediaItem)
                                : "";

                            PinterestApi.Priority = GetPriority(pinterestFeed.BaseFeed);
                        }
                    }

                    // Get flickr feed item and bind flickr api class properties
                    var flickrFeedItem = socialFeeds.FirstOrDefault(i => i.IsOfType(FlickrFeed.TemplateId));
                    if (flickrFeedItem != null)
                    {
                        var flickrFeed = new FlickrFeed(flickrFeedItem);
                        if (flickrFeed != null)
                        {
                            if (flickrFeed.FlickrAccount.TargetItem != null)
                            {
                                var flickrAccount = new FlickrAccount(flickrFeed.FlickrAccount.TargetItem);

                                if (!ShowSocialFeed)
                                {
                                    ShowSocialFeed = true;
                                }
                                FlickrApi.AccountId = flickrAccount.AccountId.Value;
                                FlickrApi.Icon      = flickrAccount.SocialLink != null
                                    ? MediaManager.GetMediaUrl(
                                    new SocialMedia(flickrAccount.SocialLink.TargetItem).SocialIcon.MediaItem)
                                    : "";

                                FlickrApi.Priority = GetPriority(flickrFeed.BaseFeed);
                            }
                        }
                    }
                }
            }
        }
예제 #17
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();
            }
        }
예제 #18
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            User           user     = new User();
            UserRepository userrepo = new UserRepository();

            SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
            try
            {
                if (txtPassword.Text == txtConfirmPassword.Text)
                {
                    user.PaymentStatus = "unpaid";
                    user.AccountType   = Request.QueryString["type"];
                    if (user.AccountType == string.Empty)
                    {
                        user.AccountType = AccountType.Deluxe.ToString();
                    }
                    user.CreateDate = DateTime.Now;
                    user.ExpiryDate = DateTime.Now.AddMonths(1);
                    user.Id         = Guid.NewGuid();
                    user.UserName   = txtFirstName.Text + " " + txtLastName.Text;
                    user.Password   = this.MD5Hash(txtPassword.Text);
                    user.EmailId    = txtEmail.Text;
                    user.UserStatus = 1;
                    if (!userrepo.IsUserExist(user.EmailId))
                    {
                        UserRepository.Add(user);
                        SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text + " " + txtLastName.Text, txtPassword.Text, txtEmail.Text);

                        TeamRepository teamRepo = new TeamRepository();
                        Team           team     = teamRepo.getTeamByEmailId(txtEmail.Text);
                        if (team != null)
                        {
                            Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                            teamRepo.updateTeamStatus(teamid);


                            TeamMemberProfileRepository teamMemRepo   = new TeamMemberProfileRepository();
                            List <TeamMemberProfile>    lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                            foreach (TeamMemberProfile item in lstteammember)
                            {
                                try
                                {
                                    SocialProfilesRepository socialRepo   = new SocialProfilesRepository();
                                    SocialProfile            socioprofile = new SocialProfile();
                                    socioprofile.Id          = Guid.NewGuid();
                                    socioprofile.ProfileDate = DateTime.Now;
                                    socioprofile.ProfileId   = item.ProfileId;
                                    socioprofile.ProfileType = item.ProfileType;
                                    socioprofile.UserId      = user.Id;
                                    socialRepo.addNewProfileForUser(socioprofile);

                                    if (item.ProfileType == "facebook")
                                    {
                                        try
                                        {
                                            FacebookAccount           fbAccount     = new FacebookAccount();
                                            FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                            FacebookAccount           userAccount   = fbAccountRepo.getUserDetails(item.ProfileId);
                                            fbAccount.AccessToken = userAccount.AccessToken;
                                            fbAccount.EmailId     = userAccount.EmailId;
                                            fbAccount.FbUserId    = item.ProfileId;
                                            fbAccount.FbUserName  = userAccount.FbUserName;
                                            fbAccount.Friends     = userAccount.Friends;
                                            fbAccount.Id          = Guid.NewGuid();
                                            fbAccount.IsActive    = true;
                                            fbAccount.ProfileUrl  = userAccount.ProfileUrl;
                                            fbAccount.Type        = userAccount.Type;
                                            fbAccount.UserId      = user.Id;
                                            fbAccountRepo.addFacebookUser(fbAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.Message);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "twitter")
                                    {
                                        try
                                        {
                                            TwitterAccount           twtAccount = new TwitterAccount();
                                            TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                            TwitterAccount           twtAcc     = twtAccRepo.getUserInfo(item.ProfileId);
                                            twtAccount.FollowersCount    = twtAcc.FollowersCount;
                                            twtAccount.FollowingCount    = twtAcc.FollowingCount;
                                            twtAccount.Id                = Guid.NewGuid();
                                            twtAccount.IsActive          = true;
                                            twtAccount.OAuthSecret       = twtAcc.OAuthSecret;
                                            twtAccount.OAuthToken        = twtAcc.OAuthToken;
                                            twtAccount.ProfileImageUrl   = twtAcc.ProfileImageUrl;
                                            twtAccount.ProfileUrl        = twtAcc.ProfileUrl;
                                            twtAccount.TwitterName       = twtAcc.TwitterName;
                                            twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                            twtAccount.TwitterUserId     = twtAcc.TwitterUserId;
                                            twtAccount.UserId            = user.Id;
                                            twtAccRepo.addTwitterkUser(twtAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "instagram")
                                    {
                                        try
                                        {
                                            InstagramAccount           insAccount = new InstagramAccount();
                                            InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                            InstagramAccount           InsAcc     = insAccRepo.getInstagramAccountById(item.ProfileId);
                                            insAccount.AccessToken = InsAcc.AccessToken;
                                            insAccount.FollowedBy  = InsAcc.FollowedBy;
                                            insAccount.Followers   = InsAcc.Followers;
                                            insAccount.Id          = Guid.NewGuid();
                                            insAccount.InstagramId = item.ProfileId;
                                            insAccount.InsUserName = InsAcc.InsUserName;
                                            insAccount.IsActive    = true;
                                            insAccount.ProfileUrl  = InsAcc.ProfileUrl;
                                            insAccount.TotalImages = InsAcc.TotalImages;
                                            insAccount.UserId      = user.Id;
                                            insAccRepo.addInstagramUser(insAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                    else if (item.ProfileType == "linkedin")
                                    {
                                        try
                                        {
                                            LinkedInAccount           linkAccount       = new LinkedInAccount();
                                            LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                            LinkedInAccount           linkAcc           = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                            linkAccount.Id               = Guid.NewGuid();
                                            linkAccount.IsActive         = true;
                                            linkAccount.LinkedinUserId   = item.ProfileId;
                                            linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                            linkAccount.OAuthSecret      = linkAcc.OAuthSecret;
                                            linkAccount.OAuthToken       = linkAcc.OAuthToken;
                                            linkAccount.OAuthVerifier    = linkAcc.OAuthVerifier;
                                            linkAccount.ProfileImageUrl  = linkAcc.ProfileImageUrl;
                                            linkAccount.ProfileUrl       = linkAcc.ProfileUrl;
                                            linkAccount.UserId           = user.Id;
                                            linkedAccountRepo.addLinkedinUser(linkAccount);
                                        }
                                        catch (Exception ex)
                                        {
                                            Console.WriteLine(ex.StackTrace);
                                            logger.Error(ex.Message);
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                }
                            }
                        }


                        lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                    }
                    else
                    {
                        lblerror.Text = "Email Already Exists " + "<a href=\"Default.aspx\">login</a>";
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                lblerror.Text = "Please Insert Correct Information";
                Console.WriteLine(ex.StackTrace);
            }
        }
예제 #19
0
    static public void Main()
    {
        FacebookAccount facebook = new FacebookAccount()
        {
            FullName = "el Rey Midas", Uid = "531902", ScreenName = "Midas", Followers = 10
        };
        FanpageAccount fanpage = new FanpageAccount()
        {
            FullName = "Jose Alberto Camargo", Uid = "910910", ScreenName = "ElFanDelRey", Followers = 50
        };
        YoutubeAccount youtube = new YoutubeAccount()
        {
            FullName = "Jose Camargo", Uid = "15319024", ScreenName = "ElCanalDelRey", Followers = 200
        };
        TwitterAccount twitter = new TwitterAccount()
        {
            FullName = "Jose Camargo", Uid = "15377024", ScreenName = "app_config", Followers = 300
        };
        InstagramAccount instagram = new InstagramAccount()
        {
            FullName = "Jose Camargo", Uid = "15377024", ScreenName = "app_config", Followers = 300
        };

/*
 *  System.Console.WriteLine(ConvertToString(facebook));
 *  System.Console.WriteLine(ConvertToString(fanpage));
 *  System.Console.WriteLine(ConvertToString(youtube));
 *  System.Console.WriteLine(ConvertToString(twitter));
 *  System.Console.WriteLine(ConvertToString(instagram));
 *  System.Console.WriteLine("=============================================================");
 */
        PriceCalculator priceCalculator = new PriceCalculator();

        priceCalculator.AddProvider("facebook", new FacebookPriceCalculator());
        priceCalculator.AddProvider("fanpage", new FanpagePriceCalculator());
        priceCalculator.AddProvider("youtube", new YoutubePriceCalculator());
        priceCalculator.AddProvider("twitter", new TwitterPriceCalculator());
        priceCalculator.AddProvider("instagram", new InstagramPriceCalculator());

/*
 *  System.Console.WriteLine(priceCalculator.CalculatePricePerPostFor(facebook));
 *  System.Console.WriteLine(priceCalculator.CalculatePricePerPostFor(fanpage));
 *  System.Console.WriteLine(priceCalculator.CalculatePricePerPostFor(youtube));
 *  System.Console.WriteLine(priceCalculator.CalculatePricePerPostFor(twitter));
 *  System.Console.WriteLine(priceCalculator.CalculatePricePerPostFor(instagram));
 */

        //  SocialNetworkAccount x = new FacebookAccount();
        //   System.Console.WriteLine(x);

        BinaryTreeIndexForData <IFollowable> myIndex = new BinaryTreeIndexForData <IFollowable>();

        myIndex.Add(facebook);
        myIndex.Add(fanpage);
        myIndex.Add(youtube);
        myIndex.Add(twitter);
        myIndex.Add(instagram);

        BinaryTreeIndexForData <string> myIndexForString = new BinaryTreeIndexForData <string>();

        myIndexForString.Add("hola mundo");

        BinaryTreeIndexForData <int> myIndexForInt = new BinaryTreeIndexForData <int>();

        myIndexForInt.Add(190999);
    }
        public string getIntagramImages(InstagramAccount objInsAccount)
        {
            InstagramAccountRepository objIns = new InstagramAccountRepository();
            InstagramResponse <GlobusInstagramLib.App.Core.User[]> userinf  = new InstagramResponse <GlobusInstagramLib.App.Core.User[]>();
            InstagramResponse <GlobusInstagramLib.App.Core.User[]> userinf1 = new InstagramResponse <GlobusInstagramLib.App.Core.User[]>();
            InstagramResponse <InstagramMedia[]> userinf2 = new InstagramResponse <InstagramMedia[]>();
            InstagramResponse <Comment[]>        usercmts = new InstagramResponse <Comment[]>();
            MediaController            objMedia           = new MediaController();
            CommentController          objComment         = new CommentController();
            LikesController            objLikes           = new LikesController();
            InstagramFeedRepository    objInsFeedRepo     = new InstagramFeedRepository();
            InstagramFeed              objFeed            = new InstagramFeed();
            InstagramComment           objinsComment      = new InstagramComment();
            InstagramCommentRepository objInsRepo         = new InstagramCommentRepository();
            //  ArrayList aslt = objIns.getAllInstagramAccountsOfUser(instaid);
            string html = string.Empty;
            int    i    = 0;

            // string[] allhtmls = new string[aslt.Count];
            string[] allhtmls      = new string[0];
            int      countofimages = 0;

            GlobusInstagramLib.Instagram.Core.UsersMethods.Users userInstagram = new GlobusInstagramLib.Instagram.Core.UsersMethods.Users();
            try
            {
                userinf2 = userInstagram.UserRecentMedia(objInsAccount.InstagramId, string.Empty, string.Empty, "20", string.Empty, string.Empty, objInsAccount.AccessToken);
            }
            catch (Exception ex) {
                logger.Error(ex.StackTrace);
            }


            if (userinf2 != null)
            {
                for (int j = 0; j < userinf2.data.Count(); j++)
                {
                    try
                    {
                        usercmts = objComment.GetComment(userinf2.data[j].id, objInsAccount.AccessToken);
                        bool liked = false;
                        try
                        {
                            liked = objLikes.LikeToggle(userinf2.data[j].id, objInsAccount.InstagramId, objInsAccount.AccessToken);
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                        int n = usercmts.data.Count();
                        for (int cmt = usercmts.data.Count() - 1; cmt > usercmts.data.Count() - 3; cmt--)
                        {
                            try
                            {
                                objinsComment.Comment        = usercmts.data[cmt].text;
                                objinsComment.CommentDate    = usercmts.data[cmt].created_time.ToString();
                                objinsComment.CommentId      = usercmts.data[cmt].id;
                                objinsComment.EntryDate      = DateTime.Now.ToString();
                                objinsComment.FeedId         = userinf2.data[j].id;
                                objinsComment.Id             = Guid.NewGuid();
                                objinsComment.InstagramId    = objInsAccount.InstagramId;
                                objinsComment.UserId         = objInsAccount.UserId;
                                objinsComment.FromName       = usercmts.data[cmt].from.full_name;
                                objinsComment.FromProfilePic = usercmts.data[cmt].from.profile_picture;
                                if (!objInsRepo.checkInstagramCommentExists(usercmts.data[cmt].id, objInsAccount.UserId))
                                {
                                    objInsRepo.addInstagramComment(objinsComment);
                                }
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.StackTrace);
                                Console.WriteLine(ex.StackTrace);
                            }
                        }
                        objFeed.EntryDate    = DateTime.Now;
                        objFeed.FeedDate     = userinf2.data[j].created_time.ToString();
                        objFeed.FeedId       = userinf2.data[j].id;
                        objFeed.FeedImageUrl = userinf2.data[j].images.low_resolution.url.ToString();
                        objFeed.InstagramId  = objInsAccount.InstagramId;
                        objFeed.LikeCount    = userinf2.data[j].likes.count;
                        objFeed.UserId       = objInsAccount.UserId;
                        if (!objInsFeedRepo.checkInstagramFeedExists(userinf2.data[j].id, objInsAccount.UserId))
                        {
                            objInsFeedRepo.addInstagramFeed(objFeed);
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    i++;
                }
            }
            i++;


            string totalhtml = string.Empty;

            try
            {
                for (int k = 0; k < countofimages; k++)
                {
                    totalhtml = totalhtml + allhtmls[k];
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
            }
            Session["AllHtmls"] = allhtmls;
            return(totalhtml);
        }
예제 #21
0
 public void StartLocationFollow(string link, int count, InstagramAccount account)
 {
     OpenLocation(link, count, account);
 }
예제 #22
0
        protected void btnRegister_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                User             user                = new User();
                UserRepository   userrepo            = new UserRepository();
                UserActivation   objUserActivation   = new UserActivation();
                Coupon           objCoupon           = new Coupon();
                CouponRepository objCouponRepository = new CouponRepository();
                Groups           groups              = new Groups();
                GroupRepository  objGroupRepository  = new GroupRepository();
                Team             teams               = new Team();
                TeamRepository   objTeamRepository   = new TeamRepository();


                SocioBoard.Helper.SessionFactory.configfilepath = Server.MapPath("~/hibernate.cfg.xml");
                try
                {
                    if (DropDownList1.SelectedValue == "Free" || DropDownList1.SelectedValue == "Standard" || DropDownList1.SelectedValue == "Deluxe" || DropDownList1.SelectedValue == "Premium" || DropDownList1.SelectedValue == "SocioBasic" || DropDownList1.SelectedValue == "SocioStandard" || DropDownList1.SelectedValue == "SocioPremium" || DropDownList1.SelectedValue == "SocioDeluxe")


                    {
                        if (TextBox1.Text.Trim() != "")
                        {
                            string resp = SBUtils.GetCouponStatus(TextBox1.Text).ToString();
                            if (resp != "valid")
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('" + resp + "');", true);
                                return;
                            }
                        }



                        if (txtPassword.Text == txtConfirmPassword.Text)
                        {
                            user.PaymentStatus = "unpaid";
                            user.AccountType   = DropDownList1.SelectedValue.ToString();
                            if (string.IsNullOrEmpty(user.AccountType))
                            {
                                user.AccountType = AccountType.Free.ToString();
                            }


                            user.CreateDate       = DateTime.Now;
                            user.ExpiryDate       = DateTime.Now.AddDays(30);
                            user.Id               = Guid.NewGuid();
                            user.UserName         = txtFirstName.Text + " " + txtLastName.Text;
                            user.Password         = this.MD5Hash(txtPassword.Text);
                            user.EmailId          = txtEmail.Text;
                            user.UserStatus       = 1;
                            user.ActivationStatus = "0";

                            if (TextBox1.Text.Trim() != "")
                            {
                                user.CouponCode = TextBox1.Text.Trim().ToString();
                            }


                            if (!userrepo.IsUserExist(user.EmailId))
                            {
                                logger.Error("Before User reg");
                                UserRepository.Add(user);



                                try
                                {
                                    groups.Id        = Guid.NewGuid();
                                    groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"];
                                    groups.UserId    = user.Id;
                                    groups.EntryDate = DateTime.Now;

                                    objGroupRepository.AddGroup(groups);


                                    teams.Id      = Guid.NewGuid();
                                    teams.GroupId = groups.Id;
                                    teams.UserId  = user.Id;
                                    teams.EmailId = user.EmailId;

                                    objTeamRepository.addNewTeam(teams);



                                    BusinessSettingRepository busnrepo = new BusinessSettingRepository();

                                    SocioBoard.Domain.BusinessSetting objbsnssetting = new SocioBoard.Domain.BusinessSetting();

                                    if (!busnrepo.checkBusinessExists(user.Id, groups.GroupName))
                                    {
                                        objbsnssetting.Id               = Guid.NewGuid();
                                        objbsnssetting.BusinessName     = groups.GroupName;
                                        objbsnssetting.GroupId          = groups.Id;
                                        objbsnssetting.AssigningTasks   = false;
                                        objbsnssetting.AssigningTasks   = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.TaskNotification = false;
                                        objbsnssetting.FbPhotoUpload    = 0;
                                        objbsnssetting.UserId           = user.Id;
                                        objbsnssetting.EntryDate        = DateTime.Now;
                                        busnrepo.AddBusinessSetting(objbsnssetting);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("Error : " + ex.Message);
                                    logger.Error("Error : " + ex.StackTrace);
                                }


                                try
                                {
                                    logger.Error("1 Request.QueryString[refid]");
                                    if (Request.QueryString["refid"] != null)
                                    {
                                        logger.Error("3 Request.QueryString[refid]");
                                        User UserValid = null;
                                        if (IsUserValid(Request.QueryString["refid"].ToString(), ref UserValid))
                                        {
                                            logger.Error("Inside IsUserValid");
                                            user.RefereeStatus = "1";
                                            UpdateUserReference(UserValid);
                                            AddUserRefreeRelation(user, UserValid);

                                            logger.Error("IsUserValid");
                                        }
                                        else
                                        {
                                            user.RefereeStatus = "0";
                                        }
                                    }
                                    logger.Error("2 Request.QueryString[refid]");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.Message);
                                    logger.Error("btnRegister_Click" + ex.Message);
                                    logger.Error("btnRegister_Click" + ex.StackTrace);
                                }



                                if (TextBox1.Text.Trim() != "")
                                {
                                    objCoupon.CouponCode = TextBox1.Text.Trim();
                                    List <Coupon> lstCoupon = objCouponRepository.GetCouponByCouponCode(objCoupon);
                                    objCoupon.Id = lstCoupon[0].Id;
                                    objCoupon.EntryCouponDate = lstCoupon[0].EntryCouponDate;
                                    objCoupon.ExpCouponDate   = lstCoupon[0].ExpCouponDate;
                                    objCoupon.Status          = "1";
                                    objCouponRepository.SetCouponById(objCoupon);
                                }

                                Session["LoggedUser"]              = user;
                                objUserActivation.Id               = Guid.NewGuid();
                                objUserActivation.UserId           = user.Id;
                                objUserActivation.ActivationStatus = "0";
                                UserActivationRepository.Add(objUserActivation);

                                //add package start

                                UserPackageRelation           objUserPackageRelation           = new UserPackageRelation();
                                UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository();
                                PackageRepository             objPackageRepository             = new PackageRepository();

                                try
                                {
                                    Package objPackage = objPackageRepository.getPackageDetails(user.AccountType);
                                    objUserPackageRelation.Id            = Guid.NewGuid();
                                    objUserPackageRelation.PackageId     = objPackage.Id;
                                    objUserPackageRelation.UserId        = user.Id;
                                    objUserPackageRelation.ModifiedDate  = DateTime.Now;
                                    objUserPackageRelation.PackageStatus = true;

                                    objUserPackageRelationRepository.AddUserPackageRelation(objUserPackageRelation);
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }

                                //end package

                                SocioBoard.Helper.MailSender.SendEMail(txtFirstName.Text, txtPassword.Text, txtEmail.Text, user.AccountType.ToString(), user.Id.ToString());
                                TeamRepository teamRepo = new TeamRepository();
                                try
                                {
                                    Team team = teamRepo.getTeamByEmailId(txtEmail.Text);
                                    if (team != null)
                                    {
                                        Guid teamid = Guid.Parse(Request.QueryString["tid"]);
                                        teamRepo.updateTeamStatus(teamid);
                                        TeamMemberProfileRepository teamMemRepo   = new TeamMemberProfileRepository();
                                        List <TeamMemberProfile>    lstteammember = teamMemRepo.getAllTeamMemberProfilesOfTeam(team.Id);
                                        foreach (TeamMemberProfile item in lstteammember)
                                        {
                                            try
                                            {
                                                SocialProfilesRepository socialRepo   = new SocialProfilesRepository();
                                                SocialProfile            socioprofile = new SocialProfile();
                                                socioprofile.Id          = Guid.NewGuid();
                                                socioprofile.ProfileDate = DateTime.Now;
                                                socioprofile.ProfileId   = item.ProfileId;
                                                socioprofile.ProfileType = item.ProfileType;
                                                socioprofile.UserId      = user.Id;
                                                socialRepo.addNewProfileForUser(socioprofile);

                                                if (item.ProfileType == "facebook")
                                                {
                                                    try
                                                    {
                                                        FacebookAccount           fbAccount     = new FacebookAccount();
                                                        FacebookAccountRepository fbAccountRepo = new FacebookAccountRepository();
                                                        FacebookAccount           userAccount   = fbAccountRepo.getUserDetails(item.ProfileId);
                                                        fbAccount.AccessToken = userAccount.AccessToken;
                                                        fbAccount.EmailId     = userAccount.EmailId;
                                                        fbAccount.FbUserId    = item.ProfileId;
                                                        fbAccount.FbUserName  = userAccount.FbUserName;
                                                        fbAccount.Friends     = userAccount.Friends;
                                                        fbAccount.Id          = Guid.NewGuid();
                                                        fbAccount.IsActive    = 1;
                                                        fbAccount.ProfileUrl  = userAccount.ProfileUrl;
                                                        fbAccount.Type        = userAccount.Type;
                                                        fbAccount.UserId      = user.Id;
                                                        fbAccountRepo.addFacebookUser(fbAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.Message);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "twitter")
                                                {
                                                    try
                                                    {
                                                        TwitterAccount           twtAccount = new TwitterAccount();
                                                        TwitterAccountRepository twtAccRepo = new TwitterAccountRepository();
                                                        TwitterAccount           twtAcc     = twtAccRepo.getUserInfo(item.ProfileId);
                                                        twtAccount.FollowersCount    = twtAcc.FollowersCount;
                                                        twtAccount.FollowingCount    = twtAcc.FollowingCount;
                                                        twtAccount.Id                = Guid.NewGuid();
                                                        twtAccount.IsActive          = true;
                                                        twtAccount.OAuthSecret       = twtAcc.OAuthSecret;
                                                        twtAccount.OAuthToken        = twtAcc.OAuthToken;
                                                        twtAccount.ProfileImageUrl   = twtAcc.ProfileImageUrl;
                                                        twtAccount.ProfileUrl        = twtAcc.ProfileUrl;
                                                        twtAccount.TwitterName       = twtAcc.TwitterName;
                                                        twtAccount.TwitterScreenName = twtAcc.TwitterScreenName;
                                                        twtAccount.TwitterUserId     = twtAcc.TwitterUserId;
                                                        twtAccount.UserId            = user.Id;
                                                        twtAccRepo.addTwitterkUser(twtAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "instagram")
                                                {
                                                    try
                                                    {
                                                        InstagramAccount           insAccount = new InstagramAccount();
                                                        InstagramAccountRepository insAccRepo = new InstagramAccountRepository();
                                                        InstagramAccount           InsAcc     = insAccRepo.getInstagramAccountById(item.ProfileId);
                                                        insAccount.AccessToken = InsAcc.AccessToken;
                                                        insAccount.FollowedBy  = InsAcc.FollowedBy;
                                                        insAccount.Followers   = InsAcc.Followers;
                                                        insAccount.Id          = Guid.NewGuid();
                                                        insAccount.InstagramId = item.ProfileId;
                                                        insAccount.InsUserName = InsAcc.InsUserName;
                                                        insAccount.IsActive    = true;
                                                        insAccount.ProfileUrl  = InsAcc.ProfileUrl;
                                                        insAccount.TotalImages = InsAcc.TotalImages;
                                                        insAccount.UserId      = user.Id;
                                                        insAccRepo.addInstagramUser(insAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                                else if (item.ProfileType == "linkedin")
                                                {
                                                    try
                                                    {
                                                        LinkedInAccount           linkAccount       = new LinkedInAccount();
                                                        LinkedInAccountRepository linkedAccountRepo = new LinkedInAccountRepository();
                                                        LinkedInAccount           linkAcc           = linkedAccountRepo.getLinkedinAccountDetailsById(item.ProfileId);
                                                        linkAccount.Id               = Guid.NewGuid();
                                                        linkAccount.IsActive         = true;
                                                        linkAccount.LinkedinUserId   = item.ProfileId;
                                                        linkAccount.LinkedinUserName = linkAcc.LinkedinUserName;
                                                        linkAccount.OAuthSecret      = linkAcc.OAuthSecret;
                                                        linkAccount.OAuthToken       = linkAcc.OAuthToken;
                                                        linkAccount.OAuthVerifier    = linkAcc.OAuthVerifier;
                                                        linkAccount.ProfileImageUrl  = linkAcc.ProfileImageUrl;
                                                        linkAccount.ProfileUrl       = linkAcc.ProfileUrl;
                                                        linkAccount.UserId           = user.Id;
                                                        linkedAccountRepo.addLinkedinUser(linkAccount);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        Console.WriteLine(ex.StackTrace);
                                                        logger.Error(ex.Message);
                                                    }
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                logger.Error(ex.Message);
                                            }
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }

                                #region SetInvitationStatusAfterSuccessfulRegistration
                                try
                                {
                                    if (Request.QueryString["refid"] != null)
                                    {
                                        string refid = Request.QueryString["refid"];

                                        int res = SetInvitationStatusAfterSuccessfulRegistration(refid, txtEmail.Text);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    logger.Error(ex.Message);
                                }
                                #endregion


                                try
                                {
                                    lblerror.Text = "Registered Successfully !" + "<a href=\"Default.aspx\">Login</a>";
                                    Response.Redirect("~/Home.aspx");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine(ex.StackTrace);
                                }
                            }
                            else
                            {
                                lblerror.Text = "Email Already Exists " + "<a id=\"loginlink\"  href=\"#\">login</a>";
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please select Account Type!');", true);
                    }
                }

                catch (Exception ex)
                {
                    logger.Error(ex.StackTrace);
                    lblerror.Text = "Success!";
                    Console.WriteLine(ex.StackTrace);
                    //Response.Redirect("Home.aspx");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);

                Console.WriteLine(ex.StackTrace);
                //Response.Redirect("Home.aspx");
            }
        }
예제 #23
0
        public static Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > > GetUserProfilesSnapsAccordingToGroup(List <Domain.Socioboard.Domain.GroupProfile> groupProfile, User objUser, int CountProfileSnapshot = 0)
        {
            // User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > > dic_profilessnap = new Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > >();
            var dicprofilefeeds            = new Dictionary <object, List <object> >();
            List <GroupProfile> lstprofile = groupProfile.Where(t => t.ProfileType != "linkedin").ToList();
            int tempCount = 0;

            foreach (Domain.Socioboard.Domain.GroupProfile item in lstprofile)
            {
                tempCount++;
                if (tempCount <= CountProfileSnapshot)
                {
                    continue;
                }

                //to load only 3 profiles on home page load to speed up page loading
                if (dic_profilessnap.Count >= 3)
                {
                    break;
                }

                List <object> feeds = null;
                if (item.ProfileType == "facebook" || item.ProfileType == "facebook_page")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                        ApiobjFacebookAccount.Timeout = 300000;
                        FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount)));
                        Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed();
                        ApiobjFacebookFeed.Timeout = 300000;
                        //List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<FacebookFeed>)));
                        List <MongoFacebookFeed> lstFacebookFeed = (List <MongoFacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <MongoFacebookFeed>)));

                        foreach (var facebookfeed in lstFacebookFeed)
                        {
                            feeds.Add(facebookfeed);
                        }
                        dicprofilefeeds.Add(objFacebookAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "twitter")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                        TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount)));
                        Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed();
                        ApiobjTwitterFeed.Timeout = 300000;
                        //List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>)));
                        List <Domain.Socioboard.MongoDomain.TwitterFeed> lstTwitterFeed = (List <Domain.Socioboard.MongoDomain.TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <Domain.Socioboard.MongoDomain.TwitterFeed>)));
                        foreach (var twitterfeed in lstTwitterFeed)
                        {
                            feeds.Add(twitterfeed);
                        }
                        dicprofilefeeds.Add(objTwitterAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "linkedin")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                        ApiobjLinkedinAccount.Timeout = 300000;
                        LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount)));
                        Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed();
                        ApiobjLinkedInFeed.Timeout = 300000;
                        //List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedInFeed>)));
                        List <LinkedInFeed> lstLinkedInFeed = (List <LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <LinkedInFeed>)));

                        foreach (var LinkedInFeed in lstLinkedInFeed)
                        {
                            feeds.Add(LinkedInFeed);
                        }
                        dicprofilefeeds.Add(objLinkedInAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                if (item.ProfileType == "instagram")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                        ApiobjInstagramAccount.Timeout = 300000;
                        InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount)));
                        dicprofilefeeds.Add(objInstagramAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "tumblr")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                        ApiobjTumblrAccount.Timeout = 300000;
                        TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount)));
                        dicprofilefeeds.Add(objTumblrAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }


                if (item.ProfileType == "youtube")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                        ApiobjYoutubeAccount.Timeout = 300000;
                        YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount)));
                        Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel();
                        ApiobjYoutubeChannel.Timeout = 300000;
                        List <YoutubeChannel> lstYoutubeChannel = (List <YoutubeChannel>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <YoutubeChannel>)));
                        //List<YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>();
                        //lstYoutubeChannel.Add(objYoutubeChannel);
                        foreach (var youtubechannel in lstYoutubeChannel)
                        {
                            feeds.Add(youtubechannel);
                        }
                        dicprofilefeeds.Add(objYoutubeAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                if (item.ProfileType == "linkedincompanypage")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                        ApiobjLinkedinCompanyPage.Timeout = 300000;
                        LinkedinCompanyPage objLinkedinCompanypage = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedinCompanyPage)));
                        Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPagePost = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                        ApiobjLinkedinCompanyPage.Timeout = 300000;
                        List <LinkedinCompanyPagePosts> lstlipagepost = (List <LinkedinCompanyPagePosts>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPagePost.GetAllLinkedinCompanyPagePostsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <LinkedinCompanyPagePosts>)));
                        foreach (var lipagepost in lstlipagepost)
                        {
                            feeds.Add(lipagepost);
                        }
                        dicprofilefeeds.Add(objLinkedinCompanypage, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                if (item.ProfileType == "gplus")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                        ApiobjGooglePlusAccount.Timeout = 300000;
                        Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount = (GooglePlusAccount) new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GooglePlusAccount));
                        dicprofilefeeds.Add(_GooglePlusAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                if (item.ProfileType == "googleanalytics")
                {
                    try
                    {
                        feeds = new List <object>();
                        Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiobjGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount();
                        ApiobjGoogleAnalyticsAccount.Timeout = 300000;
                        Domain.Socioboard.Domain.GoogleAnalyticsAccount _GoogleAnalyticsAccount = (GoogleAnalyticsAccount) new JavaScriptSerializer().Deserialize(ApiobjGoogleAnalyticsAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GoogleAnalyticsAccount));
                        dicprofilefeeds.Add(_GoogleAnalyticsAccount, feeds);
                        dic_profilessnap.Add(item, dicprofilefeeds);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }

            return(dic_profilessnap);
        }
        public ActionResult EditProfileDetails(string ProfileId, string UserId, string Network)
        {
            if (Session["User"] != null)
            {
                Domain.Socioboard.Domain.User _User = (Domain.Socioboard.Domain.User)Session["User"];
                if (_User.UserType != "SuperAdmin")
                {
                    return(RedirectToAction("Index", "Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Index"));
            }
            Dictionary <string, object> objProfileToEdit = new Dictionary <string, object>();

            if (Network == "Facebook")
            {
                Api.FacebookAccount.FacebookAccount Apiobjfb = new Api.FacebookAccount.FacebookAccount();
                FacebookAccount objFbAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(Apiobjfb.getFacebookAccountDetailsById(UserId, ProfileId), typeof(FacebookAccount)));
                Session["UpdateProfileData"] = objFbAccount;
                objProfileToEdit.Add("Facebook", objFbAccount);
            }
            if (Network == "Twitter")
            {
                Api.TwitterAccount.TwitterAccount Apiobjtwt = new Api.TwitterAccount.TwitterAccount();
                TwitterAccount objtwtAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(Apiobjtwt.GetTwitterAccountDetailsById(UserId, ProfileId), typeof(TwitterAccount)));
                Session["UpdateProfileData"] = objtwtAccount;
                objProfileToEdit.Add("Twitter", objtwtAccount);
            }
            if (Network == "Linkedin")
            {
                Api.LinkedinAccount.LinkedinAccount Apiobjlin = new Api.LinkedinAccount.LinkedinAccount();
                LinkedInAccount objLinAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(Apiobjlin.GetLinkedinAccountDetailsById(UserId, ProfileId), typeof(LinkedInAccount)));
                Session["UpdateProfileData"] = objLinAccount;
                objProfileToEdit.Add("Linkedin", objLinAccount);
            }
            if (Network == "Instagram")
            {
                Api.InstagramAccount.InstagramAccount ApiobjIns = new Api.InstagramAccount.InstagramAccount();
                InstagramAccount objInsAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjIns.UserInformation(UserId, ProfileId), typeof(InstagramAccount)));
                Session["UpdateProfileData"] = objInsAccount;
                objProfileToEdit.Add("Instagram", objInsAccount);
            }
            if (Network == "Tumblr")
            {
                Api.TumblrAccount.TumblrAccount Apiobjtmb = new Api.TumblrAccount.TumblrAccount();
                TumblrAccount objTmbAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(Apiobjtmb.GetTumblrAccountDetailsById(UserId, ProfileId), typeof(TumblrAccount)));
                Session["UpdateProfileData"] = objTmbAccount;
                objProfileToEdit.Add("Tumblr", objTmbAccount);
            }
            if (Network == "Youtube")
            {
                Api.YoutubeAccount.YoutubeAccount ApiobjYoutb = new Api.YoutubeAccount.YoutubeAccount();
                YoutubeAccount objYouTbAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutb.GetYoutubeAccountDetailsById(UserId, ProfileId), typeof(YoutubeAccount)));
                Session["UpdateProfileData"] = objYouTbAccount;
                objProfileToEdit.Add("Youtube", objYouTbAccount);
            }
            if (Network == "GooglePlus")
            {
                Api.GooglePlusAccount.GooglePlusAccount Apiobjgplus = new Api.GooglePlusAccount.GooglePlusAccount();
                GooglePlusAccount objGPAccount = (GooglePlusAccount)(new JavaScriptSerializer().Deserialize(Apiobjgplus.GetGooglePlusAccountDetailsById(UserId, ProfileId), typeof(GooglePlusAccount)));
                Session["UpdateProfileData"] = objGPAccount;
                objProfileToEdit.Add("GooglePlus", objGPAccount);
            }

            return(View(objProfileToEdit));
        }
예제 #25
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);
                    }
                }
            }
        }