コード例 #1
0
        /// <summary>
        /// Creates a card for the authorized user using AddCard behavior call. Then sets the authorized user's card number in LMS.
        /// </summary>
        /// <param name="strategy"></param>
        /// <param name="authorizedUser"></param>
        /// <returns></returns>
        public BaseResult AddCard(ClientStrategy strategy, AuthorizedUser authorizedUser)
        {
            var result    = new BaseResult();
            var lmsPerson = new LmsPerson()
            {
                AuthorizedUser = authorizedUser
            };
            string cardNumber = string.Empty;

            var addCardResult = strategy.AddCard(lmsPerson, out cardNumber);

            result.AppendResult(addCardResult);

            if (addCardResult.Result)
            {
                //Store the CCM AccountNumber received from the response to the authorized user CardNumber field
                var authUser = _app.AuthorizedUsers.SingleOrDefault(a => a.AuthorizedUserId == authorizedUser.AuthorizedUserId);
                authUser.CardNumber = cardNumber;
            }
            else
            {
                result.AddMessage(MessageType.Warning, $"An error occured creating the plastic card. The card will not be created on CCM for {authorizedUser.FirstName} {authorizedUser.LastName}.");
                result.Result = true;
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Creates a card for the primary or joint applicant using AddCard behavior call. Then sets the applicant's card number in LMS.
        /// </summary>
        /// <param name="strategy"></param>
        /// <param name="primaryOrJointApplicant"></param>
        /// <returns></returns>
        public BaseResult AddCard(ClientStrategy strategy, Applicant primaryOrJointApplicant)
        {
            var result    = new BaseResult();
            var lmsPerson = new LmsPerson()
            {
                Applicant = primaryOrJointApplicant
            };
            string cardNumber = string.Empty;

            var addCardStrategyResult = strategy.AddCard(lmsPerson, out cardNumber);

            result.AppendResult(addCardStrategyResult);

            if (addCardStrategyResult.Result)
            {
                // Store the CCM AccountNumber received from the response to the primary or joint applicant CardNumber field
                var applicant = _app.Applicants.SingleOrDefault(a => a.ApplicantId == primaryOrJointApplicant.ApplicantId);
                applicant.CardNumber = cardNumber;
            }
            else
            {
                var applicantName = (primaryOrJointApplicant.IsOrganization) ? primaryOrJointApplicant.OrganizationName : primaryOrJointApplicant.FullName;
                result.AddMessage(MessageType.Warning, $"An error occured creating the plastic card. The card will not be created on CCM for {applicantName}.");
                result.Result = true;
            }

            return(result);
        }