Пример #1
0
        public void UpdateLv1Info(UserAccount user, UpdateLv1InfoIM im)
        {
            if (user.L1VerifyStatus == VerifyStatus.Certified || user.L1VerifyStatus == VerifyStatus.UnderApproval)
            {
                throw new ApplicationException(MessageResources.AccountHasBeenVerification);
            }
            var profileSDK = new UserProfileAgent();

            int count = profileSDK.GetCountByIdentityDocNo(user.Id, im.IdentityDocNo);

            if (count >= Framework.Component.Constant.IDENTITY_LIMIT)
            {
                throw new CommonException(ReasonCode.IDENTITYNO_USED_OVERLIMIT, MessageResources.IdentityUsedOverLimit);
            }

            var sr = profileSDK.UpdateLv1Info(new Lv1Info
            {
                BackIdentityImage  = im.BackIdentityImage,
                FirstName          = im.FirstName,
                FrontIdentityImage = im.FrontIdentityImage,
                HandHoldWithCard   = im.HandHoldWithCard,
                Id              = user.Id,
                IdentityDocNo   = im.IdentityDocNo,
                IdentityDocType = (byte)((im.IdentityDocType != IdentityDocType.IdentityCard && im.IdentityDocType != IdentityDocType.Passport) ? IdentityDocType.IdentityCard : im.IdentityDocType),
                LastName        = im.LastName,
                L1VerifyStatus  = VerifyStatus.UnderApproval
            });

            if (sr)
            {
                new UserAccountDAC().UpdateL1VerfiyStatus(user.Id, (byte)VerifyStatus.UnderApproval);
            }
        }
Пример #2
0
        public ServiceResult <bool> UpdateLv1Info(UpdateLv1InfoIM im)
        {
            var result = new ServiceResult <bool>();

            if (!ModelState.IsValid)
            {
                result.Data = false;
                result.Code = ReasonCode.MISSING_REQUIRED_FIELDS;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }

                return(result);
            }

            new UserProfileComponent().UpdateLv1Info(this.GetUser(), im);
            result.Data = true;

            return(result);
        }