コード例 #1
0
ファイル: SBUtils.cs プロジェクト: prog-moh/socioboard-core
 private static ISocialSiteAccount GetSocialAccountFromTeamMemberProfile(User objUser, Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile)
 {
     ISocialSiteAccount objSocialSiteAccount = null;
     if (objTeamMemberProfile.ProfileType == "facebook")
     {
         Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
         objSocialSiteAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(FacebookAccount)));
     }
     else if (objTeamMemberProfile.ProfileType == "twitter")
     {
         Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
         objSocialSiteAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(TwitterAccount)));
     }
     else if (objTeamMemberProfile.ProfileType == "linkedin")
     {
         Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
         objSocialSiteAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(LinkedInAccount)));
     }
     else if (objTeamMemberProfile.ProfileType == "instagram")
     {
         Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
         objSocialSiteAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(InstagramAccount)));
     }
     else if (objTeamMemberProfile.ProfileType == "youtube")
     {
         Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
         objSocialSiteAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(YoutubeAccount)));
     }
     else if (objTeamMemberProfile.ProfileType == "tumblr")
     {
         Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
         objSocialSiteAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(TumblrAccount)));
     }
     return objSocialSiteAccount;
 }
コード例 #2
0
        public ActionResult Create()
        {
            User objUser = (User)Session["User"];

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> lstFacebookAccount = new List <FacebookAccount>();
            List <FacebookAccount> facebookaccounts   = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));
            List <FacebookAccount> facebookpages      = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));

            foreach (FacebookAccount item in facebookpages)
            {
                if (item != null)
                {
                    lstFacebookAccount.Add(item);
                }
            }
            if (lstFacebookAccount.Count > 0)
            {
                ViewBag.FbPages    = lstFacebookAccount;
                Session["FbPages"] = ViewBag.FbPages;
            }
            else
            {
                ViewBag.FbPages = null;
            }
            ViewBag.FbAccounts = facebookaccounts.Where(t => t.FbUserId != "").ToList();
            ViewBag.UserId     = objUser.Id;

            return(View());
        }
コード例 #3
0
        public ActionResult scheduler(string network, string profileid)
        {
            Dictionary <object, List <ScheduledMessage> > dictscheduler = new Dictionary <object, List <ScheduledMessage> >();

            Api.Groups.Groups ApiobjGroups            = new Api.Groups.Groups();
            Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups)));
            if (network == "facebook")
            {
                Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(FacebookAccount)));
                Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
                List <ScheduledMessage> objScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List <ScheduledMessage>)));
                dictscheduler.Add(objFacebookAccount, objScheduledMessage);
            }
            else if (network == "twitter")
            {
                Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(TwitterAccount)));
                Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
                List <ScheduledMessage> objScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List <ScheduledMessage>)));
                dictscheduler.Add(objTwitterAccount, objScheduledMessage);
            }
            else if (network == "linkedin")
            {
                Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(LinkedInAccount)));
                Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
                List <ScheduledMessage> objScheduledMessage = (List <ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List <ScheduledMessage>)));
                dictscheduler.Add(objLinkedInAccount, objScheduledMessage);
            }

            return(PartialView("_Panel3Partial", dictscheduler));
        }
コード例 #4
0
        public static FacebookAccount GetFacebookAccount(string FbUserId)
        {
            Api.FacebookAccount.FacebookAccount objApiFacebookAccount = new Api.FacebookAccount.FacebookAccount();

            FacebookAccount objDomainFacebookAccount = (FacebookAccount)new JavaScriptSerializer().Deserialize(objApiFacebookAccount.getUserDetails(FbUserId), typeof(FacebookAccount));

            return objDomainFacebookAccount;
        }
コード例 #5
0
        public static FacebookAccount GetFacebookAccount(string FbUserId)
        {
            Api.FacebookAccount.FacebookAccount objApiFacebookAccount = new Api.FacebookAccount.FacebookAccount();

            FacebookAccount objDomainFacebookAccount = (FacebookAccount) new JavaScriptSerializer().Deserialize(objApiFacebookAccount.getUserDetails(FbUserId), typeof(FacebookAccount));

            return(objDomainFacebookAccount);
        }
コード例 #6
0
        public async Task <ActionResult> Edit(ShareathonViewModel shareathon)
        {
            string id = "";

            for (int i = 0; i < shareathon.FacebookPageId.Length; i++)
            {
                string dataid = shareathon.FacebookPageId[i];
                id = dataid + "," + id;
            }
            User objUser = (User)Session["User"];
            List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >();

            Parameters.Add(new KeyValuePair <string, string>("Id", shareathon.Id.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("Userid", objUser.Id.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("Facebookpageid", id.TrimEnd(',')));
            Parameters.Add(new KeyValuePair <string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString()));
            string accesstoken = string.Empty;
            string UserId      = objUser.Id.ToString();

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }

            HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathon", Parameters, "Bearer", accesstoken);

            if (response.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }
            List <FacebookAccount> lstFacebookAccount = new List <FacebookAccount>();

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));
            List <FacebookAccount> facebookpages    = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));

            foreach (FacebookAccount item in facebookpages)
            {
                if (item != null)
                {
                    lstFacebookAccount.Add(item);
                }
            }
            if (lstFacebookAccount.Count > 0)
            {
                ViewBag.FbPages    = lstFacebookAccount;
                Session["FbPages"] = ViewBag.FbPages;
            }
            else
            {
                ViewBag.FbPages = null;
            }
            ViewBag.FbAccounts = facebookaccounts.Where(t => t.FbUserId != "").ToList();
            ViewBag.UserId     = objUser.Id;
            return(View());
        }
コード例 #7
0
        public async Task <ActionResult> Edit(string Id)
        {
            User   objuser     = (User)Session["User"];
            string accesstoken = string.Empty;

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >();
            List <FacebookAccount> lst = new List <FacebookAccount>();

            Shareathon sharethons = null;
            string     nameId     = "";

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetShareaton?Id=" + Id, "Bearer", accesstoken);

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

                nameId = sharethons.Facebookpageid;
                //foreach (var item in nameId)
                //{

                //    List<FacebookAccount> facebookaccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetFacebookAccountDetailsById(item), typeof(List<FacebookAccount>)));
                //    lst.Add(facebookaccount[0]);
                //}
            }
            List <FacebookAccount> lstFacebookAccount = new List <FacebookAccount>();
            List <FacebookAccount> facebookaccounts   = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getAllFacebookAccountsOfUser(objuser.Id.ToString()), typeof(List <FacebookAccount>)));
            List <FacebookAccount> lstpage            = facebookaccounts.Where(t => t.Type == "Page").ToList();
            List <FacebookAccount> lstaccount         = facebookaccounts.Where(t => t.Type == "account").ToList();

            ViewBag.UserId     = objuser.Id;
            ViewBag.FbAccounts = lstaccount.Where(t => t.FbUserId != "").ToList();
            foreach (FacebookAccount item in lstpage)
            {
                if (item != null)
                {
                    lstFacebookAccount.Add(item);
                }
            }
            if (lstFacebookAccount.Count > 0)
            {
                ViewBag.FbPages    = lstFacebookAccount;
                Session["FbPages"] = ViewBag.FbPages;
            }
            else
            {
                ViewBag.FbPages = null;
            }
            ViewBag.pageid = nameId;
            return(View(sharethons));
        }
コード例 #8
0
        public ActionResult EditProfileDetails(string ProfileId, string UserId, string Network)
        {
            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));
        }
