예제 #1
0
        public CongressVotingVoterViewModel(Entities.Citizen citizen)
        {
            Avatar = new ImageViewModel(citizen.Entity.ImgUrl);
            Name   = citizen.Entity.Name;

            if (citizen.PartyMember != null)
            {
                PartyName = citizen.PartyMember.Party.Entity.Name;
            }
        }
예제 #2
0
 private void friendshipInit(Entities.Citizen citizen, IFriendService friendService, Entities.Citizen currentCitizen)
 {
     if (currentCitizen != null && currentCitizen.ID != citizen.ID)
     {
         AreFriends               = friendService.AreFriends(currentCitizen, citizen);
         HasSentFriendRequest     = friendService.HasSentFriendRequest(currentCitizen, citizen);
         HasReceivedFriendRequest = friendService.HasSentFriendRequest(citizen, currentCitizen);
         if (HasReceivedFriendRequest)
         {
             var friendRepo = DependencyResolver.Current.GetService <IFriendRepository>();
             friendRequestID = friendRepo.GetFriendRequest(citizen.ID, currentCitizen.ID).ID;
         }
         CanAddFriend = !AreFriends && !HasSentFriendRequest && !HasReceivedFriendRequest;
     }
 }
예제 #3
0
        public CitizenInfoViewModel(Entities.Citizen citizen, IFriendService friendService)
        {
            var entity = citizen.Entity;

            CitizenName = entity.Name;
            CitizenID   = entity.EntityID;
            Avatar      = new ImageViewModel(entity.ImgUrl);


            var region  = citizen.Entity.GetCurrentRegion();
            var country = citizen.Entity.GetCurrentCountry();

            RegionName             = region.Name;
            RegionID               = region.ID;
            CountryName            = country.Entity.Name;
            CountryID              = country.ID;
            CitizenshipCountryID   = citizen.CitizenshipID;
            CitizenshipCountryName = Persistent.Countries.GetById(CitizenshipCountryID).Entity.Name;

            if (citizen.CompanyEmployee != null)
            {
                WorkingCompanyID   = citizen.CompanyEmployee.CompanyID;
                WorkingCompanyName = citizen.CompanyEmployee.Company.Entity.Name;
            }
            if (citizen.PartyMember != null)
            {
                PartyID   = citizen.PartyMember.PartyID;
                PartyName = citizen.PartyMember.Party.Entity.Name;
            }

            IsUnderControl = citizen.ID == SessionHelper.CurrentEntity.EntityID;
            if (IsUnderControl)
            {
                AvatarChange = new AvatarChangeViewModel(citizen.ID);
            }
            MilitaryRankReadable = StringUtils.FirstToUpper(MilitaryRankEnumExtensions.GetRankForMilitaryRank((double)citizen.MilitaryRank).ToHumanReadable());

            var currentCitizen = SessionHelper.CurrentEntity.Citizen;

            friendshipInit(citizen, friendService, currentCitizen);
            createMenu();
        }