예제 #1
0
        public AddressVerificationNumberVm CreateEnterVerificationNumberVm(string addressId)
        {
            addressId.IsNullOrWhiteSpaceThrowArgumentException("addressId");

            AddressMain address = Find(addressId);

            address.IsNullThrowException("Address not found.");

            AddressVerificationNumberVm vm = new AddressVerificationNumberVm();

            vm.AddressId   = address.Id;
            vm.AddressName = address.FullName();

            return(vm);
        }
예제 #2
0
        //this verifies the verification code and updates the AddressVerificationTrx and AddressWithId
        public void VerifiyAddressCode(AddressVerificationNumberVm avnVM, GlobalObject globalObject)
        {
            avnVM.IsNullThrowExceptionArgument("Address Verification not recieved");
            avnVM.VerificaitonNumber.IsNullOrWhiteSpaceThrowException("Verification is blank.");
            avnVM.AddressId.IsNullOrWhiteSpaceThrowException("Address Id not recieved");

            AddressMain address = Find(avnVM.AddressId);

            address.IsNullThrowException("Address not found");

            long lngVerificationNumber;
            bool success = long.TryParse(avnVM.VerificaitonNumber, out lngVerificationNumber);

            if (!success)
            {
                throw new Exception("Unable to read the verification number");
            }

            if (address.Verification.VerificationNumber != lngVerificationNumber)
            {
                throw new Exception("Verification number does not match!");
            }

            AddressVerificationTrx addressVerificationTrx = address
                                                            .AddressVerificationTrxs
                                                            .FirstOrDefault(x => x.Verification.VerificaionStatusEnum == EnumLibrary.EnumNS.VerificaionStatusENUM.Mailed);

            addressVerificationTrx.IsNullThrowException("Unable to locate Address Verification Trx");

            address.Verification.VerificaionStatusEnum = VerificaionStatusENUM.Verified;
            addressVerificationTrx.Verification.VerificaionStatusEnum = VerificaionStatusENUM.Verified;

            _addressVerificationTrxBiz.Update(addressVerificationTrx);


            ControllerCreateEditParameter param = new ControllerCreateEditParameter();

            param.Entity       = address as ICommonWithId;
            param.GlobalObject = globalObject;


            UpdateAndSave(param);
        }