コード例 #9
0
        public async Task <ActionResult> GroupShareathonEdit(string Id)
        {
            User   objuser     = (User)Session["User"];
            string accesstoken = string.Empty;

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List <KeyValuePair <string, string> > param = new List <KeyValuePair <string, string> >();
            List <KeyValuePair <string, string> > lst   = new List <KeyValuePair <string, string> >();

            ShareathonGroup sharethons = null;

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetGroupShareaton?Id=" + Id, "Bearer", accesstoken);

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

                //FacebookClient fb = new FacebookClient();
                //fb.AccessToken = sharethons.AccessToken;
                //System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
                //dynamic profile = fb.Get("v2.0/" + sharethons.Facebookgroupid + "?fields=id,name");
                //ViewBag.GroupId = (Convert.ToString(profile["id"]));
                //ViewBag.Groupname = (Convert.ToString(profile["name"]));
                string [] nameId = sharethons.Facebooknameid.Split(',');
                string    id     = "";
                for (int i = 0; i < nameId.Length; i++)
                {
                    string [] name = Regex.Split(nameId[i], "###");
                    id = name[0] + "," + id;
                    //lst.Add(new KeyValuePair<string,string>(nameId[i], name[1]));
                }
                ViewBag.GroupId = id;
                Api.Facebook.Facebook   ApiFacebook      = new Api.Facebook.Facebook();
                List <AddFacebookGroup> lstFacebookGroup = new List <AddFacebookGroup>();
                string fcebookgrp = ApiFacebook.GetAllFacebookGroups(sharethons.AccessToken);
                lstFacebookGroup = (List <AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(fcebookgrp, typeof(List <AddFacebookGroup>)));
                if (lstFacebookGroup.Count > 0)
                {
                    ViewBag.facebbokgroup = lstFacebookGroup;
                }
                else
                {
                    ViewBag.facebbokgroup = null;
                }
            }
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), Session["group"].ToString()), typeof(List <FacebookAccount>)));

            ViewBag.FbAccounts = facebookaccounts;
            ViewBag.UserId     = objuser.Id;
            ViewBag.Group      = lst;
            return(View(sharethons));
        }
コード例 #10
0
        public ActionResult EditProfileDetails(string ProfileId, string UserId, string Network)
        {
            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);
        }
コード例 #11
0
        public static Dictionary <string, Dictionary <List <object>, List <object> > > GetGroupsMenuAccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary <string, Dictionary <List <object>, List <object> > > _ReturnDicValue = new Dictionary <string, Dictionary <List <object>, List <object> > >();
            Dictionary <List <object>, List <object> > dic_profilessnap = new Dictionary <List <object>, List <object> >();
            List <object> socialaccounts = null;
            List <object> accountsgroup  = null;

            socialaccounts = new List <object>();
            accountsgroup  = new List <object>();

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> lstFacebookAccount = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));

            foreach (var FacebookAccount in lstFacebookAccount)
            {
                List <FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString());
                foreach (var FacebookGroup in lstFacebookGroup)
                {
                    accountsgroup.Add(FacebookGroup);
                }
                socialaccounts.Add(FacebookAccount);
            }
            dic_profilessnap.Add(socialaccounts, accountsgroup);
            _ReturnDicValue.Add("facebook", dic_profilessnap);

            dic_profilessnap = new Dictionary <List <object>, List <object> >();
            socialaccounts   = new List <object>();
            accountsgroup    = new List <object>();

            Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
            Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin();

            List <LinkedInAccount> lstLinkedinAccount = (List <LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <LinkedInAccount>)));

            foreach (var LinkedInAccount in lstLinkedinAccount)
            {
                //var testJsonStr= ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString());
                //List<LinkedInGroup> objLinkedInGroup = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LinkedInGroup>>(testJsonStr);


                List <LinkedInGroup.Group_Updates> objLinkedInGroup = (List <LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List <LinkedInGroup.Group_Updates>)));
                //Newtonsoft.Json.Linq.JObject obj = JObject.Parse(testJsonStr);

                foreach (var LinkedInGroup in objLinkedInGroup)
                {
                    accountsgroup.Add(LinkedInGroup);
                }
                socialaccounts.Add(LinkedInAccount);
            }
            dic_profilessnap.Add(socialaccounts, accountsgroup);
            _ReturnDicValue.Add("linkedin", dic_profilessnap);

            return(_ReturnDicValue);
        }
コード例 #12
0
        public ActionResult GroupCreate()
        {
            User objuser = (User)Session["User"];

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> facebookacoount = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));

            ViewBag.FbAccounts = facebookacoount;
            ViewBag.UserId     = objuser.Id;
            return(View());
        }
コード例 #13
0
        public async Task <ActionResult> EditGroup(ShareathonGroupViewModel shareathon)
        {
            string groupId = "";
            string nameId  = "";

            for (int i = 0; i < shareathon.FacebookGroupId.Length; i++)
            {
                string   dataid = shareathon.FacebookGroupId[i];
                string[] grpid  = Regex.Split(dataid, "###");
                groupId = grpid[0] + "," + groupId;
                nameId  = shareathon.FacebookGroupId[i] + "," + nameId;
            }
            User objUser = (User)Session["User"];
            List <KeyValuePair <string, string> > Parameters = new List <KeyValuePair <string, string> >();

            Parameters.Add(new KeyValuePair <string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("Id", shareathon.Id.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("Userid", objUser.Id.ToString()));
            Parameters.Add(new KeyValuePair <string, string>("FacebookPageUrl", shareathon.FacebookPageUrl));
            Parameters.Add(new KeyValuePair <string, string>("FacebookGroupId", groupId));
            Parameters.Add(new KeyValuePair <string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString()));
            string accesstoken = string.Empty;
            string UserId      = objUser.Id.ToString();

            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }

            HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathonGroup", Parameters, "Bearer", accesstoken);

            if (response.IsSuccessStatusCode)
            {
                return(RedirectToAction("GroupIndex"));
            }

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> facebookaccounts = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));
            List <FacebookAccount> facebookpages    = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));

            ViewBag.FbPages    = facebookpages;
            Session["FbPages"] = ViewBag.FbPages;
            ViewBag.FbAccounts = facebookaccounts;
            ViewBag.UserId     = objUser.Id;
            return(View());
        }
コード例 #14
0
        public ActionResult DeleteAccount()
        {
            string type      = Request.QueryString["profile"].ToString();
            string profileid = Request.QueryString["profileid"].ToString();

            Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];

            if (type == "fb")
            {
                Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
            }
            else if (type == "twt")
            {
                Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
            }
            else if (type == "linkedin")
            {
                Api.LinkedinAccount.LinkedinAccount apiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                apiobjLinkedinAccount.DeleteLinkedinAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
            }
            else if (type == "instagram")
            {
                Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
            }
            else if (type == "tumblr")
            {
                Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
            }
            else if (type == "youtube")
            {
                Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
            }
            return(Content("Deleted"));
        }
コード例 #15
0
        private static ISocialSiteAccount GetSocialAccountFromTeamMemberProfile(User objUser, Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile)
        {
            ISocialSiteAccount objSocialSiteAccount = null;

            if (objTeamMemberProfile.ProfileType == "facebook")
            {
                Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                objSocialSiteAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(FacebookAccount)));
            }
            else if (objTeamMemberProfile.ProfileType == "twitter")
            {
                Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                objSocialSiteAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(TwitterAccount)));
            }
            else if (objTeamMemberProfile.ProfileType == "linkedin")
            {
                Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                objSocialSiteAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(LinkedInAccount)));
            }
            else if (objTeamMemberProfile.ProfileType == "instagram")
            {
                Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                objSocialSiteAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(InstagramAccount)));
            }
            else if (objTeamMemberProfile.ProfileType == "youtube")
            {
                Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                objSocialSiteAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(YoutubeAccount)));
            }
            else if (objTeamMemberProfile.ProfileType == "tumblr")
            {
                Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                objSocialSiteAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(TumblrAccount)));
            }
            return(objSocialSiteAccount);
        }
コード例 #16
0
 public ActionResult GroupCreate()
 { 
     User objuser=(User)Session["User"];
     Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
     List<FacebookAccount> facebookacoount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
     ViewBag.FbAccounts = facebookacoount;
     ViewBag.UserId = objuser.Id;
     return View();
 }
