Exemplo n.º 1
0
        public override bool Execute()
        {
            if (IdCardAccount <= 0)
            {
                Information = StringSource.CardAccountNotFound();
                return(false);
            }

            using (var bankService = new BLL.ServiceReference1.BankServiceClient()) {
                CardAccount = bankService.GetCardAccountById(IdCardAccount);
                if (CardAccount == null)
                {
                    Information = StringSource.CardAccountNotFound();
                    return(false);
                }

                CardAccount.IsLocked = CardAccount.IsLocked == true ? false : true;
                CardAccount.Status   = CardAccount.IsLocked == true ?
                                       DataSource.CardStatusLocked : DataSource.CardStatusUnLocked;

                bankService.UpdateCardAccount(CardAccount);

                BankAccount = bankService.GetBankAccountById(CardAccount.BankAccountID);

                if (BankAccount != null)
                {
                    Currency = bankService.GetCurrencyById(BankAccount.CurrencyID);
                }
            }

            Information = CardAccount.IsLocked == true?StringSource.CardAccountLocked() : StringSource.CardAccountUnlocked();

            Information += "\n" + StringSource.CardAccountInformation(CardAccount, BankAccount, Currency);
            return(true);
        }
Exemplo n.º 2
0
        public override bool Execute()
        {
            if (IdCardAccount <= 0)
            {
                Information = StringSource.CardAccountNotFound();
                return(false);
            }
            if (!Verifier.CheckCardAccountNumber(CardAccountNumber))
            {
                Information = StringSource.CardAccountNumberStructureError();
                return(false);
            }
            if (!Verifier.CheckExpiredDate(ExpiredDate))
            {
                Information = StringSource.ExpiredDateStructureError();
                return(false);
            }
            if (!Verifier.CheckName(CardAccountName))
            {
                Information = StringSource.NameStructureError();
                return(false);
            }

            if (!Verifier.CheckName(CardType))
            {
                Information = StringSource.NameStructureError();
                return(false);
            }
            if (!Verifier.CheckName(CardAccountStatus))
            {
                Information = StringSource.NameStructureError();
                return(false);
            }


            using (var localrepos = new Repositories()) {
                Client = localrepos.Customers.GetSingle(IdClient);
            }
            if (Client == null)
            {
                Information = StringSource.ClientNotFound();
                return(false);
            }

            using (var bankservices = new BLL.ServiceReference1.BankServiceClient()) {
                BankAccount = bankservices.GetBankAccountById(IdBankAccount);
                if (BankAccount == null)
                {
                    Information = StringSource.BankAccountNotFound();
                    return(false);
                }

                CardAccount = bankservices.GetCardAccountById(IdCardAccount);
                if (CardAccount == null)
                {
                    Information = StringSource.CardAccountNotFound();
                    return(false);
                }

                //CardAccount.CardAccountID=
                CardAccount.BankAccountID = IdBankAccount;
                //CardAccount.CreatedDate
                CardAccount.IsLocked    = IsLocked;
                CardAccount.CustomerID  = IdClient;
                CardAccount.CardNumber  = CardAccountNumber;
                CardAccount.CardType    = CardType;
                CardAccount.ExpiredDate = ExpiredDate;
                CardAccount.Name        = CardAccountName;
                CardAccount.Status      = CardAccountStatus;
                //CardAccount.IsDefault

                bankservices.UpdateCardAccount(CardAccount);
            }

            Information = StringSource.CardAccountEdited();
            return(true);
        }