Esempio n. 1
0
        public void UpdateLv2Info(UserAccount user, UpdateLv2InfoIM im)
        {
            var profile = new UserProfileAgent().GetUserProfile(user.Id);

            if (user.L1VerifyStatus != VerifyStatus.Certified)
            {
                throw new ApplicationException(Resources.VerificationLv1First);
            }
            if (profile.L2VerifyStatus == VerifyStatus.Certified || profile.L2VerifyStatus == VerifyStatus.UnderApproval)
            {
                throw new ApplicationException(MessageResources.AccountHasBeenVerification);
            }
            var sr = new UserProfileAgent().UpdateLv2Info(new Lv2Info
            {
                Address1       = im.Address1,
                Address2       = im.Address2,
                City           = im.City,
                Id             = user.Id,
                Postcode       = im.Postcode,
                ResidentImage  = im.ResidentImage,
                State          = im.State,
                L2VerifyStatus = VerifyStatus.UnderApproval,
                Country        = profile.Country.Value
            });

            if (sr)
            {
                new UserAccountDAC().UpdateL2VerfiyStatus(user.Id, (byte)VerifyStatus.UnderApproval);
            }
        }
Esempio n. 2
0
        public ServiceResult <bool> UpdateLv2Info(UpdateLv2InfoIM 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().UpdateLv2Info(this.GetUser(), im);

            result.Data = true;

            return(result);
        }