コード例 #17
0
         public async Task<ActionResult> Edit(string Id)
         {
             User objuser = (User)Session["User"];
             string accesstoken = string.Empty;
             if (Session["access_token"] != null)
             {
                 accesstoken = Session["access_token"].ToString();
             }
             List<KeyValuePair<string, string>> param = new List<KeyValuePair<string, string>>();
             List<FacebookAccount> lst = new List<FacebookAccount>();

             Shareathon sharethons = null;
             string nameId ="";
             Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
             HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetShareaton?Id=" + Id, "Bearer", accesstoken);
             if (response.IsSuccessStatusCode)
             {
                 sharethons = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.Shareathon>();

                 nameId = sharethons.Facebookpageid;
                 //foreach (var item in nameId)
                 //{
             
                 //    List<FacebookAccount> facebookaccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetFacebookAccountDetailsById(item), typeof(List<FacebookAccount>)));
                 //    lst.Add(facebookaccount[0]);
                 //}

                

             }
             List<FacebookAccount> lstFacebookAccount = new List<FacebookAccount>();
             List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getAllFacebookAccountsOfUser(objuser.Id.ToString()), typeof(List<FacebookAccount>)));
             List<FacebookAccount> lstpage = facebookaccounts.Where(t => t.Type == "Page").ToList();
             List<FacebookAccount> lstaccount = facebookaccounts.Where(t=>t.Type=="account").ToList();
             ViewBag.UserId = objuser.Id;
             ViewBag.FbAccounts = lstaccount.Where(t => t.FbUserId != "").ToList();
             foreach (FacebookAccount item in lstpage)
             {
                 if (item != null)
                 {
                     lstFacebookAccount.Add(item);
                 }
             }
             if (lstFacebookAccount.Count > 0)
             {
                 ViewBag.FbPages = lstFacebookAccount;
                 Session["FbPages"] = ViewBag.FbPages;
             }
             else
             {
                 ViewBag.FbPages = null;
             }
             ViewBag.pageid = nameId;
             return View(sharethons);
         }
コード例 #18
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" || item.ProfileType == "facebook_page")
        //        {
        //            try
        //            {
        //                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>)));
        //                List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<FacebookFeed>)));

        //                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();
        //                //List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>)));
        //                List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(),"0","10"), typeof(List<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();
        //                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>)));
        //                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();
        //                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();
        //                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();
        //                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);
        //            }
        //            catch (Exception ex)
        //            {
        //                Console.WriteLine(ex.Message);
        //            }
        //        }

        //        if (item.ProfileType == "linkedincompanypage")
        //        {
        //            try
        //            {
        //                feeds = new List<object>();
        //                Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
        //                LinkedinCompanyPage objLinkedinCompanypage = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedinCompanyPage)));
        //                Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPagePost = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
        //                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);
        //            }
        //        }

        //    }
        //    return dic_profilessnap;
        //}
        public static Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> GetUserProfilesSnapsAccordingToGroup(List<Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile, int CountProfileSnapshot = 0)
        {
            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>>();

            int tempCount = 0;
            foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile)
            {
                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<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<FacebookFeed>)));

                        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<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<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; 
                        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);
                    }
                    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);
                    }
                }

            }
            return dic_profilessnap;
        }
コード例 #19
0
ファイル: SBUtils.cs プロジェクト: prog-moh/socioboard-core
        public static Dictionary<string, Dictionary<List<object>, List<object>>> GetGroupsMenuAccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary<string, Dictionary<List<object>, List<object>>> _ReturnDicValue = new Dictionary<string, Dictionary<List<object>, List<object>>>();
            Dictionary<List<object>, List<object>> dic_profilessnap = new Dictionary<List<object>, List<object>>();
            List<object> socialaccounts = null;
            List<object> accountsgroup = null;

            socialaccounts = new List<object>();
            accountsgroup = new List<object>();

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
            foreach (var FacebookAccount in lstFacebookAccount)
            {

                List<FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString());
                foreach (var FacebookGroup in lstFacebookGroup)
                {
                    accountsgroup.Add(FacebookGroup);
                }
                socialaccounts.Add(FacebookAccount);
            }
            dic_profilessnap.Add(socialaccounts, accountsgroup);
            _ReturnDicValue.Add("facebook", dic_profilessnap);

            dic_profilessnap = new Dictionary<List<object>, List<object>>();
            socialaccounts = new List<object>();
            accountsgroup = new List<object>();

            Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
            Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin();

            List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>)));
            foreach (var LinkedInAccount in lstLinkedinAccount)
            {
                //var testJsonStr= ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString());
                //List<LinkedInGroup> objLinkedInGroup = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LinkedInGroup>>(testJsonStr);


                List<LinkedInGroup.Group_Updates> objLinkedInGroup = (List<LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List<LinkedInGroup.Group_Updates>)));
                //Newtonsoft.Json.Linq.JObject obj = JObject.Parse(testJsonStr);

                foreach (var LinkedInGroup in objLinkedInGroup)
                {
                   

                    accountsgroup.Add(LinkedInGroup);
                    
                }
                 socialaccounts.Add(LinkedInAccount);
            }
            dic_profilessnap.Add(socialaccounts, accountsgroup);
            _ReturnDicValue.Add("linkedin", dic_profilessnap);

            return _ReturnDicValue;
        }
コード例 #20
0
        public ActionResult DeleteAccount()
        {

            string type = Request.QueryString["profile"].ToString();
            string profileid = Request.QueryString["profileid"].ToString();
            Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];

            // Edited By Antima[15/12/2014]
            string GroupId = Session["group"].ToString();
            Api.Team.Team objApiTeam = new Api.Team.Team();
            objApiTeam.Timeout = 300000;
            Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team)new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team));
            Guid AdminUserId = team.UserId;
            try
            {
                if (AdminUserId == objUser.Id)
                {
                    if (type == "fb")
                    {
                        Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                        ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "twt")
                    {
                        Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                        apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "linkedin")
                    {
                        Api.LinkedinAccount.LinkedinAccount apiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                        apiobjLinkedinAccount.DeleteLinkedinAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "instagram")
                    {
                        Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                        apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "tumblr")
                    {
                        Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                        apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "youtube")
                    {
                        Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                        apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "liComPage")
                    {
                        Api.LinkedinCompanyPage.LinkedinCompanyPage apiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                        apiobjLinkedinCompanyPage.DeleteLinkedinCompanyPage(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "gplus")
                    {
                        Api.GooglePlusAccount.GooglePlusAccount objGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                        objGooglePlusAccount.DeleteGplusAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                        
                    }
                    return Content("Deleted");
                }
                else
                {
                    return Content("Not Deleted");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return Content("Not Deleted");
            }
        }
コード例 #21
0
        public static Dictionary<Domain.Socioboard.Domain.GroupProfile, object> GetProfilesConnectedwithgroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary<Domain.Socioboard.Domain.GroupProfile, object> dict_TeamMember = new Dictionary<Domain.Socioboard.Domain.GroupProfile, object>();
            Api.GroupProfile.GroupProfile ApiobjGroupProfile = new Api.GroupProfile.GroupProfile();
            ApiobjGroupProfile.Timeout = 300000;
            List<Domain.Socioboard.Domain.GroupProfile> lstSocialProfile = (List<Domain.Socioboard.Domain.GroupProfile>)new JavaScriptSerializer().Deserialize(ApiobjGroupProfile.GetAllProfilesConnectedWithGroup(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["selectedgroupid"].ToString()), typeof(List<Domain.Socioboard.Domain.GroupProfile>));

            foreach (var item in lstSocialProfile)
            {
                try
                {
                    if (item.ProfileType == "facebook")
                    {
                        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)));
                        dict_TeamMember.Add(item, objFacebookAccount);
                    }
                    else if (item.ProfileType == "twitter")
                    {
                        Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                        ApiobjTwitterAccount.Timeout = 300000;
                        TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount)));
                        dict_TeamMember.Add(item, objTwitterAccount);
                    }
                    else if (item.ProfileType == "linkedin")
                    {
                        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)));
                        dict_TeamMember.Add(item, objLinkedInAccount);
                    }
                    else if (item.ProfileType == "instagram")
                    {
                        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)));
                        dict_TeamMember.Add(item, objInstagramAccount);
                    }
                    else if (item.ProfileType == "youtube")
                    {
                        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)));
                        dict_TeamMember.Add(item, objYoutubeAccount);
                    }
                    else if (item.ProfileType == "tumblr")
                    {
                        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)));
                        dict_TeamMember.Add(item, objTumblrAccount);
                    }
                    else if (item.ProfileType == "gplus")
                    {
                        Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                        ApiobjGooglePlusAccount.Timeout = 300000;
                        GooglePlusAccount objGplusAccount = (GooglePlusAccount)(new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(GooglePlusAccount)));
                        dict_TeamMember.Add(item, objGplusAccount);
                    }

                }
                catch (Exception ex)
                {

                    Console.WriteLine(ex.Message);
                    //return null;
                }
            }
            return dict_TeamMember;


        }
