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 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); }