Пример #1
0
        public static Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object> GetUserProfilesccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups();
            ApiobjGroups.Timeout = 300000;
            //ApiobjGroups.GetGroupDetailsByGroupId
            Groups objGroups = (Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(System.Web.HttpContext.Current.Session["group"].ToString()), typeof(Groups)));
            Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object> dict_TeamMember = new Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object>();
            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;
            JArray TeamMemberProfiles = JArray.Parse(objApiTeamMemberProfile.GetTeamMemberProfilesByTeamId(Convert.ToString(team["Id"])));
            foreach (var item in TeamMemberProfiles)
            {
                try
                {
                    Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = GetTeamMemberProfileFromJObject(item);

                    ISocialSiteAccount objISocialSiteAccount = GetSocialAccountFromTeamMemberProfile(objGroups.UserId, objTeamMemberProfile);
                    SocialSiteAccountFactory objSocialSiteAccountFactory = new SocialSiteAccountFactory(objTeamMemberProfile.ProfileType);
                    dict_TeamMember.Add(objTeamMemberProfile, objISocialSiteAccount);
                }
                catch (Exception ex)
                {

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


        }
Пример #2
0
        public static async Task<Dictionary<Domain.Socioboard.Domain.GroupProfile, object>> GetGroupProfiles() 
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            string groupId = System.Web.HttpContext.Current.Session["group"].ToString();
            string accesstoken = string.Empty;
            try {
                accesstoken = System.Web.HttpContext.Current.Session["access_token"].ToString();
            }
            catch { }

            Groups objGroups = null;
            HttpResponseMessage response1 = await WebApiReq.GetReq("api/ApiGroups/GetGroupDetailsByGroupId?GroupId=" + groupId, "Bearer", accesstoken);
            if (response1.IsSuccessStatusCode)
            {
                objGroups = await response1.Content.ReadAsAsync<Domain.Socioboard.Domain.Groups>();
            }



            IEnumerable<GroupProfile> lstGroupProfiles = new List<GroupProfile>();
           
                HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGroupProfiles/GetGroupProfiles?GroupId=" + groupId, "Bearer", accesstoken);
                if (response.IsSuccessStatusCode)
                {
                    lstGroupProfiles = await response.Content.ReadAsAsync<IEnumerable<Domain.Socioboard.Domain.GroupProfile>>();
                }
          
            Dictionary<Domain.Socioboard.Domain.GroupProfile, object> dictGroupProfiles = new Dictionary<Domain.Socioboard.Domain.GroupProfile, object>();

            foreach (var profile in lstGroupProfiles) 
            {
                ISocialSiteAccount objISocialSiteAccount = await GetSocialAccountFromGroupProfile(objGroups.UserId, profile);
                SocialSiteAccountFactory objSocialSiteAccountFactory = new SocialSiteAccountFactory(profile.ProfileType);
                dictGroupProfiles.Add(profile, objISocialSiteAccount);
            }

            return dictGroupProfiles;
        }
Пример #3
0
        public static async Task<Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object>> GetUserProfilesccordingToGroup()
        {
            User objUser = (User)System.Web.HttpContext.Current.Session["User"];
            Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups();
           // ApiobjGroups.Timeout = 300000;
            //ApiobjGroups.GetGroupDetailsByGroupId
            //Groups objGroups = (Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(System.Web.HttpContext.Current.Session["group"].ToString()), typeof(Groups)));
            Groups objGroups = null;
            HttpResponseMessage response = await WebApiReq.GetReq("api/ApiGroups/GetGroupDetailsByGroupId?GroupId=" + System.Web.HttpContext.Current.Session["group"].ToString(), "Bearer", System.Web.HttpContext.Current.Session["access_token"].ToString());
            if (response.IsSuccessStatusCode)
            {
                objGroups = await response.Content.ReadAsAsync<Domain.Socioboard.Domain.Groups>();
            }



            Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object> dict_TeamMember = new Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object>();

            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;
            //JArray TeamMemberProfiles = JArray.Parse(objApiTeamMemberProfile.GetTeamMemberProfilesByTeamId(Convert.ToString(team["Id"])));

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

            //foreach (var item in TeamMemberProfiles)
            //{
            //    try
            //    {
            //        Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = GetTeamMemberProfileFromJObject(item);

            //        ISocialSiteAccount objISocialSiteAccount = GetSocialAccountFromTeamMemberProfile(objGroups.UserId, objTeamMemberProfile);
            //        SocialSiteAccountFactory objSocialSiteAccountFactory = new SocialSiteAccountFactory(objTeamMemberProfile.ProfileType);
            //        dict_TeamMember.Add(objTeamMemberProfile, objISocialSiteAccount);
            //    }
            //    catch (Exception ex)
            //    {

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

            foreach (Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile in lstTeamMemberProfiles)
            {
                try
                {
                    ISocialSiteAccount objISocialSiteAccount = GetSocialAccountFromTeamMemberProfile(objGroups.UserId, objTeamMemberProfile);
                    SocialSiteAccountFactory objSocialSiteAccountFactory = new SocialSiteAccountFactory(objTeamMemberProfile.ProfileType);
                    dict_TeamMember.Add(objTeamMemberProfile, objISocialSiteAccount);
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
            return dict_TeamMember;


        }