コード例 #22
0
ファイル: SBUtils.cs プロジェクト: prog-moh/socioboard-core
        public static List<Domain.Socioboard.Domain.FacebookAccount> GetUserTeamMemberFbProfiles()
        {

            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            string groupid = System.Web.HttpContext.Current.Session["group"].ToString();
            Api.FacebookAccount.FacebookAccount ApiFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List<Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMemberProfile = new List<Domain.Socioboard.Domain.TeamMemberProfile>();
            List<Domain.Socioboard.Domain.FacebookAccount> ret_lstFacebookProfile = new List<Domain.Socioboard.Domain.FacebookAccount>();
            Domain.Socioboard.Domain.FacebookAccount _FacebookAccount = new Domain.Socioboard.Domain.FacebookAccount();
         
            Api.Team.Team objApiTeam = new Api.Team.Team();
            objApiTeam.Timeout = 300000;
            JObject team = JObject.Parse(objApiTeam.GetTeamByGroupId(System.Web.HttpContext.Current.Session["group"].ToString()));

            Api.TeamMemberProfile.TeamMemberProfile objApiTeamMemberProfile = new Api.TeamMemberProfile.TeamMemberProfile();
            objApiTeamMemberProfile.Timeout = 300000;
            lstTeamMemberProfile = (List<Domain.Socioboard.Domain.TeamMemberProfile>)new JavaScriptSerializer().Deserialize(objApiTeamMemberProfile.GetTeamMemberProfilesByTeamId(Convert.ToString(team["Id"])), typeof(List<Domain.Socioboard.Domain.TeamMemberProfile>));

            foreach (Domain.Socioboard.Domain.TeamMemberProfile team_member in lstTeamMemberProfile)
            {
                _FacebookAccount = (Domain.Socioboard.Domain.FacebookAccount)new JavaScriptSerializer().Deserialize(ApiFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), team_member.ProfileId), typeof(Domain.Socioboard.Domain.FacebookAccount));
             
                if(team_member.ProfileType == "facebook_page" && !string.IsNullOrEmpty(_FacebookAccount.AccessToken))
                {
                    ret_lstFacebookProfile.Add(_FacebookAccount);
                }
            }
            return ret_lstFacebookProfile;
        
        }
コード例 #23
0
ファイル: SBUtils.cs プロジェクト: socioboard/socioboard-core
 public static List<Domain.Socioboard.Domain.FacebookAccount> GetProfilePageForShareathon()
 {
     List<Domain.Socioboard.Domain.FacebookAccount> lstobj = new List<Domain.Socioboard.Domain.FacebookAccount>();
     List<Domain.Socioboard.Domain.Shareathon> sharethons = new List<Domain.Socioboard.Domain.Shareathon>();
     Api.FacebookAccount.FacebookAccount _facebook = new Api.FacebookAccount.FacebookAccount();
     User objUser = (User)System.Web.HttpContext.Current.Session["User"];
     string accesstoken = string.Empty;
     string UserId = objUser.Id.ToString();
     string data = WebApiReq.GetShareathondata(ConfigurationManager.AppSettings["apiDomainName"] + "/API/ApiShareathon/ShareathonByUserId?UserId=" + UserId);
     sharethons = (List<Domain.Socioboard.Domain.Shareathon>)(new JavaScriptSerializer().Deserialize(data, typeof(List<Domain.Socioboard.Domain.Shareathon>)));
     foreach (var item in sharethons)
     {
         string facebookdata = _facebook.getFacebookAccountDetailsById(item.Userid.ToString(), item.Facebookaccountid);
         FacebookAccount fbaccount = (Domain.Socioboard.Domain.FacebookAccount)(new JavaScriptSerializer().Deserialize(facebookdata, typeof(Domain.Socioboard.Domain.FacebookAccount)));
         if (fbaccount!=null)
         {
             lstobj.Add(fbaccount); 
         }
     }
     return lstobj;
 }
コード例 #24
0
        private static ISocialSiteAccount GetSocialAccountFromTeamMemberProfile(Guid objUserid, Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile)
        {
            ISocialSiteAccount objSocialSiteAccount = null;

            if (objTeamMemberProfile.ProfileType == "facebook" || objTeamMemberProfile.ProfileType == "facebook_page")
            {
                using (Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount())
                {
                    ApiobjFacebookAccount.Timeout = 300000;
                    objSocialSiteAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUserid.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(FacebookAccount)));
                }
            }
            else if (objTeamMemberProfile.ProfileType == "twitter")
            {
                using (Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount())
                {

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

                }
            }
            else if (objTeamMemberProfile.ProfileType == "linkedin")
            {
                using (Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount())
                {

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

                }
            }
            else if (objTeamMemberProfile.ProfileType == "instagram")
            {
                using (Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount())
                {

                    ApiobjInstagramAccount.Timeout = 300000;
                    objSocialSiteAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUserid.ToString(), objTeamMemberProfile.ProfileId.ToString()), typeof(InstagramAccount)));

                }
            }
            else if (objTeamMemberProfile.ProfileType == "youtube")
            {
                using (Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount())
                {

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

                }
            }
            else if (objTeamMemberProfile.ProfileType == "tumblr")
            {
                using (Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount())
                {

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

                }
            }
            else if (objTeamMemberProfile.ProfileType == "linkedincompanypage")
            {
                using (Api.LinkedinCompanyPage.LinkedinCompanyPage objLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage())
                {

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

                }
            }
            else if (objTeamMemberProfile.ProfileType == "gplus")
            {
                using (Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount())
                {

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

                }
            }


            return objSocialSiteAccount;
        }
コード例 #25
0
ファイル: SBUtils.cs プロジェクト: prog-moh/socioboard-core
        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;
        }
コード例 #26
0
        public static Dictionary <string, List <object> > GetFeedsMenuAccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary <string, List <object> > dic_profilessnap = new Dictionary <string, List <object> >();

            List <object> socialaccounts = null;

            socialaccounts = new List <object>();
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List <FacebookAccount> lstFacebookAccount = (List <FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <FacebookAccount>)));

            foreach (var FacebookAccount in lstFacebookAccount)
            {
                socialaccounts.Add(FacebookAccount);
            }
            dic_profilessnap.Add("facebook", socialaccounts);

            socialaccounts = new List <object>();
            Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
            List <TwitterAccount>             lstTwitterAccount    = (List <TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <TwitterAccount>)));

            foreach (var TwitterAccount in lstTwitterAccount)
            {
                socialaccounts.Add(TwitterAccount);
            }
            dic_profilessnap.Add("twitter", socialaccounts);

            socialaccounts = new List <object>();
            Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
            List <LinkedInAccount> lstLinkedinAccount = (List <LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <LinkedInAccount>)));

            foreach (var LinkedInAccount in lstLinkedinAccount)
            {
                socialaccounts.Add(LinkedInAccount);
            }
            dic_profilessnap.Add("linkedin", socialaccounts);

            socialaccounts = new List <object>();
            Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
            List <InstagramAccount> lstInstagramAccount = (List <InstagramAccount>)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.GetAllInstagramAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <InstagramAccount>)));

            foreach (var InstagramAccount in lstInstagramAccount)
            {
                socialaccounts.Add(InstagramAccount);
            }
            dic_profilessnap.Add("instagram", socialaccounts);

            socialaccounts = new List <object>();
            Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
            List <TumblrAccount>            lstTumblrAccount    = (List <TumblrAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetAllTumblrAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <TumblrAccount>)));

            foreach (var TumblrAccount in lstTumblrAccount)
            {
                socialaccounts.Add(TumblrAccount);
            }
            dic_profilessnap.Add("tumblr", socialaccounts);

            socialaccounts = new List <object>();
            Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
            List <YoutubeAccount>             lstYoutubeAccount    = (List <YoutubeAccount>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetAllYoutubeAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List <YoutubeAccount>)));

            foreach (var YoutubeAccount in lstYoutubeAccount)
            {
                socialaccounts.Add(YoutubeAccount);
            }
            dic_profilessnap.Add("youtube", socialaccounts);



            return(dic_profilessnap);
        }
