private void ManageUserRelationshipStatus(int userRelationshipId, RelationshipStatus newStatus) { UserRelationship userRelationship = VerifyUserRelationshipExist(userRelationshipId); if (userRelationship == null) { return; } //TODO - apply business rules - throw exception if newStatus requested is not allowed bool save = false; switch (newStatus) { case RelationshipStatus.None: save = true; break; case RelationshipStatus.Pending: save = true; break; case RelationshipStatus.Accepted: save = true; break; } if (save) { userRelationship.Status = newStatus; SaveUserRelationship(userRelationship); } }
public Relationship(string userID, string targetUserID, RelationshipStatus status) { UserOneID = userID; UserTwoID = targetUserID; Status = status; Messages = new List <Message>(); }
public static Character createRandomCharacter() { /** * We want to setup these values in a very particular sequence. * i.e. What is said in life events depends on age. * i.e. A character's name depends on their gender. * etc. etc. */ Age age = Age.ReturnRandomAge(); Mother mother = Mother.ReturnMother(); Father father = Father.ReturnFather(); Parents parents = Parents.ReturnRandomParentsComment(); Appearance appearance = Appearance.ReturnRandomAppearanceComment(); Race race = Race.ReturnRandomRace(); LifeEvents lifeEvents = LifeEvents.ReturnRandomLifeEventsComment(); Childhood childhood = Childhood.ReturnRandomChildhoodEvent(); Adolescence adolescence = Adolescence.ReturnRandomAdolescenceEvent(); Adulthood adulthood = Adulthood.ReturnRandomAdulthoodEvent(); OldAge elder = OldAge.ReturnRandomElderlyEvent(); Profession profession = Profession.ReturnRandomProfession(); RelationshipStatus relationshipStatus = RelationshipStatus.ReturnRandomRelationshipStatus(); Stats stats = Stats.GenerateRandomStats(); Role role = Role.ReturnRandomRole(); Demeanor demeanor = Demeanor.ReturnRandomDemeanor(); Gender gender = Gender.ReturnRandomGender(); CharacterName characterName = CharacterName.ReturnRandomCharacterName(gender); PlaceOfResidence placeOfResidence = PlaceOfResidence.ReturnRandomPlaceOfResidence(); NullChatMenuComponent nullChatMenuComponent = new NullChatMenuComponent(""); Character randomCharacter; randomCharacter = new Character(characterName, age, parents, mother, father, appearance, race, lifeEvents, childhood, adolescence, adulthood, elder, profession, relationshipStatus, stats, role, demeanor, gender, placeOfResidence, nullChatMenuComponent); return(randomCharacter); }
public ChatboxViewModel(int relationshipID, TargetUser targetUser, List <Message> messages) { RelationshipID = relationshipID; TargetUser = targetUser; Messages = messages; relationshipStatus = db.Relationships.Find(relationshipID).Status; }
/// <summary> /// 建構函數 /// </summary> /// <param name="userId">成員 Id</param> /// <param name="group">群組</param> /// <param name="status">關係狀態</param> /// <param name="date">建立時間</param> /// <param name="readTime">最後讀取時間</param> public GroupMember(long userId, Group group, RelationshipStatus status, DateTime date, DateTime readTime) : base(date) { this.UserId = userId; this.Group = group; this.Status = status; this.ReadTime = readTime; }
internal void InvalidateLogical() { CurrentRelationshipLevel = RelationshipStatus.NotBuiltYet; _logicalReplacements = null; _logicalNeighbors = null; _interiorLogicalEdge = null; _exteriorLogicalEdge = null; LayoutContext.DockingPanel.InvalidateSilos(); }
public ExtendedPerson(Gender PersonGender, string First, string Last, DateTime DateOfBirth, RelationshipStatus RelationshipStatus, string School = "", string University = "") : base(First, Last) { this.PersonGender = PersonGender; this.DateOfBirth = DateOfBirth; this.RelationshipStatus = RelationshipStatus; this.School = School; this.University = University; }
internal MessengerBuddy(uint UserId, string pUsername, string pLook, string pMotto, string pLastOnline, int relationship) { this.UserId = UserId; this.mUsername = pUsername; this.mLook = pLook; this.mMotto = pMotto; this.mLastOnline = pLastOnline; this.relationship = (RelationshipStatus)relationship; }
public Expression <Func <Database.User, bool> > GetFilter(List <int> BlockedUsersList) { Expression <Func <Database.User, bool> > filter = x => !BlockedUsersList.Contains(x.Id) && x.Active; if (!string.IsNullOrEmpty(FreeSearch)) { FreeSearch = FreeSearch.ToUpper(); filter = filter.And(x => x.Nickname.ToUpper().Contains(FreeSearch) || x.Gender.Gender1.ToUpper().Contains(FreeSearch) || x.Country.Name.ToUpper().Contains(FreeSearch) || x.Region.ToUpper().Contains(FreeSearch) || x.Language.ToUpper().Contains(FreeSearch) || x.RelationshipStatus.ToUpper().Contains(FreeSearch)); } else if (!string.IsNullOrEmpty(ConnectedListId) && ConnectedListId.Count() > 1) { var SelectedVoicerList = ConnectedListId.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => Convert.ToInt32(x)).ToList(); filter = filter.And(x => SelectedVoicerList.Contains(x.Id)); } else { if (!string.IsNullOrEmpty(DateOfBirth)) { filter = filter.And(x => x.BirthDate == DateOfBirth); } if (GenderId != null && GenderId > 0) { filter = filter.And(x => x.GenderId == GenderId); } if (CountryId != null && CountryId > 0) { filter = filter.And(x => x.CountryId == CountryId); } if (!OccupationId.IsEmpty()) { filter = filter.And(x => x.UsersOccupationsUsers.Any(y => OccupationId.Contains(y.UsersOccupationsId))); } if (!InterestHobbyId.IsEmpty()) { filter = filter.And(x => x.UsersHobbyUsers.Any(y => InterestHobbyId.Contains(y.UsersHobbyId))); } if (!string.IsNullOrEmpty(Region)) { filter = filter.And(x => x.Region.ToUpper().Contains(Region.ToUpper())); } if (!string.IsNullOrEmpty(Language)) { filter = filter.And(x => x.Language.ToUpper().Contains(Language.ToUpper())); } if (!string.IsNullOrEmpty(RelationshipStatus)) { filter = filter.And(x => x.RelationshipStatus.ToUpper().Contains(RelationshipStatus.ToUpper())); } } return(filter); }
public static string GetRelationshipStr(this RelationshipStatus status, int sex = 0) { bool flag = sex != 1; switch (status) { case RelationshipStatus.NotMarried: if (!flag) { return(CommonResources.Relationship_Single_Female); } return(CommonResources.Relationship_Single_Male); case RelationshipStatus.InARelationship: if (!flag) { return(CommonResources.Relationship_InARelationship_Female); } return(CommonResources.Relationship_InARelationship_Male); case RelationshipStatus.Engaged: if (!flag) { return(CommonResources.Relationship_Engaged_Female); } return(CommonResources.Relationship_Engaged_Male); case RelationshipStatus.Married: if (!flag) { return(CommonResources.Relationship_Married_Female); } return(CommonResources.Relationship_Married_Male); case RelationshipStatus.ItIsComplicated: return(CommonResources.Relationship_ItIsComplicated); case RelationshipStatus.ActivelySearching: return(CommonResources.Relationship_ActivelySearching); case RelationshipStatus.InLove: if (!flag) { return(CommonResources.Relationship_InLove_Female); } return(CommonResources.Relationship_InLove_Male); case RelationshipStatus.InCivilUnion: return(CommonResources.InCivilUnion); default: return(""); } }
public static RelationshipStatus ReturnRandomRelationshipStatus() { List <string> relationshipStatusList = new List <string>(); relationshipStatusList.Add("single"); relationshipStatusList.Add("married"); RelationshipStatus randomRelationshipStatus = new RelationshipStatus(relationshipStatusList[Random.Range(0, relationshipStatusList.Count)]); return(randomRelationshipStatus); }
public static string ToPrettyString(SearchParams searchParams) { List <string> stringList = new List <string>(); int sex1 = searchParams.GetValue <int>("sex"); if (sex1 > 0) { VKClient.Common.Backend.DataObjects.Sex sex2 = (VKClient.Common.Backend.DataObjects.Sex)sex1; stringList.Add(sex2.GetSexStr()); } int num1 = !searchParams.GetValue <bool>("DisableAnyAge") ? 1 : 0; int number1 = searchParams.GetValue <int>("age_from"); int number2 = searchParams.GetValue <int>("age_to"); if (num1 == 0 && number1 > 0 && (number2 > 0 && number2 > number1)) { string str1 = UIStringFormatterHelper.FormatNumberOfSomething(number1, CommonResources.OneFromAgeFrm, CommonResources.TwoFourFromAgeFrm, CommonResources.FiveFromAgeFrm, true, null, false); string str2 = UIStringFormatterHelper.FormatNumberOfSomething(number2, CommonResources.OneToAgeFrm, CommonResources.TwoFourToAgeFrm, CommonResources.FiveToAgeFrm, true, null, false); stringList.Add(string.Format("{0} {1}", (object)str1, (object)str2)); } int num2 = searchParams.GetValue <int>("status"); if (num2 > 0) { RelationshipStatus status = (RelationshipStatus)num2; stringList.Add(status.GetRelationshipStr(sex1).ToLowerInvariant()); } Country country = searchParams.GetValue <Country>("country"); if (country != null && country.id > 0L) { stringList.Add(country.title); } City city = searchParams.GetValue <City>("city"); if (city != null && city.id > 0L) { stringList.Add(city.name); } if (searchParams.GetValue <bool>("has_photo")) { stringList.Add(CommonResources.UsersSearch_WithPhoto.ToLowerInvariant()); } if (searchParams.GetValue <bool>("online")) { stringList.Add(CommonResources.UsersSearch_OnlineNow.ToLowerInvariant()); } return(string.Join(", ", (IEnumerable <string>)stringList).Capitalize()); }
public ProfilePageViewModel(User user, UserProfile userProfile, Image profilePicture, Image coverPhoto, string currentUserID, RelationshipStatus status, int relationshipID, bool privateProfile) { UserID = user.UserID; FirstName = user.FirstName; LastName = user.LastName; DateJoined = user.DateJoined.ToString(); ProfilePicturePath = (profilePicture.Path != "no-image.png") ? user.UserID + "/" + profilePicture.Path : profilePicture.Path; ProfilePictureName = profilePicture.FileName; CoverPhotoName = coverPhoto.FileName; CoverPhotoPath = (coverPhoto.Path != "cover-image.jpg") ? user.UserID + "/" + coverPhoto.Path : coverPhoto.Path; CurrentUserID = currentUserID; RelationshipStatus = status; RelationshipID = relationshipID; Private = privateProfile; }
private void ComputeLogicalRelationships(RelationshipStatus requiredLevel) { while (CurrentRelationshipLevel < requiredLevel) { switch (CurrentRelationshipLevel) { case RelationshipStatus.NotBuiltYet: if (CurrentRelationshipProgress == RelationshipProgress.LogicalReplacements) { throw new InvalidOperationException("Recursion not supported"); } CurrentRelationshipProgress = RelationshipProgress.LogicalReplacements; ComputeLogicalReplacements(); CurrentRelationshipLevel = RelationshipStatus.ReplacementsKnown; CurrentRelationshipProgress = RelationshipProgress.Nothing; break; case RelationshipStatus.ReplacementsKnown: if (CurrentRelationshipProgress == RelationshipProgress.LogicalNeighbors) { throw new InvalidOperationException("Recursion not supported"); } CurrentRelationshipProgress = RelationshipProgress.LogicalNeighbors; ComputeLogicalNeighbors(); CurrentRelationshipLevel = RelationshipStatus.NeighborsKnown; CurrentRelationshipProgress = RelationshipProgress.Nothing; break; case RelationshipStatus.NeighborsKnown: if (CurrentRelationshipProgress == RelationshipProgress.LogicalEdges) { throw new InvalidOperationException("Recursion not supported"); } CurrentRelationshipProgress = RelationshipProgress.LogicalEdges; ComputeLogicalEdges(); CurrentRelationshipLevel = RelationshipStatus.EdgesKnown; CurrentRelationshipProgress = RelationshipProgress.Nothing; EdgeRecomputed?.Invoke(this, null); break; case RelationshipStatus.EdgesKnown: break; default: throw new NotImplementedException(); } } }
public InboxViewModel(User user, UserProfile userProfile, Image profilePicture, Image coverPhoto, string currentUserID, RelationshipStatus status, int relationshipID, bool privateProfile, List <Post> posts, List <Review> reviews, List <Relationship> friends, List <Place> places) { UserID = user.UserID; FirstName = user.FirstName; LastName = user.LastName; DateJoined = user.DateJoined.ToString(); ProfilePicturePath = (profilePicture.Path != "no-image.png") ? user.UserID + "/" + profilePicture.Path : profilePicture.Path; ProfilePictureName = profilePicture.FileName; CoverPhotoName = coverPhoto.FileName; CoverPhotoPath = (coverPhoto.Path != "cover-image.jpg") ? user.UserID + "/" + coverPhoto.Path : coverPhoto.Path; CurrentUserID = currentUserID; RelationshipStatus = status; RelationshipID = relationshipID; Private = privateProfile; Posts = posts; Reviews = reviews; Friends = friends; Places = places; }
public async Task <RelationshipStatus> GetUserRelationshipStatus(string authenticationToken, string friendId) { try { FriendService friendService = new FriendService(); RelationshipStatus relationshipStatus = new RelationshipStatus(); var response = await friendService.GetUserRelationshipStatus(authenticationToken, friendId); if (response.IsSuccessStatusCode) { string result = await response.Content.ReadAsStringAsync(); if (!string.IsNullOrEmpty(result)) { Enum.TryParse(result, out relationshipStatus); return(relationshipStatus); } else { return(RelationshipStatus.NotFriends); } } else { if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized) { throw new Exception("Unauthorized"); } else { throw new Exception(response.StatusCode.ToString() + " - " + response.ReasonPhrase); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public Character(CharacterName characterName, Age age, Parents parents, Mother mother, Father father, Appearance appearance, Race race, LifeEvents lifeEvents, Childhood childhood, Adolescence adolescence, Adulthood adulthood, OldAge elder, Profession profession, RelationshipStatus relationshipStatus, Stats stats, Role role, Demeanor demeanor, Gender gender, PlaceOfResidence placeOfResidence, NullChatMenuComponent nullChatMenuComponent) { this.characterName = characterName; this.age = age; this.parents = parents; this.mother = mother; this.father = father; this.appearance = appearance; this.race = race; this.lifeEvents = lifeEvents; this.childhood = childhood; this.adolescence = adolescence; this.adulthood = adulthood; this.elder = elder; this.profession = profession; this.relationshipStatus = relationshipStatus; this.stats = stats; this.role = role; this.demeanor = demeanor; this.gender = gender; this.placeOfResidence = placeOfResidence; this.nullChatMenuComponent = nullChatMenuComponent; }
public void CannotCreateSupplierWithRelationshipStatusButWithoutParent(SupplierId subsidiaryId, RelationshipStatus relationshipStatus, List <SupplierId> children) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId: None, relationshipStatus, children));
public bool IsOfStatus(Team otherTeam, RelationshipStatus status) { return(m_relationShips[otherTeam] == status); }
public static List <RelationshipViewModel> GetRelationshipList(string userID, RelationshipStatus status) { try { // Create stored procedure for getting list of friends. List <Relationship> friendsList = db.Relationships.Where(i => (i.UserOneID == userID || i.UserTwoID == userID) && i.Status == status).ToList(); List <RelationshipViewModel> friends = new List <RelationshipViewModel>(); foreach (Relationship item in friendsList) { User user = (item.UserOneID != userID) ? db.Users.Find(item.UserOneID) : db.Users.Find(item.UserTwoID); Image profilePicture = Image.GetProfileImages(user.UserID, FileType.ProfilePicture); RelationshipViewModel friend = new RelationshipViewModel(user, profilePicture.Path, item.ID); friends.Add(friend); } return(friends); } catch (Exception) { return(new List <RelationshipViewModel>()); throw new NullReferenceException(); } }
public static List<User> GetRelationshipUsers(int userID, RelationshipStatus status) { DidacheDb db = new DidacheDb(); return db.UserRelationships .Include("TargetUser") .Where(ur => ur.RequesterUserID == userID && ur.Status == (int)status) .Select(ur => ur.TargetUser) .ToList(); }
public void PortalSecurity_IsInRoles_NonAdminUser_False_WhenRoleIsFriendRoleAndRelationshipIsNotAccepted(RelationshipStatus relationshipStatus) { //Arrange var user = new UserInfo { IsSuperUser = false, UserID = Constants.USER_TenId }; var relatedUser = new UserInfo { IsSuperUser = false, UserID = Constants.USER_ValidId }; string roles = "FRIEND:" + relatedUser.UserID; var mockUserController = new Mock<IUserController>(); mockUserController.Setup(uc => uc.GetUserById(It.IsAny<int>(), Constants.USER_ValidId)).Returns(relatedUser); UserController.SetTestableInstance(mockUserController.Object); var mockRelationShipController = new Mock<IRelationshipController>(); mockRelationShipController.Setup( rsc => rsc.GetFriendRelationship(It.Is<UserInfo>(u => u.UserID == Constants.USER_TenId), It.Is<UserInfo>(u => u.UserID == Constants.USER_ValidId))) .Returns(new UserRelationship() { Status = relationshipStatus }); RelationshipController.SetTestableInstance(mockRelationShipController.Object); var portalSettings = SetupPortalSettings(); //Act and Assert Assert.IsFalse(PortalSecurity.IsInRoles(user, portalSettings, roles)); }
/// <summary> /// Constructor /// </summary> public UserResponseRelationshipStatus(ActorResponse actor, RelationshipStatus status) : base(actor, status) { }
public async Task UpdateUserRelationshipStatus(string authenticationToken, string friendId, RelationshipStatus relationshipStatus) { try { FriendService friendService = new FriendService(); var response = await friendService.UpdateUserRelationshipStatus(authenticationToken, friendId, relationshipStatus); if (!response.IsSuccessStatusCode) { if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized) { throw new Exception("Unauthorized"); } else { throw new Exception(response.StatusCode.ToString() + " - " + response.ReasonPhrase); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public RelationshipStatus_Structure() { target = new RelationshipStatus(); source = new RelationshipStatus(); }
public void CanCreateSupplierWithCorrectArguments(SupplierId supplierId, SupplierId parentId, RelationshipStatus relationshipStatus, List <SupplierId> children) => new Supplier(supplierId, parentId, relationshipStatus, children);
/// ----------------------------------------------------------------------------- /// <summary> /// Initiate an UserRelationship Request /// </summary> /// <param name="initiatingUser">UserInfo of the user initiating the request</param> /// <param name="targetUser">UserInfo of the user being solicited for initiating the request</param> /// <param name="relationship">Relationship to associate this request to (Portal-Level Relationship or User-Level Relationship)</param> /// <remarks> /// If all conditions are met UserRelationship object belonging to Initiating User is returned. /// </remarks> /// <returns> /// Relationship object belonging to the initiating user /// </returns> /// <exception cref="UserRelationshipBlockedException">Target user has Blocked any relationship request from Initiating user</exception> /// <exception cref="InvalidRelationshipTypeException">Relationship type does not exist</exception> /// ----------------------------------------------------------------------------- public UserRelationship InitiateUserRelationship(UserInfo initiatingUser, UserInfo targetUser, Relationship relationship) { Requires.NotNull("user1", initiatingUser); Requires.NotNull("user2", targetUser); Requires.NotNull("relationship", relationship); Requires.PropertyNotNegative("user1", "UserID", initiatingUser.UserID); Requires.PropertyNotNegative("user2", "UserID", targetUser.UserID); Requires.PropertyNotNegative("user1", "PortalID", initiatingUser.PortalID); Requires.PropertyNotNegative("user2", "PortalID", targetUser.PortalID); Requires.PropertyNotNegative("relationship", "RelationshipId", relationship.RelationshipId); //cannot be same user if (initiatingUser.UserID == targetUser.UserID) { throw new UserRelationshipForSameUsersException( Localization.GetExceptionMessage("UserRelationshipForSameUsersError", "Initiating and Target Users cannot have same UserID '{0}'.", initiatingUser.UserID)); } //users must be from same portal if (initiatingUser.PortalID != targetUser.PortalID) { throw new UserRelationshipForDifferentPortalException( Localization.GetExceptionMessage("UserRelationshipForDifferentPortalError", "Portal ID '{0}' of Initiating User is different from Portal ID '{1}' of Target User.", initiatingUser.PortalID, targetUser.PortalID)); } //check for existing UserRelationship record UserRelationship existingRelationship = GetUserRelationship(initiatingUser, targetUser, relationship); if (existingRelationship != null) { throw new UserRelationshipExistsException(Localization.GetExceptionMessage( "UserRelationshipExistsError", "Relationship already exists for Initiating User '{0}' Target User '{1}' RelationshipID '{2}'.", initiatingUser.UserID, targetUser.UserID, relationship.RelationshipId)); } //no existing UserRelationship record found //use Relationship DefaultResponse as status RelationshipStatus status = relationship.DefaultResponse; //check if there is a custom relationship status setting for the user. //TODO - Is this check only applicable for portal or host list //if (relationship.IsPortalList || relationship.IsHostList) { UserRelationshipPreference preference = GetUserRelationshipPreference(targetUser.UserID, relationship.RelationshipId); if (preference != null) { status = preference.DefaultResponse; } } if (status == RelationshipStatus.None) { status = RelationshipStatus.Pending; } var userRelationship = new UserRelationship { UserRelationshipId = Null.NullInteger, UserId = initiatingUser.UserID, RelatedUserId = targetUser.UserID, RelationshipId = relationship.RelationshipId, Status = status }; SaveUserRelationship(userRelationship); return(userRelationship); }
public Person(string name, DateTime dateOfBirth, RelationshipStatus relationshipStatus = RelationshipStatus.Unknown) { Name = name; DateOfBirth = dateOfBirth.Date; RelationshipStatus = relationshipStatus; }
public RelationshipItem(UserData profileData) : base(ProfileInfoItemType.RichText) { this.Title = CommonResources.ProfilePage_Info_RelStatus; string str1 = ""; User relationPartner = profileData.user.relation_partner; long num = relationPartner == null ? 0L : relationPartner.id; string str2 = ""; RelationshipStatus relationshipStatus = (RelationshipStatus)profileData.user.relation; NameCases partnerNameCases = profileData.relPartnerNameCases; bool flag = profileData.user.sex == 2; switch (relationshipStatus) { case RelationshipStatus.NotMarried: str1 = flag ? CommonResources.ProfilePage_Info_NotMarriedMale : CommonResources.ProfilePage_Info_NotMarriedFemale; break; case RelationshipStatus.InARelationship: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_InARelationshipMaleWith : CommonResources.ProfilePage_Info_InARelationshipFemaleWith; str2 = partnerNameCases.ins; break; } str1 = flag ? CommonResources.ProfilePage_Info_InARelationshipMale : CommonResources.ProfilePage_Info_InARelationshipFemale; break; case RelationshipStatus.Engaged: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_EngagedMaleWith : CommonResources.ProfilePage_Info_EngagedFemaleWith; str2 = partnerNameCases.ins; break; } str1 = flag ? CommonResources.ProfilePage_Info_EngagedMale : CommonResources.ProfilePage_Info_EngagedFemale; break; case RelationshipStatus.Married: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_MarriedMaleWith : CommonResources.ProfilePage_Info_MarriedFemaleWith; str2 = flag ? partnerNameCases.abl : partnerNameCases.ins; break; } str1 = flag ? CommonResources.ProfilePage_Info_MarriedMale : CommonResources.ProfilePage_Info_MarriedFemale; break; case RelationshipStatus.ItIsComplicated: if (num > 0L) { str1 = CommonResources.ProfilePage_Info_ItIsComplicatedWith; str2 = partnerNameCases.ins; break; } str1 = CommonResources.ProfilePage_Info_ItIsComplicated; break; case RelationshipStatus.ActivelySearching: str1 = CommonResources.ProfilePage_Info_ActivelySearching; break; case RelationshipStatus.InLove: if (num > 0L) { str1 = flag ? CommonResources.ProfilePage_Info_InLoveMaleWith : CommonResources.ProfilePage_Info_InLoveFemaleWith; str2 = partnerNameCases.acc; break; } str1 = flag ? CommonResources.ProfilePage_Info_InLoveMale : CommonResources.ProfilePage_Info_InLoveFemale; break; } this.Data = num > 0L ? (object)string.Format("{0} [id{1}|{2}]", (object)str1, (object)num, (object)str2) : (object)str1; }
public void CannotCreateSupplierWithParentAsChild(SupplierId subsidiaryId, SupplierId parentId, RelationshipStatus relationshipStatus) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId, relationshipStatus, new List <SupplierId> { parentId }));
/// <summary> /// Constructor /// </summary> public ActorResponseRelationshipStatus(T actor, RelationshipStatus status) { Actor = actor; RelationshipStatus = status; }
public void CannotCreateSupplierWithChildrenAsNull(SupplierId subsidiaryId, SupplierId parentId, RelationshipStatus relationshipStatus) => Assert.Throws <InconsistentState>(() => new Supplier(subsidiaryId, parentId, relationshipStatus, children: null));
public async Task <HttpResponseMessage> UpdateUserRelationshipStatus(string authenticationToken, string friendId, RelationshipStatus relationshipStatus) { try { using (var client = new HttpClient()) { var uri = new Uri(string.Format(EnvironmentConstants.getServerUrl() + "api/Account/UpdateUserRelationshipStatus/{0}/{1}", friendId, relationshipStatus.ToString())); client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Bearer " + authenticationToken); return(await client.PostAsync(uri, null)); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void PortalSecurity_IsInRoles_NonAdminUser_False_WhenRoleIsFriendRoleAndRelationshipIsNotAccepted(RelationshipStatus relationshipStatus) { // Arrange var user = new UserInfo { IsSuperUser = false, UserID = Constants.USER_TenId }; var relatedUser = new UserInfo { IsSuperUser = false, UserID = Constants.USER_ValidId }; string roles = "FRIEND:" + relatedUser.UserID; var mockUserController = new Mock <IUserController>(); mockUserController.Setup(uc => uc.GetUserById(It.IsAny <int>(), Constants.USER_ValidId)).Returns(relatedUser); UserController.SetTestableInstance(mockUserController.Object); var mockRelationShipController = new Mock <IRelationshipController>(); mockRelationShipController.Setup( rsc => rsc.GetFriendRelationship(It.Is <UserInfo>(u => u.UserID == Constants.USER_TenId), It.Is <UserInfo>(u => u.UserID == Constants.USER_ValidId))) .Returns(new UserRelationship() { Status = relationshipStatus }); RelationshipController.SetTestableInstance(mockRelationShipController.Object); var portalSettings = SetupPortalSettings(); // Act and Assert Assert.IsFalse(PortalSecurity.IsInRoles(user, portalSettings, roles)); }
public static RelationshipStatuses GetDistinctRelationshipStatus() { RelationshipStatuses relations = null; // get a configured DbCommand object DbCommand comm = DbAct.CreateCommand(); // set the stored procedure name comm.CommandText = "up_GetDistinctRelationshipStatus"; // execute the stored procedure DataTable dt = DbAct.ExecuteSelectCommand(comm); // was something returned? if (dt != null && dt.Rows.Count > 0) { relations = new RelationshipStatuses(); RelationshipStatus relation = null; foreach (DataRow dr in dt.Rows) { relation = new RelationshipStatus(FromObj.IntFromObj(dr["relationshipStatusID"])); if (relation.RelationshipStatusID == 0) continue; relations.Add(relation); } } return relations; }
// Use this for initialization void Start() { CurrentRelationshipStatus = RelationshipStatus.Single; Self = GetComponent <StudentAI>(); }