示例#1
0
        // Handle hashes for everything but the managers / service owners isCertified and the
        // risk rating. The isCertified stuff gets reset everytime a new cycle happens and
        // risk rating is calculated from threat and likelihood ratings so we can ignore those
        public override int GetHashCode()
        {
            int hashUserId       = UserId == null ? 0 : UserId.GetHashCode();
            int hashUserFullName = UserFullName == null ? 0 : UserFullName.GetHashCode();

            int hashRoleId           = RoleId == null ? 0 : RoleId.GetHashCode();
            int hashRoleName         = RoleName == null ? 0 : RoleName.GetHashCode();
            int hashRoleDescription  = RoleDescription == null ? 0 : RoleDescription.GetHashCode();
            int hashRoleOwner_RoleId = RoleOwner_RoleId == null ? 0 : RoleOwner_RoleId.GetHashCode();

            int hashLastCertifiedBy   = LastCertifiedBy == null ? 0 : LastCertifiedBy.GetHashCode();
            int hashLastCertifiedDate = LastCertifiedDate == null ? 0 : LastCertifiedDate.GetHashCode();

            // Calculate the hash code for the object.
            return(hashUserId ^
                   hashUserFullName ^

                   hashRoleId ^
                   hashRoleName ^
                   hashRoleDescription ^
                   hashRoleOwner_RoleId ^

                   hashLastCertifiedBy ^
                   hashLastCertifiedDate);
        }
示例#2
0
        public void ShouldUpdatePhotoUrlUponProfilePhotoUploaded()
        {
            var userProfile = new UserProfile(new UserProfileId(Guid.NewGuid()), UserFullName.FromString("Mike Seller"), UserDisplayName.FromString("mike88"));

            userProfile.ProfilePhotoUploaded(new Uri("http://example.com/photo.jpg"));
            Assert.Equal("http://example.com/photo.jpg", userProfile.PhotoUrl.ToString());
        }
示例#3
0
        // The following methods support the delta reports
        public bool Equals([AllowNull] UserRoleAllDTO other)
        {
            // Check whether the compared object is null.
            if (other is null)
            {
                return(false);
            }

            // Check whether the compared object references the same data.
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Check whether the objects’ properties are equal.
            return(UserId.Equals(other.UserId) &&
                   UserFullName.Equals(other.UserFullName) &&

                   RoleId.Equals(other.RoleId) &&
                   RoleName.Equals(other.RoleName) &&
                   RoleDescription.Equals(other.RoleDescription) &&
                   RoleOwner_RoleId.Equals(other.RoleOwner_RoleId) &&

                   LastCertifiedBy.Equals(other.LastCertifiedBy) &&
                   LastCertifiedDate.Equals(other.LastCertifiedDate));
        }
示例#4
0
 public RequestedLeavesOfUser(string userId, string userFullName)
 {
     InitializeComponent();
     BackgroundColor   = ColorResources.PageBackgroundColor;
     this.UserId       = userId;
     this.UserFullName = userFullName;
     Title             = UserFullName.ToString();
 }
示例#5
0
        public void ShouldAllowUpdateOfDisplayName()
        {
            var id          = Guid.NewGuid();
            var userProfile = new UserProfile(new UserProfileId(id), UserFullName.FromString("Mike Seller"), UserDisplayName.FromString("mike88"));

            userProfile.UpdateDisplayName(UserDisplayName.FromString("Mike99"));
            Assert.Equal("Mike99", userProfile.DisplayName.Value);
        }
示例#6
0
        public void ShouldCreateWhenValidIdFullNameAndDisplayNameAreProvided()
        {
            var id          = Guid.NewGuid();
            var userProfile = new UserProfile(new UserProfileId(id), UserFullName.FromString("Mike Seller"), UserDisplayName.FromString("mike88"));

            Assert.Equal(id, userProfile.Id.Value);
            Assert.Equal("Mike Seller", userProfile.FullName.Value);
            Assert.Equal("mike88", userProfile.DisplayName.Value);
        }
示例#7
0
        public IActionResult GetFullName(string email)
        {
            var result = _userService.GetByMail(email);

            if (result.Success)
            {
                UserFullName userFullName = new UserFullName {
                    FirstName = result.Data.FirstName, LastName = result.Data.LastName
                };
                return(Ok(userFullName));
            }
            return(BadRequest(result));
        }
        public IActionResult Step1(UserFullName fio)
        {
            _provider.IncrementValidationCounter();
            if (!ModelState.IsValid)
            {
                return(View(fio));
            }

            var user = _provider.GetUser();

            user.FullName = fio;
            _provider.SaveUser(user);
            return(RedirectToAction("Continue"));
        }