コード例 #27
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);
        }
コード例 #28
0
ファイル: SBUtils.cs プロジェクト: prog-moh/socioboard-core
        public static Dictionary<string, List<object>> GetFeedsMenuAccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary<string, List<object>> dic_profilessnap = new Dictionary<string, List<object>>();
               
            List<object> socialaccounts = null;
                
                    socialaccounts = new List<object>();
                    Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                    List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
                    foreach (var FacebookAccount in lstFacebookAccount)
                    {
                        socialaccounts.Add(FacebookAccount);
                    }
                    dic_profilessnap.Add("facebook", socialaccounts);
               
                    socialaccounts = new List<object>();
                    Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                    List<TwitterAccount> lstTwitterAccount = (List<TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TwitterAccount>)));
                    foreach (var TwitterAccount in lstTwitterAccount)
                    {
                        socialaccounts.Add(TwitterAccount);
                    }
                    dic_profilessnap.Add("twitter", socialaccounts);
               
                    socialaccounts = new List<object>();
                    Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                    List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>)));
                    foreach (var LinkedInAccount in lstLinkedinAccount)
                    {
                        socialaccounts.Add(LinkedInAccount);
                    }
                    dic_profilessnap.Add("linkedin", socialaccounts);
                
                    socialaccounts = new List<object>();
                    Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                    List<InstagramAccount> lstInstagramAccount = (List<InstagramAccount>)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.GetAllInstagramAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<InstagramAccount>)));
                    foreach (var InstagramAccount in lstInstagramAccount)
                    {
                        socialaccounts.Add(InstagramAccount);
                    }
                    dic_profilessnap.Add("instagram", socialaccounts);
                
                    socialaccounts = new List<object>();
                    Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                    List<TumblrAccount> lstTumblrAccount = (List<TumblrAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetAllTumblrAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TumblrAccount>)));
                    foreach (var TumblrAccount in lstTumblrAccount)
                    {
                        socialaccounts.Add(TumblrAccount);
                    }
                    dic_profilessnap.Add("tumblr", socialaccounts);
             
                    socialaccounts = new List<object>();
                    Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                    List<YoutubeAccount> lstYoutubeAccount = (List<YoutubeAccount>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetAllYoutubeAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<YoutubeAccount>)));
                    foreach (var YoutubeAccount in lstYoutubeAccount)
                    {
                        socialaccounts.Add(YoutubeAccount);
                    }
                    dic_profilessnap.Add("youtube", socialaccounts);
                

            
            return dic_profilessnap;
        }
コード例 #29
0
        public async Task<ActionResult> GroupShareathonEdit(string Id)
        {
            User objuser = (User)Session["User"];
            string accesstoken = string.Empty;
            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }
            List<KeyValuePair<string, string>> param = new List<KeyValuePair<string, string>>();
            List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>();

            ShareathonGroup sharethons = null;

            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiShareathon/GetGroupShareaton?Id=" + Id, "Bearer", accesstoken);
            if (response.IsSuccessStatusCode)
            {
                sharethons = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.ShareathonGroup>();
                    string [] nameId=sharethons.Facebooknameid.Split(',');
                    string id = "";
                    for (int i = 0; i < nameId.Length; i++)
			        {
                    string [] name=Regex.Split(nameId[i],"###");
                    id = name[0] + "," + id;
			         //lst.Add(new KeyValuePair<string,string>(nameId[i], name[1]));
			        }
                    ViewBag.GroupId = id;
                    Api.Facebook.Facebook ApiFacebook = new Api.Facebook.Facebook();
                    List<AddFacebookGroup> lstFacebookGroup = new List<AddFacebookGroup>();
                    string fcebookgrp = ApiFacebook.GetAllFacebookGroups(sharethons.AccessToken);
                    lstFacebookGroup = (List<AddFacebookGroup>)(new JavaScriptSerializer().Deserialize(fcebookgrp, typeof(List<AddFacebookGroup>)));
                    if (lstFacebookGroup.Count > 0)
                    {
                        ViewBag.facebbokgroup = lstFacebookGroup;
                    }
                    else { ViewBag.facebbokgroup = null; }
               
            }
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objuser.Id.ToString(), Session["group"].ToString()), typeof(List<FacebookAccount>)));
            ViewBag.FbAccounts = facebookaccounts.Where(t=>t.FbUserId!="").ToList();
            ViewBag.UserId = objuser.Id;
            ViewBag.Group = lst;
            return View(sharethons);
        }
コード例 #30
0
        //Edited by Sumit Gupta
        public ActionResult scheduler(string network, string profileid)
        {
            List<ScheduledMessage> objScheduledMessage = new List<ScheduledMessage>();
            //Dictionary<object, List<ScheduledMessage>> dictscheduler = new Dictionary<object, List<ScheduledMessage>>();
            Dictionary<string, List<object>> dictscheduler = new Dictionary<string, List<object>>();
            Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups();
            Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups)));
            if (network == "facebook")
            {
                Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(FacebookAccount)));
                Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
                objScheduledMessage = (List<ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List<ScheduledMessage>)));
                //dictscheduler.Add(objFacebookAccount, objScheduledMessage);
            }
            else if (network == "twitter")
            {
                Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(TwitterAccount)));
                Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
                objScheduledMessage = (List<ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List<ScheduledMessage>)));
                //dictscheduler.Add(objTwitterAccount, objScheduledMessage);
            }
            else if (network == "linkedin")
            {
                Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objGroups.UserId.ToString(), profileid.ToString()), typeof(LinkedInAccount)));
                Api.ScheduledMessage.ScheduledMessage ApiobjScheduledMessage = new Api.ScheduledMessage.ScheduledMessage();
                objScheduledMessage = (List<ScheduledMessage>)(new JavaScriptSerializer().Deserialize(ApiobjScheduledMessage.GetAllUnSentMessagesAccordingToGroup(objGroups.UserId.ToString(), profileid.ToString(), network), typeof(List<ScheduledMessage>)));
                //dictscheduler.Add(objLinkedInAccount, objScheduledMessage);
            }

            List<object> lstObject = new List<object>();
            foreach (var item in objScheduledMessage)
            {
                lstObject.Add(item);
            }

            dictscheduler.Add(network, lstObject);

            return PartialView("_Panel3Partial", dictscheduler);
        }
コード例 #31
0
ファイル: SBHelper.cs プロジェクト: zino974/socioboard-core
        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);
        }
