public string AddInstagramAccountFromInstaBoard(string UserId, string GroupId, string ProfileId, string AccessToken, string FriendsCount, string Name, string EmailId, string ProfilePicUrl, string TotalImage, string Followers, string Followings) { if (objUserRepository.IsUserExist(Guid.Parse(UserId))) { if (!objInstagramAccountRepository.checkInstagramUserExists(objInstagramAccount.InstagramId, Guid.Parse(UserId))) { objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); objInstagramAccount.Id = Guid.NewGuid(); objInstagramAccount.InstagramId = ProfileId; objInstagramAccount.InsUserName = Name; objInstagramAccount.IsActive = true; objInstagramAccount.ProfileUrl = ProfilePicUrl; objInstagramAccount.TotalImages = Int32.Parse(TotalImage); objInstagramAccount.Followers = Int32.Parse(Followers); objInstagramAccount.FollowedBy = Int32.Parse(Followings); objInstagramAccount.UserId = Guid.Parse(UserId); objInstagramAccountRepository.addInstagramUser(objInstagramAccount); #region Add TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); if (objTeamMemberProfileRepository.checkTeamMemberProfile(objTeam.Id, ProfileId)) { objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.Status = 1; objTeamMemberProfile.ProfileType = "instagram"; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfile.ProfileId = ProfileId; objTeamMemberProfile.ProfilePicUrl = ProfilePicUrl; objTeamMemberProfile.ProfileName = Name; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); } #endregion #region SocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.ProfileType = "instagram"; objSocialProfile.ProfileId = ProfileId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; #endregion #region Add SocialProfile if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } #endregion return("account added"); } else { return("account already exist"); } } else { return("user not exist"); } }
public IHttpActionResult GetInstagramAccount(string ProfileId) { Domain.Socioboard.Domain.InstagramAccount objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); try { objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(ProfileId); return(Ok(objInstagramAccount)); } catch (Exception ex) { logger.Error(ex.Message); logger.Error(ex.StackTrace); return(BadRequest("Please Try Again")); } }
public IHttpActionResult GetInstagramAccount(string ProfileId) { Domain.Socioboard.Domain.InstagramAccount objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); try { objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(ProfileId); return Ok(objInstagramAccount); } catch (Exception ex) { logger.Error(ex.Message); logger.Error(ex.StackTrace); return BadRequest("Please Try Again"); } }
public string UserInformation(string UserId, string LinkedinId) { try { Guid Userid = Guid.Parse(UserId); objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); objInstagramAccount = objLinkedInAccountRepository.getInstagramAccountDetailsById(LinkedinId, Userid); return(new JavaScriptSerializer().Serialize(objInstagramAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new JavaScriptSerializer().Serialize("Please Try Again")); } }
public string GetInstaAccountById(string profileid) { Domain.Socioboard.Domain.InstagramAccount _InstaAccount = new Domain.Socioboard.Domain.InstagramAccount(); using (NHibernate.ISession session = SessionFactory.GetNewSession()) { try { NHibernate.IQuery querry = session.CreateQuery("from InstagramAccount i where i.InstagramId = : id").SetParameter("id", profileid); _InstaAccount = (Domain.Socioboard.Domain.InstagramAccount)querry.UniqueResult(); } catch (Exception e) { logger.Error(e.Message); logger.Error(e.StackTrace); } } return new JavaScriptSerializer().Serialize(_InstaAccount); }
public string UserInformation(string UserId, string InstagramId) { objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); try { Guid Userid = Guid.Parse(UserId); if (objInstagramAccountRepository.checkInstagramUserExists(InstagramId, Guid.Parse(UserId))) { objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId, Userid); } else { objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId); } return(new JavaScriptSerializer().Serialize(objInstagramAccount)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(new JavaScriptSerializer().Serialize("Please Try Again")); } }
public string UserInformation(string UserId, string InstagramId) { objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); try { Guid Userid = Guid.Parse(UserId); if (objInstagramAccountRepository.checkInstagramUserExists(InstagramId, Guid.Parse(UserId))) { objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId, Userid); } else { objInstagramAccount = objInstagramAccountRepository.getInstagramAccountDetailsById(InstagramId); } return new JavaScriptSerializer().Serialize(objInstagramAccount); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return new JavaScriptSerializer().Serialize("Please Try Again"); } }
public string InstagramUserDetail(string profileid) { List<Domain.Socioboard.Domain.InstagramUserDetails> userdetails = new List<Domain.Socioboard.Domain.InstagramUserDetails>(); Domain.Socioboard.Domain.InstagramUserDetails userdetail = new Domain.Socioboard.Domain.InstagramUserDetails(); using (NHibernate.ISession session = SessionFactory.GetNewSession()) { try { userdetails = session.CreateQuery("from InstagramUserDetails i where i.Profile_Id = : Profileid order by Created_Time desc").SetParameter("Profileid", profileid).List<Domain.Socioboard.Domain.InstagramUserDetails>().ToList(); userdetail = userdetails.First(); } catch (Exception e) { try { List<Domain.Socioboard.Domain.InstagramAccount> lstAccount = new List<Domain.Socioboard.Domain.InstagramAccount>(); Domain.Socioboard.Domain.InstagramAccount _Account = new Domain.Socioboard.Domain.InstagramAccount(); lstAccount = session.CreateQuery("from InstagramAccount i where i.InstagramId = : Profileid").SetParameter("Profileid", profileid).List<Domain.Socioboard.Domain.InstagramAccount>().ToList(); _Account = lstAccount.First(); userdetail.Profile_Id = _Account.InstagramId; userdetail.Insta_Name = _Account.InsUserName; userdetail.Full_Name = _Account.InsUserName; userdetail.Follower = _Account.Followers.ToString(); userdetail.Following = _Account.FollowedBy.ToString(); userdetail.Created_Time = DateTime.Now; userdetail.Media_Count = _Account.TotalImages.ToString(); } catch { } logger.Error(e.Message); logger.Error(e.StackTrace); } } return new JavaScriptSerializer().Serialize(userdetail); }
public string AddInstagramAccountFromInstaBoard(string UserId, string GroupId, string ProfileId, string AccessToken, string FriendsCount, string Name, string EmailId,string ProfilePicUrl, string TotalImage, string Followers, string Followings) { if (objUserRepository.IsUserExist(Guid.Parse(UserId))) { if (!objInstagramAccountRepository.checkInstagramUserExists(objInstagramAccount.InstagramId, Guid.Parse(UserId))) { objInstagramAccount = new Domain.Socioboard.Domain.InstagramAccount(); objInstagramAccount.Id = Guid.NewGuid(); objInstagramAccount.InstagramId = ProfileId; objInstagramAccount.InsUserName = Name; objInstagramAccount.IsActive = true; objInstagramAccount.ProfileUrl = ProfilePicUrl; objInstagramAccount.TotalImages = Int32.Parse(TotalImage); objInstagramAccount.Followers = Int32.Parse(Followers); objInstagramAccount.FollowedBy = Int32.Parse(Followings); objInstagramAccount.UserId = Guid.Parse(UserId); objInstagramAccountRepository.addInstagramUser(objInstagramAccount); #region Add TeamMemberProfile Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId)); Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile(); if (objTeamMemberProfileRepository.checkTeamMemberProfile(objTeam.Id, ProfileId)) { objTeamMemberProfile.Id = Guid.NewGuid(); objTeamMemberProfile.TeamId = objTeam.Id; objTeamMemberProfile.Status = 1; objTeamMemberProfile.ProfileType = "instagram"; objTeamMemberProfile.StatusUpdateDate = DateTime.Now; objTeamMemberProfile.ProfileId = ProfileId; objTeamMemberProfile.ProfilePicUrl = ProfilePicUrl; objTeamMemberProfile.ProfileName = Name; objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile); } #endregion #region SocialProfile Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile(); objSocialProfile.Id = Guid.NewGuid(); objSocialProfile.ProfileType = "instagram"; objSocialProfile.ProfileId = ProfileId; objSocialProfile.UserId = Guid.Parse(UserId); objSocialProfile.ProfileDate = DateTime.Now; objSocialProfile.ProfileStatus = 1; #endregion #region Add SocialProfile if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile)) { objSocialProfilesRepository.addNewProfileForUser(objSocialProfile); } #endregion return "account added"; } else { return "account already exist"; } } else { return "user not exist"; } }