示例#9
0
        protected override void Execute(CodeActivityContext activityContext, IWorkflowContext workflowContext, IOrganizationService CrmService, ITracingService trace)
        {
            try
            {
                string userName = UserFullName.Get(activityContext);

                if (string.IsNullOrWhiteSpace(userName))
                {
                    IsSuccess.Set(activityContext, false);
                    Message.Set(activityContext, "User's Full Name  is not provided");
                    return;
                }

                var QEsystemuser = new QueryExpression("systemuser");
                QEsystemuser.ColumnSet.AddColumns("fullname");
                var QEsystemuser_Criteria_0 = new FilterExpression();
                QEsystemuser.Criteria.AddFilter(QEsystemuser_Criteria_0);
                QEsystemuser_Criteria_0.FilterOperator = LogicalOperator.Or;
                QEsystemuser_Criteria_0.AddCondition("fullname", ConditionOperator.Equal, userName);
                QEsystemuser_Criteria_0.AddCondition("fullname", ConditionOperator.Equal, ChangeNameOrder(userName));
                var results = CrmService.RetrieveMultiple(QEsystemuser);

                if (results == null || !results.Entities.Any())
                {
                    IsSuccess.Set(activityContext, false);
                    Message.Set(activityContext, "User with " + userName + " not found");
                    return;
                }

                if (results.Entities.Count > 1)
                {
                    IsSuccess.Set(activityContext, false);
                    Message.Set(activityContext, "Multiple users found with same name : " + userName);
                    return;
                }


                IsSuccess.Set(activityContext, true);
                PreparedBy.Set(activityContext, results.Entities.Single().ToEntityReference());
            }
            catch (Exception ex)
            {
                IsSuccess.Set(activityContext, false);
                Message.Set(activityContext, "An error occurred trying to find user : " + ex.Message);
            }
        }
        /// <inheritdoc />
        public async Task UpdateProfile(int userId,
                                        UserFullName userFullName,
                                        Gender gender,
                                        string phoneNumber,
                                        string nicknames,
                                        string groupNames,
                                        string skype,
                                        string livejournal,
                                        string telegram,
                                        ContactsAccessType socialAccessType)
        {
            if (CurrentUserId != userId)
            {
                throw new JoinRpgInvalidUserException();
            }
            var user = await UserRepository.WithProfile(userId);

            if (!user.VerifiedProfileFlag)
            {
                user.SurName    = userFullName.SurName?.Value;
                user.FatherName = userFullName.FatherName?.Value;
                user.BornName   = userFullName.GivenName?.Value;
            }
            user.PrefferedName = userFullName.PrefferedName;

            user.Extra ??= new UserExtra();
            user.Extra.Gender = gender;

            if (!user.VerifiedProfileFlag)
            {
                user.Extra.PhoneNumber = phoneNumber;
            }
            user.Extra.Nicknames  = nicknames;
            user.Extra.GroupNames = groupNames;
            user.Extra.Skype      = skype;
            var tokensToRemove = new[]
            { "http://", "https://", "vk.com", "vkontakte.ru", ".livejournal.com", ".lj.ru", "t.me", "/", };

            user.Extra.Livejournal = livejournal?.RemoveFromString(tokensToRemove);
            user.Extra.Telegram    = telegram?.RemoveFromString(tokensToRemove);

            user.Extra.SocialNetworksAccess = socialAccessType;

            await UnitOfWork.SaveChangesAsync();
        }
示例#11
0
        static void Main(string[] args)
        {
            while (true)//loop for test purposes
            {
                string UserFullName;
                string UserForename;
                string UserSurname;
                int    LenghtOfUserFullName;
                int    PositionOfComa;

                Console.WriteLine("Please Enter the Fullname in the following format: Surname,Firstname.");
                UserFullName         = Console.ReadLine();
                LenghtOfUserFullName = UserFullName.Length;                          //use of a method
                PositionOfComa       = UserFullName.IndexOf(',');                    // finds the position of ','
                UserSurname          = UserFullName.Substring(0, PositionOfComa);    //makes the surname equal to the characters from index 0 to where the coma is.
                UserForename         = UserFullName.Substring(Position of coma + 1); //makes forename the charcters from where the coma is to the end of the strin.
                // UserForename = UserForename.Replace(',', ' ');//ask sir, to find a better alternative.
                Console.WriteLine("Firstname:{0}", UserForename);
                Console.WriteLine("Surname: {0}.", UserSurname);
            }
        }