コード例 #32
0
        public async Task<ActionResult> DeleteAccount()
        {

            string type = Request.QueryString["profile"].ToString();
            string profileid = Request.QueryString["profileid"].ToString();
            Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];

            // Edited By Antima[15/12/2014]
            string GroupId = Session["group"].ToString();
            //Api.Team.Team objApiTeam = new Api.Team.Team();
            //objApiTeam.Timeout = 300000;
            //Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team)new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team));
            //Guid AdminUserId = team.UserId;
            //string output = string.Empty;
            //HttpResponseMessage response1 = await WebApiReq.DelReq("api/ApiGroupProfiles/DeleteProfileFromGroup?profileid=" + profileid + "&groupid=" + GroupId + "&userid=" + objUser.Id+ "&profiletype="+type, "Bearer", Session["access_token"].ToString());
            //if (response1.IsSuccessStatusCode)
            //{
            //    output = await response1.Content.ReadAsAsync<string>();
            //}

            try
            {
                //if (output.Equals("Deleted"))
                //{
                    if (type == "fb")
                    {
                        Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                        ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(),"");
                    }
                    else if (type == "twt")
                    {
                        Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                        apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), "twitter");
                    }
                    else if (type == "linkedin")
                    {
                        string accesstoken = "";
                        string returndata = "";
                        List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
                        Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString()));
                        Parameters.Add(new KeyValuePair<string, string>("ProfileId", profileid));
                        Parameters.Add(new KeyValuePair<string, string>("GroupId", GroupId));
                        if (Session["access_token"] != null)
                        {
                            accesstoken = Session["access_token"].ToString();
                        }
                        HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/DeleteLinkedinAccount", Parameters, "Bearer", accesstoken);
                        if (response.IsSuccessStatusCode)
                        {
                            returndata = await response.Content.ReadAsAsync<string>();
                        }
                    }
                    else if (type == "instagram")
                    {
                        Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                        apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(),type);
                    }
                    else if (type == "tumblr")
                    {
                        Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                        apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "youtube")
                    {
                        Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                        apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), type);
                    }
                    else if (type == "liComPage")
                    {
                        string accesstoken = "";
                        string returndata = "";
                        List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
                        Parameters.Add(new KeyValuePair<string, string>("UserId", objUser.Id.ToString()));
                        Parameters.Add(new KeyValuePair<string, string>("ProfileId", profileid));
                        Parameters.Add(new KeyValuePair<string, string>("GroupId", GroupId));
                        if (Session["access_token"] != null)
                        {
                            accesstoken = Session["access_token"].ToString();
                        }
                        HttpResponseMessage response = await WebApiReq.PostReq("api/ApiLinkedIn/DeleteLinkedinCompanyPage", Parameters, "Bearer", accesstoken);
                        if (response.IsSuccessStatusCode)
                        {
                            returndata = await response.Content.ReadAsAsync<string>();
                        }
                    }
                    else if (type == "gplus")
                    {
                        Api.GooglePlusAccount.GooglePlusAccount objGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                        objGooglePlusAccount.DeleteGplusAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), "gplus");
                        
                    }
                    else if (type == "ga")
                    {
                        Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount();
                        ApiGoogleAnalyticsAccount.DeleteGoogelAnalyticsAccount(objUser.Id.ToString(), profileid, Session["group"].ToString(), "googleanalytics");

                    }
                    return Content("Deleted");
                //}
                //else
                //{
                //    return Content("Not Deleted");
                //}
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return Content("Not Deleted");
            }
        }
コード例 #33
0
ファイル: SBUtils.cs プロジェクト: socioboard/socioboard-core
        public static List<Domain.Socioboard.Helper.PluginProfile> GetProfilesForPlugin()
        {
            List<Domain.Socioboard.Helper.PluginProfile> lstobj = new List<Domain.Socioboard.Helper.PluginProfile>();

            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            // Dictionary<string, object> dict_TeamMember = new Dictionary<string, object>();
            Api.SocialProfile.SocialProfile ApiobjSocialProfile = new Api.SocialProfile.SocialProfile();
            List<Domain.Socioboard.Domain.SocialProfile> lstSocialProfile = (List<Domain.Socioboard.Domain.SocialProfile>)new JavaScriptSerializer().Deserialize(ApiobjSocialProfile.GetAllTwitterAndfacebookProfileOfUser(objUser.Id.ToString()), typeof(List<Domain.Socioboard.Domain.SocialProfile>));
            foreach (var item_socialProfiel in lstSocialProfile)
            {
                if (item_socialProfiel.ProfileType == "facebook" || item_socialProfiel.ProfileType == "facebook_page")
                {
                    Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                    FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item_socialProfiel.ProfileId.ToString()), typeof(FacebookAccount)));
                    if (objFacebookAccount != null)
                    {
                        if(!string.IsNullOrEmpty(objFacebookAccount.AccessToken))
                        {
                            Domain.Socioboard.Helper.PluginProfile _sb = new Domain.Socioboard.Helper.PluginProfile();
                            _sb.type = "facebook";
                            _sb.profile = objFacebookAccount;
                            lstobj.Add(_sb);
                        }
                    }
                    //dict_TeamMember.Add("facebook", objFacebookAccount);
                }
                else if (item_socialProfiel.ProfileType == "twitter")
                {
                    Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                    TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item_socialProfiel.ProfileId.ToString()), typeof(TwitterAccount)));

                    Domain.Socioboard.Helper.PluginProfile _sb = new Domain.Socioboard.Helper.PluginProfile();
                    _sb.type = "twitter";
                    _sb.profile = objTwitterAccount;
                    lstobj.Add(_sb);

                    //dict_TeamMember.Add("twitter", objTwitterAccount);
                }
            }

            return lstobj;
        }
コード例 #34
0
 public ActionResult BindFbPage()
 { 
     Domain.Socioboard.Domain.User _User=(Domain.Socioboard.Domain.User)Session["User"];
     Api.FacebookAccount.FacebookAccount ApiFacebookAccount = new Api.FacebookAccount.FacebookAccount();
     List<Domain.Socioboard.Domain.FacebookAccount> lstFacebookAccount=(List<Domain.Socioboard.Domain.FacebookAccount>)new JavaScriptSerializer().Deserialize(ApiFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(_User.Id.ToString(),Session["group"].ToString()),typeof(List<Domain.Socioboard.Domain.FacebookAccount>));
     return PartialView("_FBPagePartial", lstFacebookAccount);
 }
コード例 #35
0
        public static Dictionary<string, List<object>> GetReportsMenuAccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary<string, List<object>> dic_profilessnap = new Dictionary<string, List<object>>();
            List<object> socialaccounts = null;
            socialaccounts = new List<object>();
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            ApiobjFacebookAccount.Timeout = 300000;
            List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));

            foreach (var FacebookAccount in lstFacebookAccount)
            {
                socialaccounts.Add(FacebookAccount);

            }
            dic_profilessnap.Add("facebook", socialaccounts);

            socialaccounts = new List<object>();
            Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
            ApiobjTwitterAccount.Timeout = 300000;
            List<TwitterAccount> lstTwitterAccount = (List<TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TwitterAccount>)));
            foreach (var TwitterAccount in lstTwitterAccount)
            {
                socialaccounts.Add(TwitterAccount);
            }
            dic_profilessnap.Add("twitter", socialaccounts);
            return dic_profilessnap;
        }
コード例 #36
0
        public ActionResult Create() 
        {
            User objUser = (User)Session["User"];
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List<FacebookAccount> lstFacebookAccount = new List<FacebookAccount>();
            List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
            List<FacebookAccount> facebookpages = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
            foreach (FacebookAccount item in facebookpages)
            {
                if(item!=null)
                {
                    lstFacebookAccount.Add(item);
                }
            }
            if (lstFacebookAccount.Count>0)
            {
                ViewBag.FbPages = lstFacebookAccount;
                Session["FbPages"] = ViewBag.FbPages; 
            }
            else
            {
                ViewBag.FbPages = null;
            }
            ViewBag.FbAccounts = facebookaccounts.Where(t=>t.FbUserId!="").ToList();
            ViewBag.UserId = objUser.Id;

            return View();
        }
