Example #1
0
        public void AddAddress(UserAccount account, BillerAddAddressIM im)
        {
            var count = new BillerAddressDAC().GetAllAddresses(account.Id).Count;

            if (count >= 500)
            {
                throw new CommonException(ReasonCode.BillerOverMaxAddressCount, Resources.BillerOverAddressMaxCount);
            }

            if (new BillerAddressDAC().GetAllAddresses(account.Id).Any(item =>
                                                                       item.BillerCode == im.BillerCode && im.ReferenceNumber == item.ReferenceNumber))
            {
                throw new CommonException(ReasonCode.BillerAddressExisted, Resources.BillerAddressExisted);
            }
            var address = new BillerAddress()
            {
                BillerCode      = im.BillerCode,
                IconIndex       = im.IconIndex,
                ReferenceNumber = im.ReferenceNumber,
                Tag             = im.Tag,
                AccountId       = account.Id,
                Timestamp       = DateTime.UtcNow
            };

            new BillerAddressDAC().Insert(address);
        }
Example #2
0
 public ServiceResult <bool> AddAddress(BillerAddAddressIM im)
 {
     new BillerComponent().AddAddress(this.GetUser(), im);
     return(new ServiceResult <bool>()
     {
         Data = true,
         Code = 0
     });
 }