public ActionResult UserAccount(string id) { CompleteProfile myProfile = (CompleteProfile ) Session["myProfile"]; UserAccountViewModel accountRetrieved = UserAccountService.GetUserAccountByKey(id); UserAccountView accountView = new UserAccountView(); accountView.Profile = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = accountRetrieved.Profile.BasicProfile.ReferenceKey , AccountType = AccountType.UserAccount }, FullName= accountRetrieved.Profile.FullName , Description1=accountRetrieved.Profile.Description1 , Description2=accountRetrieved.Profile.Description2 }; accountView.EmailOfThisProfile = accountRetrieved.Email; accountView.FoldersOfThisProfile = new Dictionary<string, string>(); accountView.WallOfThisProfile = new ContentStreamView(); accountView.WallOfThisProfile.Posts = new List<PostView>(); accountView.WallOfThisProfile.Tweets = new List<TweetView>(); accountView.WallOfThisProfile.Retweets = new List<RetweetView>(); if (User.Identity.Name == accountRetrieved.Email) { accountView.IsThisMyOwnProfile = true; } else { FriendshipStateInfoViewModel friendship = UserAccountService.GetFriendshipBetweenUserAccountsByKeys(myProfile.BasicProfile.ReferenceKey.ToString() , accountRetrieved.Profile.BasicProfile.ReferenceKey ); switch (friendship.FriendshipAction) { case FriendshipAction.Accept : accountView.ShowFriendshipButtonForThisProfile = true; accountView.EnableFriendshipButtonForThisProfile = true; accountView.IsThisProfileAFriendOfMine = true; accountView.FriendshipButtonActionNameForThisProfile = "CancelFriendshipWith"; accountView.FriendshipButtonControllerNameForThisProfile = "UserAccounts"; accountView.FriendshipButtonCaptionForThisProfile = "Cancel Friendship"; break; case FriendshipAction.Request : if (friendship.Sender.BasicProfile.ReferenceKey == myProfile.BasicProfile.ReferenceKey.ToString()) { //if the viewer is the one that sent the request accountView.ShowFriendshipButtonForThisProfile = true; accountView.EnableFriendshipButtonForThisProfile = false; accountView.isWaitingForFriendshipResponse = true; accountView.FriendshipButtonActionNameForThisProfile = "CancelRequestTo"; accountView.FriendshipButtonControllerNameForThisProfile = "UserAccounts"; accountView.FriendshipButtonCaptionForThisProfile = "Cancel Request"; } else { //if the viewer is the one that received the request accountView.ShowFriendshipButtonForThisProfile = true; accountView.EnableFriendshipButtonForThisProfile = false; accountView.FriendshipButtonActionNameForThisProfile = "Null"; accountView.FriendshipButtonControllerNameForThisProfile = "Null"; accountView.FriendshipButtonCaptionForThisProfile = "Request Received"; } break; //case Domain.Friendships.States.FriendshipAction.New : //case Domain.Friendships.States.FriendshipAction.Cancel : //case Domain.Friendships.States.FriendshipAction.Reject : default : accountView.ShowFriendshipButtonForThisProfile = true; accountView.EnableFriendshipButtonForThisProfile = true; accountView.FriendshipButtonActionNameForThisProfile = "RequestFriendshipTo"; accountView.FriendshipButtonControllerNameForThisProfile = "UserAccounts"; accountView.FriendshipButtonCaptionForThisProfile = "Send Request"; break; } } var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString(); ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamAsProfileWall(id,thisViewerKey); if (wallRetrieved.Posts.Count>0) { if (wallRetrieved.Posts != null) { accountView.WallOfThisProfile.Posts = new List<PostView>(); foreach (PostViewModel post in wallRetrieved.Posts) { PostView thisPost = new PostView(); thisPost.Key = post.Key; thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=post.Author.BasicProfile.ReferenceKey , AccountType=post.Author.BasicProfile.AccountType }, FullName= post.Author.FullName , Description1= post.Author.Description1 , Description2= post.Author.Description2 }; thisPost.Text = post.Text; thisPost.PublishDateTime = post.PublishDateTime; thisPost.Likes = post.Likes; thisPost.ILikedIt = post.ILikedIt; thisPost.Comments = new List<CommentView>(); foreach (CommentViewModel comment in post.Comments) { CommentView thisComment = new CommentView(); thisComment.Key = comment.Key; thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 }; thisComment.Text = comment.Text; thisComment.ILikedIt = comment.ILikedIt; thisComment.PublishDateTime = comment.PublishDateTime; thisComment.Likes = comment.Likes; thisPost.Comments.Add(thisComment); } accountView.WallOfThisProfile.Posts.Add(thisPost); } } } if (wallRetrieved.Tweets.Count > 0) { foreach (TweetViewModel tweet in wallRetrieved.Tweets) { TweetView thisTweet = new TweetView(); thisTweet.Key = tweet.Key; thisTweet.Text = tweet.Text; thisTweet.PublishDateTime = tweet.PublishDateTime; thisTweet.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = tweet.Author.BasicProfile.ReferenceKey, AccountType = tweet.Author.BasicProfile.AccountType }, FullName = tweet.Author.FullName, Description1 = tweet.Author.Description1, Description2 = tweet.Author.Description2 }; accountView.WallOfThisProfile.Tweets.Add(thisTweet); } } if (wallRetrieved.Retweets.Count > 0) { foreach (RetweetViewModel retweet in wallRetrieved.Retweets) { RetweetView thisRetweet = new RetweetView(); thisRetweet.RetweetKey = retweet.RetweetKey; thisRetweet.TweetKey = retweet.TweetKey; thisRetweet.Text = retweet.Text; thisRetweet.PublishDateTime = retweet.PublishDateTime; thisRetweet.TweetPublishDateTime = retweet.TweetPublishDateTime.ToString(); thisRetweet.RetweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.RetweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.RetweetAuthor.BasicProfile.AccountType }, FullName = retweet.RetweetAuthor.FullName, Description1 = retweet.RetweetAuthor.Description1, Description2 = retweet.RetweetAuthor.Description2 }; thisRetweet.TweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.TweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.TweetAuthor.BasicProfile.AccountType }, FullName = retweet.TweetAuthor.FullName, Description1 = retweet.TweetAuthor.Description1, Description2 = retweet.TweetAuthor.Description2 }; accountView.WallOfThisProfile.Retweets.Add(thisRetweet); } } accountView.WorkContactsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetWorkContactsOfUserAccountByKey(accountRetrieved.Profile.BasicProfile.ReferenceKey )); accountView.PartnershipContactsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetPartnershipContactsOfUserAccountByKey(accountRetrieved.Profile.BasicProfile.ReferenceKey)); accountView.GroupsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetGroupsOfUserAccountByKey(accountRetrieved.Profile.BasicProfile.ReferenceKey)); accountView.WallOfThisProfile.PublishedItems = new List<ISortingCapable>(); accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Posts); accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Tweets); accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Retweets); accountView.WallOfThisProfile.PublishedItems = accountView.WallOfThisProfile.PublishedItems.OrderByDescending(x => x.PublishDateTime).ToList(); return View("MyWall", accountView); }
public ActionResult Index() { CompleteProfile myProfile = (CompleteProfile)Session["myProfile"]; UserAccountView accountView = new UserAccountView(); accountView.IsThisMyOwnProfile = true; //accountView.WallOfThisProfile.Posts = new List<PostView>(); //accountView.WallOfThisProfile.Tweets = new List<TweetView>(); //accountView.WallOfThisProfile.Retweets = new List<RetweetView>(); CompleteProfileView completeProfile = new CompleteProfileView(); BasicProfileView basicProfile = new BasicProfileView(); completeProfile.BasicProfile = basicProfile; basicProfile.ReferenceKey = myProfile.BasicProfile.ReferenceKey.ToString(); basicProfile.AccountType = AccountType.UserAccount; completeProfile.FullName = myProfile.FullName; completeProfile.Description1 = myProfile.Description1; completeProfile.Description2 = myProfile.Description2; accountView.Profile = completeProfile; accountView.EmailOfThisProfile = User.Identity.Name; accountView.FoldersOfThisProfile = new Dictionary<string, string>(); accountView.WallOfThisProfile = new ContentStreamView(); accountView.WallOfThisProfile.Posts = new List<PostView>(); accountView.WallOfThisProfile.Tweets = new List<TweetView>(); accountView.WallOfThisProfile.Retweets = new List<RetweetView>(); accountView.WorkContactsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetWorkContactsOfUserAccountByKey( myProfile.BasicProfile.ReferenceKey.ToString() )); accountView.PartnershipContactsOfThisProfile =Converters.ConvertFromViewModelToView(UserAccountService.GetPartnershipContactsOfUserAccountByKey( myProfile.BasicProfile.ReferenceKey.ToString())); accountView.GroupsOfThisProfile = Converters.ConvertFromViewModelToView(UserAccountService.GetGroupsOfUserAccountByKey(myProfile.BasicProfile.ReferenceKey.ToString())); //Im the owner and the viewer of the wall var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString(); ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamAsNewsfeed(thisViewerKey,thisViewerKey); CompleteProfileViewModel myOrganizationAccount = OrganizationAccountService.GetOrganizationAccountProfileByEmployeeUserAccountKey(thisViewerKey); accountView.OrganizationAccountOfThisProfile = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=myOrganizationAccount.BasicProfile.ReferenceKey, AccountType=myOrganizationAccount.BasicProfile.AccountType }, FullName=myOrganizationAccount.FullName, Description1=myOrganizationAccount.Description1 , Description2=myOrganizationAccount.Description2 }; // accountView.WallOfThisProfile = new ContentStreamView(); // accountView.WallOfThisProfile.Posts = new List<PostView>(); if (wallRetrieved.Posts.Count >0) { foreach (PostViewModel post in wallRetrieved.Posts) { PostView thisPost = new PostView(); thisPost.Key = post.Key; thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=post.Author.BasicProfile.ReferenceKey , AccountType= post.Author.BasicProfile.AccountType }, FullName=post.Author.FullName, Description1= post.Author.Description1 , Description2= post.Author.Description2 }; thisPost.PublishDateTime = post.PublishDateTime; thisPost.Text = post.Text; thisPost.Likes = post.Likes; thisPost.ILikedIt = post.ILikedIt; thisPost.Comments = new List<CommentView>(); foreach (CommentViewModel comment in post.Comments) { CommentView thisComment = new CommentView(); thisComment.Key = comment.Key; thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 }; thisComment.Text = comment.Text; thisComment.PublishDateTime = comment.PublishDateTime; thisComment.Likes = comment.Likes; thisComment.ILikedIt = comment.ILikedIt; thisPost.Comments.Add(thisComment); } accountView.WallOfThisProfile.Posts.Add(thisPost); } } if (wallRetrieved.Tweets.Count > 0) { foreach (TweetViewModel tweet in wallRetrieved.Tweets) { TweetView thisTweet = new TweetView(); thisTweet.Key = tweet.Key; thisTweet.Text = tweet.Text; thisTweet.PublishDateTime = tweet.PublishDateTime; thisTweet.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = tweet.Author.BasicProfile.ReferenceKey, AccountType = tweet.Author.BasicProfile.AccountType }, FullName = tweet.Author.FullName, Description1 = tweet.Author.Description1, Description2 = tweet.Author.Description2 }; accountView.WallOfThisProfile.Tweets.Add(thisTweet); } } if (wallRetrieved.Retweets.Count > 0) { foreach (RetweetViewModel retweet in wallRetrieved.Retweets) { RetweetView thisRetweet = new RetweetView(); thisRetweet.RetweetKey = retweet.RetweetKey; thisRetweet.TweetKey = retweet.TweetKey; thisRetweet.Text = retweet.Text; thisRetweet.PublishDateTime = retweet.PublishDateTime; thisRetweet.TweetPublishDateTime = retweet.TweetPublishDateTime.ToString(); thisRetweet.RetweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.RetweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.RetweetAuthor.BasicProfile.AccountType }, FullName = retweet.RetweetAuthor.FullName, Description1 = retweet.RetweetAuthor.Description1, Description2 = retweet.RetweetAuthor.Description2 }; thisRetweet.TweetAuthor = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = retweet.TweetAuthor.BasicProfile.ReferenceKey, AccountType = retweet.TweetAuthor.BasicProfile.AccountType }, FullName = retweet.TweetAuthor.FullName, Description1 = retweet.TweetAuthor.Description1, Description2 = retweet.TweetAuthor.Description2 }; accountView.WallOfThisProfile.Retweets.Add(thisRetweet); } } accountView.WallOfThisProfile.PublishedItems = new List<ISortingCapable>(); accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Posts); accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Tweets); accountView.WallOfThisProfile.PublishedItems.AddRange(accountView.WallOfThisProfile.Retweets); accountView.WallOfThisProfile.PublishedItems= accountView.WallOfThisProfile.PublishedItems.OrderByDescending(x => x.PublishDateTime).ToList(); CompleteProfileView groupView = new CompleteProfileView() { BasicProfile = new BasicProfileView() { ReferenceKey = "ACBCCE0E-7C9F-4386-99AA-1458F308EBB0", AccountType = AccountType.Group }, FullName = "Electric Providers Group" }; CompleteProfileView coworkerView = new CompleteProfileView() { BasicProfile = new BasicProfileView() { ReferenceKey = "BCBCCE0E-7C9F-4386-98AA-1458F308E205", AccountType = AccountType.UserAccount }, FullName = "Larry Page" }; CompleteProfileView partnerView = new CompleteProfileView() { BasicProfile = new BasicProfileView() { ReferenceKey = "BCBCCE0E-7C9F-4386-98AA-1458F308E203", AccountType = AccountType.UserAccount }, FullName = "Allie Opper" }; accountView.GroupSuggestion = groupView; accountView.PartnerSuggestion = partnerView; accountView.CoworkerSuggestion = coworkerView; return View("Newsfeed",accountView); }
public ActionResult OrganizationAccount(string id) { CompleteProfile myProfile = (CompleteProfile) Session["myProfile"]; OrganizationAccountViewModel organizationAccountRetrieved = OrganizationAccountService.GetOrganizationAccountByKey(id); OrganizationAccountView organizationAccountView = new OrganizationAccountView(); organizationAccountView.Profile = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey , AccountType= AccountType.OrganizationAccount }, FullName=organizationAccountRetrieved.Profile.FullName, Description1= organizationAccountRetrieved.Profile.Description1 , Description2=organizationAccountRetrieved.Profile.Description2 }; organizationAccountView.Email = organizationAccountRetrieved.Email; //organizationAccountView.SisterDivisionsOfThisProfile = new List<CompleteProfileView>(); //organizationAccountView.EmployeesOfThisProfile = Converters.ConvertFromViewModelToView(organizationAccountRetrieved.Employees); //organizationAccountView.PartnersOfThisProfile = Converters.ConvertFromViewModelToView(organizationAccountRetrieved.Partners); //organizationAccountView.AlliancesOfThisProfile = Converters.ConvertFromViewModelToView(organizationAccountRetrieved.Alliances); organizationAccountView.MyGeoLocation = new GeoLocationView() { Latitude=organizationAccountRetrieved.Location.Latitude , Longitude=organizationAccountRetrieved.Location.Longitude }; organizationAccountView.WallOfThisProfile = new ContentStreamView(); organizationAccountView.WallOfThisProfile.Posts = new List<PostView>(); Dictionary<string, string> coordinates = new Dictionary<string, string>(); coordinates.Add("Partner1", "47.548807,7.587820"); coordinates.Add("Partner2", "46.948432,7.440461"); coordinates.Add("Partner3", "46.519595,6.632335"); organizationAccountView.MyGeoLocation = new GeoLocationView { Latitude = organizationAccountRetrieved.Location.Latitude, Longitude = organizationAccountRetrieved.Location.Longitude }; organizationAccountView.WallOfThisProfile = new ContentStreamView(); organizationAccountView.WallOfThisProfile.Posts = new List<PostView>(); if (User.Identity.Name == organizationAccountRetrieved.Email) { organizationAccountView.IsThisMyOwnProfile = true; } else { PartnershipStateInfoViewModel partnership = OrganizationAccountService.GetPartnershipBetweenOrganizationAccountsByKeys(myProfile.BasicProfile.ReferenceKey.ToString(), organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey ); switch (partnership.PartnershipAction) { case PartnershipAction.Accept: organizationAccountView.ShowPartnershipButtonForThisProfile = true; organizationAccountView.EnablePartnershipButtonForThisProfile = true; organizationAccountView.IsThisProfileAPartnerOfMine = true; organizationAccountView.PartnershipButtonActionNameForThisProfile = "CancelPartnershipWith"; organizationAccountView.PartnershipButtonControllerNameForThisProfile = "OrganizationAccounts"; organizationAccountView.PartnershipButtonCaptionForThisProfile = "Cancel Partnership"; break; case PartnershipAction.Request: if (partnership.Sender.BasicProfile.ReferenceKey == myProfile.BasicProfile.ReferenceKey.ToString()) { //if the viewer is the one that sent the request organizationAccountView.ShowPartnershipButtonForThisProfile = true; organizationAccountView.EnablePartnershipButtonForThisProfile = false; organizationAccountView.isWaitingForPartnershipResponse = true; organizationAccountView.PartnershipButtonActionNameForThisProfile = "CancelRequestTo"; organizationAccountView.PartnershipButtonControllerNameForThisProfile = "OrganizationAccounts"; organizationAccountView.PartnershipButtonCaptionForThisProfile = "Cancel Request"; } else { //if the viewer is the one that received the request organizationAccountView.ShowPartnershipButtonForThisProfile = true; organizationAccountView.EnablePartnershipButtonForThisProfile = false; organizationAccountView.PartnershipButtonActionNameForThisProfile = "Null"; organizationAccountView.PartnershipButtonControllerNameForThisProfile = "Null"; organizationAccountView.PartnershipButtonCaptionForThisProfile = "Request Received"; } break; //case Domain.Friendships.States.FriendshipAction.New : //case Domain.Friendships.States.FriendshipAction.Cancel : //case Domain.Friendships.States.FriendshipAction.Reject : default: organizationAccountView.ShowPartnershipButtonForThisProfile = true; organizationAccountView.EnablePartnershipButtonForThisProfile = true; organizationAccountView.PartnershipButtonActionNameForThisProfile = "RequestPartnershipTo"; organizationAccountView.PartnershipButtonControllerNameForThisProfile = "OrganizationAccounts"; organizationAccountView.PartnershipButtonCaptionForThisProfile = "Send Request"; break; } } var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString(); ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamByOwnerReferenceKey(id,thisViewerKey); if (wallRetrieved.Posts.Count > 0) { if (wallRetrieved.Posts != null) { organizationAccountView.WallOfThisProfile.Posts = new List<PostView>(); foreach (PostViewModel post in wallRetrieved.Posts) { PostView thisPost = new PostView(); thisPost.Key = post.Key; thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = post.Author.BasicProfile.ReferenceKey, AccountType = post.Author.BasicProfile.AccountType }, FullName = post.Author.FullName, Description1 = post.Author.Description1, Description2 = post.Author.Description2 }; thisPost.Text = post.Text; thisPost.TimeStamp = post.TimeStamp.ToString(); thisPost.Likes = post.Likes; thisPost.Comments = new List<CommentView>(); foreach (CommentViewModel comment in post.Comments) { CommentView thisComment = new CommentView(); thisComment.Key = comment.Key; thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 }; thisComment.Text = comment.Text; thisComment.TimeStamp = comment.TimeStamp.ToString(); thisComment.Likes = comment.Likes; thisPost.Comments.Add(thisComment); } organizationAccountView.WallOfThisProfile.Posts.Add(thisPost); } } } else { organizationAccountView.WallOfThisProfile = new ContentStreamView(); organizationAccountView.WallOfThisProfile.Posts = new List<PostView>(); } organizationAccountView.EmployeesOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetEmployeesOfOrganizationAccountByKey( organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); organizationAccountView.SisterDivisionsOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetSisterDivisionsOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey )); organizationAccountView.PartnersOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetPartnersOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); organizationAccountView.AlliancesOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetAlliancesOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); return View(organizationAccountView); }
public ActionResult Alliance(string id) { CompleteProfile myProfile = (CompleteProfile)Session["myProfile"]; //"ACBCCE0E-7C9F-4386-98AA-1458F308E1B0" AllianceViewModel allianceRetrieved = AllianceService.GetAllianceByKey(id); AllianceView allianceView = new AllianceView(); allianceView.Profile = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=allianceRetrieved.Profile.BasicProfile.ReferenceKey , AccountType= Domain._Base.Accounts.AccountType.Alliance }, FullName=allianceRetrieved.Profile.FullName, Description1=allianceRetrieved.Profile.Description1 }; allianceView.WallOfThisProfile = new ContentStreamView(); allianceView.WallOfThisProfile.Posts = new List<PostView>(); var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString(); ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamByOwnerReferenceKey(id, thisViewerKey); allianceView.WallOfThisProfile = new ContentStreamView(); allianceView.WallOfThisProfile.Posts = new List<PostView>(); if (wallRetrieved.Posts.Count >0) { foreach (PostViewModel post in wallRetrieved.Posts) { PostView thisPost = new PostView(); thisPost.Key = post.Key; thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=post.Author.BasicProfile.ReferenceKey , AccountType= post.Author.BasicProfile.AccountType }, FullName=post.Author.FullName, Description1= post.Author.Description1 , Description2= post.Author.Description2 }; thisPost.TimeStamp = post.TimeStamp.ToString(); thisPost.Text = post.Text; thisPost.Likes = post.Likes; thisPost.Comments = new List<CommentView>(); foreach (CommentViewModel comment in post.Comments) { CommentView thisComment = new CommentView(); thisComment.Key = comment.Key; thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 }; thisComment.Text = comment.Text; thisComment.TimeStamp = comment.TimeStamp.ToString(); thisComment.Likes = comment.Likes; thisPost.Comments.Add(thisComment); } allianceView.WallOfThisProfile.Posts.Add(thisPost); } } //if (allianceRetrieved.Wall != null) //{ // allianceView.WallOfThisProfile = new ContentStreamView(); // if (allianceRetrieved.Wall.Posts != null) // { // allianceView.WallOfThisProfile.Posts = new List<PostView>(); // foreach (PostViewModel post in allianceRetrieved.Wall.Posts) // { // PostView thisPost = new PostView(); // thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = post.Author.BasicProfile.ReferenceKey, AccountType = post.Author.BasicProfile.AccountType }, FullName = post.Author.FullName, Description1 = post.Author.Description1, Description2 = post.Author.Description2 }; // thisPost.Key = post.Key; // thisPost.Text = post.Text; // thisPost.TimeStamp = post.TimeStamp.ToString(); // thisPost.Comments = new List<CommentView>(); // foreach (CommentViewModel comment in post.Comments) // { // CommentView thisComment = new CommentView(); // thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 }; // thisComment.Key = comment.Key; // thisComment.Text = comment.Text; // thisComment.TimeStamp = comment.TimeStamp.ToString(); // thisPost.Comments.Add(thisComment); // } // allianceView.WallOfThisProfile.Posts.Add(thisPost); // } // } // } allianceView.IsViewerAllowedToCollaborate = true; allianceView.Members = new List<CompleteProfileView>(); foreach (CompleteProfileViewModel item in allianceRetrieved.Members) { allianceView.Members.Add(new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = item.BasicProfile.ReferenceKey, AccountType = item.BasicProfile.AccountType }, FullName = item.FullName, Description1 = item.Description1 }); } return View(allianceView); }
public ActionResult Index() { CompleteProfile myProfile = (CompleteProfile) Session["myProfile"]; //OrganizationServiceFacade organizationService = new OrganizationServiceFacade(new OrganizationServiceProxy()); //Dictionary<String, String> organizationAccountsFound = _organizationAccountServiceFacade.GetAllOrganizationAccounts(); //OrganizationAccountsView organizationAccountsView = new OrganizationAccountsView(); //organizationAccountsView.OrganizationAccounts = organizationAccountsFound; //return View(organizationAccountsView); //OrganizationServiceFacade organizationService = new OrganizationServiceFacade(new OrganizationServiceProxy()); //"BCBCCE0E-7C9F-4386-98AA-1458F308E1C3" OrganizationAccountViewModel organizationAccountRetrieved = OrganizationAccountService.GetOrganizationAccountByKey(myProfile.BasicProfile.ReferenceKey.ToString()); OrganizationAccountView organizationAccountView = new OrganizationAccountView(); CompleteProfileView completeProfile = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey=myProfile.BasicProfile.ReferenceKey.ToString(), AccountType=myProfile.BasicProfile.ReferenceType }, FullName=myProfile.FullName, Description1=myProfile.Description1 }; organizationAccountView.Profile = completeProfile; organizationAccountView.Email = organizationAccountRetrieved.Email; organizationAccountView.IsThisMyOwnProfile = true; organizationAccountView.EmployeesOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetEmployeesOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); organizationAccountView.SisterDivisionsOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetSisterDivisionsOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); organizationAccountView.PartnersOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetPartnersOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); organizationAccountView.AlliancesOfThisProfile = Converters.ConvertFromViewModelToView(OrganizationAccountService.GetAlliancesOfOrganizationAccountByKey(organizationAccountRetrieved.Profile.BasicProfile.ReferenceKey)); organizationAccountView.MyGeoLocation = new GeoLocationView { Latitude=organizationAccountRetrieved.Location.Latitude , Longitude=organizationAccountRetrieved.Location.Longitude }; organizationAccountView.WallOfThisProfile = new ContentStreamView(); organizationAccountView.WallOfThisProfile.Posts = new List<PostView>(); var thisViewerKey = myProfile.BasicProfile.ReferenceKey.ToString(); ContentStreamViewModel wallRetrieved = PublishingService.GetContentStreamByOwnerReferenceKey(thisViewerKey, thisViewerKey); if (wallRetrieved.Posts.Count > 0) { foreach (PostViewModel post in wallRetrieved.Posts) { PostView thisPost = new PostView(); thisPost.Key = post.Key; thisPost.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = post.Author.BasicProfile.ReferenceKey, AccountType = post.Author.BasicProfile.AccountType }, FullName = post.Author.FullName, Description1 = post.Author.Description1, Description2 = post.Author.Description2 }; thisPost.TimeStamp = post.TimeStamp.ToString(); thisPost.Text = post.Text; thisPost.Likes = post.Likes; thisPost.ILikedIt = post.ILikedIt; thisPost.Comments = new List<CommentView>(); foreach (CommentViewModel comment in post.Comments) { CommentView thisComment = new CommentView(); thisComment.Key = comment.Key; thisComment.Author = new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey = comment.Author.BasicProfile.ReferenceKey, AccountType = comment.Author.BasicProfile.AccountType }, FullName = comment.Author.FullName, Description1 = comment.Author.Description1, Description2 = comment.Author.Description2 }; thisComment.Text = comment.Text; thisComment.ILikedIt = comment.ILikedIt; thisComment.TimeStamp = comment.TimeStamp.ToString(); thisComment.Likes = comment.Likes; thisPost.Comments.Add(thisComment); } organizationAccountView.WallOfThisProfile.Posts.Add(thisPost); } } Dictionary<string, string> coordinates = new Dictionary<string, string>(); coordinates.Add("Partner1", "47.548807,7.587820"); coordinates.Add("Partner2", "46.948432,7.440461"); coordinates.Add("Partner3", "46.519595,6.632335"); return View("OrganizationAccount",organizationAccountView); }