コード例 #37
0
        // vikash

        //public static string GetAllFacebookFancountofUser(string profileid, string userid)
        //{
        //    int _totalCount = 0;
        //    string TotalfanCount = string.Empty;
        //    try
        //    {
        //        Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
        //        List<FacebookAccount> lstAllFacebookAccountDetails = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountDetails(profileid, userid), typeof(List<FacebookAccount>)));
        //        foreach (FacebookAccount item in lstAllFacebookAccountDetails)
        //        {
        //            if (item.Type == "Page")
        //            {
        //                _totalCount += item.Friends;
        //            }
        //        }
        //        TotalfanCount = _totalCount.ToString();
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine(ex.Message);
        //    }
        //    return TotalfanCount;
        //}
        // vikash [02/12/2014]
        public static string GetAllFacebookFancountofUser(string profileid, string userid)
        {
            int _totalCount = 0;
            string TotalfanCount = string.Empty;
            try
            {
                Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                ApiobjFacebookAccount.Timeout = 300000;
                List<FacebookAccount> lstAllFacebookAccountDetails = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountDetails(profileid, userid), typeof(List<FacebookAccount>)));
                foreach (FacebookAccount item in lstAllFacebookAccountDetails)
                {
                    if (item.Type == "Page")
                    {
                        _totalCount += item.Friends;
                    }
                }
                if (_totalCount > 1000000)
                {
                    int r = _totalCount % 1000000;
                    int t = _totalCount / 1000000;
                    TotalfanCount = t.ToString() + "." + (r / 10000).ToString() + "M";
                }
                else if (_totalCount > 1000)
                {
                    int r = _totalCount % 1000;
                    int t = _totalCount / 1000;
                    TotalfanCount = t.ToString() + "." + (r / 100).ToString() + "K";
                }
                else
                {
                    TotalfanCount = _totalCount.ToString();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return TotalfanCount;
        }
コード例 #38
0
        public async Task<ActionResult> EditGroup(ShareathonGroupViewModel shareathon)
        {
            string groupId = "";
            string nameId = "";
            for (int i = 0; i < shareathon.FacebookGroupId.Length; i++)
            {
                string dataid = shareathon.FacebookGroupId[i];
                string[] grpid = Regex.Split(dataid, "###");
                groupId = grpid[0] + "," + groupId;
                nameId = shareathon.FacebookGroupId[i] + "," + nameId;
            }
            User objUser = (User)Session["User"];
            List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
            Parameters.Add(new KeyValuePair<string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("Id", shareathon.Id.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("Userid", objUser.Id.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("FacebookPageUrl", shareathon.FacebookPageUrl));
            Parameters.Add(new KeyValuePair<string, string>("FacebookGroupId", groupId));
            Parameters.Add(new KeyValuePair<string, string>("Facebooknameid", nameId));
            Parameters.Add(new KeyValuePair<string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString()));
            string accesstoken = string.Empty;
            string UserId = objUser.Id.ToString();
            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }

            HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathonGroup", Parameters, "Bearer", accesstoken);
            if (response.IsSuccessStatusCode)
            {
                return RedirectToAction("GroupIndex");
            }
            List<FacebookAccount> lstFacebookAccount = new List<FacebookAccount>();
            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
            List<FacebookAccount> facebookpages = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));

            foreach (FacebookAccount item in facebookpages)
            {
                if (item != null)
                {
                    lstFacebookAccount.Add(item);
                }
            }
            if (lstFacebookAccount.Count > 0)
            {
                ViewBag.FbPages = lstFacebookAccount;
                Session["FbPages"] = ViewBag.FbPages;
            }
            else
            {
                ViewBag.FbPages = null;
            }
            ViewBag.FbAccounts = facebookaccounts.Where(t => t.FbUserId != "").ToList();
            ViewBag.UserId = objUser.Id;
            return View();
        }
コード例 #39
0
        public static Dictionary<string, List<object>> GetFeedsMenuAccordingToGroup()
        {
            Dictionary<string, List<object>> dic_profilessnap = new Dictionary<string, List<object>>();
            try
            {
                User objUser = (User)System.Web.HttpContext.Current.Session["User"];
                Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups();
                ApiobjGroups.Timeout = 300000;
                Groups objGroups = (Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(System.Web.HttpContext.Current.Session["group"].ToString()), typeof(Groups)));
                List<object> socialaccounts = null;
                socialaccounts = new List<object>();
                Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                ApiobjFacebookAccount.Timeout = 300000; 
                List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
                foreach (var FacebookAccount in lstFacebookAccount)
                {
                    socialaccounts.Add(FacebookAccount);
                }
                dic_profilessnap.Add("facebook", socialaccounts);

                socialaccounts = new List<object>();
                Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                ApiobjTwitterAccount.Timeout = 300000;
                List<TwitterAccount> lstTwitterAccount = (List<TwitterAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetAllTwitterAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TwitterAccount>)));
                foreach (var TwitterAccount in lstTwitterAccount)
                {
                    socialaccounts.Add(TwitterAccount);
                }
                dic_profilessnap.Add("twitter", socialaccounts);

                socialaccounts = new List<object>();
                Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                ApiobjLinkedinAccount.Timeout = 300000;
                List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>)));
                foreach (var LinkedInAccount in lstLinkedinAccount)
                {
                    socialaccounts.Add(LinkedInAccount);
                }
                dic_profilessnap.Add("linkedin", socialaccounts);

                socialaccounts = new List<object>();
                Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                ApiobjLinkedinCompanyPage.Timeout = 300000;
                List<LinkedinCompanyPage> lstLinkedinCompanyPage = (List<LinkedinCompanyPage>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetAllLinkedinCompanyPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedinCompanyPage>)));
                foreach (var LiCompanyPage in lstLinkedinCompanyPage)
                {
                    socialaccounts.Add(LiCompanyPage);
                }
                dic_profilessnap.Add("linkedincompanypage", socialaccounts);


                socialaccounts = new List<object>();
                Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                ApiobjInstagramAccount.Timeout = 300000;
                List<InstagramAccount> lstInstagramAccount = (List<InstagramAccount>)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.GetAllInstagramAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<InstagramAccount>)));
                foreach (var InstagramAccount in lstInstagramAccount)
                {
                    socialaccounts.Add(InstagramAccount);
                }
                dic_profilessnap.Add("instagram", socialaccounts);

                socialaccounts = new List<object>();
                Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                ApiobjTumblrAccount.Timeout = 300000;
                List<TumblrAccount> lstTumblrAccount = (List<TumblrAccount>)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetAllTumblrAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<TumblrAccount>)));
                foreach (var TumblrAccount in lstTumblrAccount)
                {
                    socialaccounts.Add(TumblrAccount);
                }
                dic_profilessnap.Add("tumblr", socialaccounts);

                socialaccounts = new List<object>();
                Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                ApiobjYoutubeAccount.Timeout = 300000;
                List<YoutubeAccount> lstYoutubeAccount = (List<YoutubeAccount>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetAllYoutubeAccountsByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<YoutubeAccount>)));
                foreach (var YoutubeAccount in lstYoutubeAccount)
                {
                    socialaccounts.Add(YoutubeAccount);
                }
                dic_profilessnap.Add("youtube", socialaccounts);

                socialaccounts = new List<object>();
                Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                ApiobjGooglePlusAccount.Timeout = 300000;
                List<GooglePlusAccount> lstGooglePlusAccount = (List<GooglePlusAccount>)(new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetAllBloggerAccountByUserIdAndGroupId(objGroups.UserId.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<GooglePlusAccount>)));
                foreach (var _GooglePlusAccount in lstGooglePlusAccount)
                {
                    socialaccounts.Add(_GooglePlusAccount);
                }
                dic_profilessnap.Add("gplus", socialaccounts);
            }
            catch (Exception ex)
            {
                logger.Error(ex.StackTrace);
                logger.Error(ex.Message);
            }
            return dic_profilessnap;
        }
