示例#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);
        }
示例#2
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);
                }

                BankAccount = bankService.GetBankAccountById(CardAccount.BankAccountID);
                if (BankAccount == null)
                {
                    Information = StringSource.BankAccountNotFound();
                    return(false);
                }

                Currency = bankService.GetCurrencyById(BankAccount.CurrencyID);
                if (Currency == null)
                {
                    Information = StringSource.CurrencyNotFound();
                    return(false);
                }
            }

            using (var local = new DAL.Repositories()) {
                Customer = local.Customers.GetSingle(CardAccount.CustomerID);
                if (Customer == null)
                {
                    Information = StringSource.CurrencyNotFound();
                    return(false);
                }
            }


            Information = StringSource.CardAccountAndClientShortInfo(CardAccount, Customer);
            return(true);
        }
示例#3
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);
                }
                bankservice.RemoveCardAccount(CardAccount);
            }

            Information = StringSource.CardAccountRemoved(CardAccount.CardNumber);
            return(true);
        }
示例#4
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);
        }