コード例 #40
0
        public ActionResult DeleteAccount()
        {
            string type      = Request.QueryString["profile"].ToString();
            string profileid = Request.QueryString["profileid"].ToString();

            Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"];

            // Edited By Antima[15/12/2014]
            string GroupId = Session["group"].ToString();

            Api.Team.Team objApiTeam = new Api.Team.Team();
            objApiTeam.Timeout = 300000;
            Domain.Socioboard.Domain.Team team = (Domain.Socioboard.Domain.Team) new JavaScriptSerializer().Deserialize(objApiTeam.GetTeamByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Team));
            Guid AdminUserId = team.UserId;

            try
            {
                if (AdminUserId == objUser.Id)
                {
                    if (type == "fb")
                    {
                        Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
                        ApiobjFacebookAccount.DeleteFacebookAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "twt")
                    {
                        Api.TwitterAccount.TwitterAccount apiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount();
                        apiobjTwitterAccount.DeleteTwitterAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "linkedin")
                    {
                        Api.LinkedinAccount.LinkedinAccount apiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
                        apiobjLinkedinAccount.DeleteLinkedinAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "instagram")
                    {
                        Api.InstagramAccount.InstagramAccount apiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount();
                        apiobjInstagramAccount.DeleteInstagramAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "tumblr")
                    {
                        Api.TumblrAccount.TumblrAccount apiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount();
                        apiobjTumblrAccount.DeleteTumblrAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "youtube")
                    {
                        Api.YoutubeAccount.YoutubeAccount apiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount();
                        apiobjYoutubeAccount.DeleteYoutubeAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "liComPage")
                    {
                        Api.LinkedinCompanyPage.LinkedinCompanyPage apiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage();
                        apiobjLinkedinCompanyPage.DeleteLinkedinCompanyPage(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    else if (type == "gplus")
                    {
                        Api.GooglePlusAccount.GooglePlusAccount objGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount();
                        objGooglePlusAccount.DeleteGplusAccount(objUser.Id.ToString(), profileid, Session["group"].ToString());
                    }
                    return(Content("Deleted"));
                }
                else
                {
                    return(Content("Not Deleted"));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(Content("Not Deleted"));
            }
        }
コード例 #41
0
        //public static Dictionary<string, Dictionary<List<object>, List<object>>> GetGroupsMenuAccordingToGroup()
        //{
        //    User objUser = (User)System.Web.HttpContext.Current.Session["User"];
        //    Dictionary<string, Dictionary<List<object>, List<object>>> _ReturnDicValue = new Dictionary<string, Dictionary<List<object>, List<object>>>();
        //    Dictionary<List<object>, List<object>> dic_profilessnap = new Dictionary<List<object>, List<object>>();
        //    List<object> socialaccounts = null;
        //    List<object> accountsgroup = null;
        //    socialaccounts = new List<object>();
        //    accountsgroup = new List<object>();


        //    Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
        //    List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
        //    foreach (var FacebookAccount in lstFacebookAccount)
        //    {


        //        List<FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString());

        //        if (lstFacebookGroup == null || lstFacebookGroup.Count==0)
        //        {
        //            accountsgroup.Add(null);

        //        }
        //        foreach (var FacebookGroup in lstFacebookGroup)
        //        {
        //            accountsgroup.Add(FacebookGroup);
        //        }
        //        socialaccounts.Add(FacebookAccount);
        //    }
        //    dic_profilessnap.Add(socialaccounts, accountsgroup);
        //    _ReturnDicValue.Add("facebook", dic_profilessnap);

        //    dic_profilessnap = new Dictionary<List<object>, List<object>>();
        //    socialaccounts = new List<object>();
        //    accountsgroup = new List<object>();

        //    Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
        //    Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin();

        //    List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>)));
        //    foreach (var LinkedInAccount in lstLinkedinAccount)
        //    {
        //        //var testJsonStr= ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString());
        //        //List<LinkedInGroup> objLinkedInGroup = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LinkedInGroup>>(testJsonStr);


        //        List<LinkedInGroup.Group_Updates> objLinkedInGroup = (List<LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List<LinkedInGroup.Group_Updates>)));
        //        //Newtonsoft.Json.Linq.JObject obj = JObject.Parse(testJsonStr);

        //        foreach (var LinkedInGroup in objLinkedInGroup)
        //        {


        //            accountsgroup.Add(LinkedInGroup);

        //        }
        //        socialaccounts.Add(LinkedInAccount);
        //    }
        //    dic_profilessnap.Add(socialaccounts, accountsgroup);
        //    _ReturnDicValue.Add("linkedin", dic_profilessnap);

        //    return _ReturnDicValue;
        //}

        public static Dictionary<string, Dictionary<object, List<object>>> GetGroupsMenuAccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Dictionary<string, Dictionary<object, List<object>>> _ReturnDicValue = new Dictionary<string, Dictionary<object, List<object>>>();
            Dictionary<object, List<object>> dic_profilessnap = new Dictionary<object, List<object>>();
            object socialaccounts = null;

            List<object> accountsgroup = null;
            socialaccounts = new object();


            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            ApiobjFacebookAccount.Timeout = 300000;
            List<FacebookAccount> lstFacebookAccount = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
            foreach (var FacebookAccount in lstFacebookAccount)
            {
                accountsgroup = new List<object>();
                List<FacebookGroup> lstFacebookGroup = GetGroupName(FacebookAccount.AccessToken.ToString());

                foreach (var FacebookGroup in lstFacebookGroup)
                {
                    accountsgroup.Add(FacebookGroup);
                }
                socialaccounts = (object)FacebookAccount;
                dic_profilessnap.Add(socialaccounts, accountsgroup);
            }
            _ReturnDicValue.Add("facebook", dic_profilessnap);

            dic_profilessnap = new Dictionary<object, List<object>>();
            socialaccounts = new object();
            accountsgroup = new List<object>();

            Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount();
            ApiobjLinkedinAccount.Timeout = 300000;
            Api.Linkedin.Linkedin ApiobjLinkedin = new Api.Linkedin.Linkedin();

            List<LinkedInAccount> lstLinkedinAccount = (List<LinkedInAccount>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetAllLinkedinAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<LinkedInAccount>)));
            foreach (var LinkedInAccount in lstLinkedinAccount)
            {
                accountsgroup = new List<object>();
                List<LinkedInGroup.Group_Updates> objLinkedInGroup = (List<LinkedInGroup.Group_Updates>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedin.GetLinkedGroupsDetail(LinkedInAccount.LinkedinUserId.ToString(), LinkedInAccount.UserId.ToString()), typeof(List<LinkedInGroup.Group_Updates>)));

                foreach (var LinkedInGroup in objLinkedInGroup)
                {
                    accountsgroup.Add(LinkedInGroup);
                }
                socialaccounts = (object)LinkedInAccount;
                dic_profilessnap.Add(socialaccounts, accountsgroup);
            }

            _ReturnDicValue.Add("linkedin", dic_profilessnap);

            return _ReturnDicValue;
        }
コード例 #42
0
        public async Task<ActionResult> Edit(ShareathonViewModel shareathon)
        {

            string id = "";
            for (int i = 0; i < shareathon.FacebookPageId.Length; i++)
            {
                string dataid = shareathon.FacebookPageId[i];
                id = dataid + "," + id;
            }
            User objUser = (User)Session["User"];
            List<KeyValuePair<string, string>> Parameters = new List<KeyValuePair<string, string>>();
            Parameters.Add(new KeyValuePair<string, string>("Id", shareathon.Id.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("Facebookaccountid", shareathon.Facebookaccountid.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("Userid", objUser.Id.ToString()));
            Parameters.Add(new KeyValuePair<string, string>("Facebookpageid", id.TrimEnd(',')));
            Parameters.Add(new KeyValuePair<string, string>("Timeintervalminutes", shareathon.Timeintervalminutes.ToString()));
            string accesstoken = string.Empty;
            string UserId = objUser.Id.ToString();
            if (Session["access_token"] != null)
            {
                accesstoken = Session["access_token"].ToString();
            }

            HttpResponseMessage response = await WebApiReq.PostReq("api/ApiShareathon/EditShareathon", Parameters, "Bearer", accesstoken);
            if (response.IsSuccessStatusCode)
            {
                return RedirectToAction("Index");
            }

            Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount();
            List<FacebookAccount> facebookaccounts = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookAccountsByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));
            List<FacebookAccount> facebookpages = (List<FacebookAccount>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.GetAllFacebookPageByUserIdAndGroupId(objUser.Id.ToString(), System.Web.HttpContext.Current.Session["group"].ToString()), typeof(List<FacebookAccount>)));

            ViewBag.FbPages = facebookpages;
            Session["FbPages"] = ViewBag.FbPages;
            ViewBag.FbAccounts = facebookaccounts;
            ViewBag.UserId = objUser.Id;
            return View();
        }