示例#1
0
        public override bool Execute()
        {
            if (!Verifier.CheckBankAccountNumber(BankAccountNumber))
            {
                Information = StringSource.BankAccountNumberStructureError();
                return(false);
            }

            using (var bankService = new BLL.ServiceReference1.BankServiceClient()) {
                BankAccount = bankService.GetBankAccountByNumber(BankAccountNumber);

                if (BankAccount == null)
                {
                    Information = StringSource.BankAccountNotFound();
                    return(false);
                }

                Currency = bankService.GetCurrencyById(BankAccount.CurrencyID);
            }

            if (Currency == null)
            {
                Information = StringSource.CurrencyNotFound();
                return(false);
            }

            IdBankAccount     = BankAccount.BankAccountID;
            Balance           = BankAccount.Balance.ToString();
            CurrencyName      = Currency.Name;
            CurrencyShortName = Currency.ShortName;
            IdCurrency        = Currency.CurrencyID;
            Information       = StringSource.BankAccountAndClientInfo(BankAccount, Customer, 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);
                }

                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);
        }
示例#3
0
        public override bool Execute()
        {
            if (IdBankAccount <= 0)
            {
                Information = StringSource.BankAccountNotFound();
                return(false);
            }

            using (var bankService = new BLL.ServiceReference1.BankServiceClient()) {
                BankAccount = bankService.GetBankAccountById(IdBankAccount);

                if (BankAccount == null)
                {
                    Information = StringSource.BankAccountNotFound();
                    return(false);
                }

                Currency = bankService.GetCurrencyById(BankAccount.CurrencyID);
            }

            using (var local = new DAL.Repositories()){
                Customer = local.Customers.GetSingle(BankAccount.CustomerID);
            }

            if (Currency == null)
            {
                Information = StringSource.CurrencyNotFound();
                return(false);
            }

            IdBankAccount = BankAccount.BankAccountID;

            Information = StringSource.BankAccountAndClientInfo(BankAccount, Customer, Currency);
            return(true);
        }
示例#4
0
        public override bool Execute()
        {
            if (!Verifier.CheckCardAccountNumber(CardAccountNumber))
            {
                Information = StringSource.CardAccountNumberStructureError();
                return(false);
            }

            StringBuilder textMessage = new StringBuilder();

            using (var bankService = new BLL.ServiceReference1.BankServiceClient()) {
                CardAccount = bankService.GetCardAccountByNumber(CardAccountNumber);
            }

            if (CardAccount != null)
            {
                using (var localrepos = new DAL.Repositories()) {
                    Customer = localrepos.Customers.GetSingle(CardAccount.CustomerID);
                }

                textMessage.Append(StringSource.CardAccountAndClientShortInfo(CardAccount, Customer));
                textMessage.Append("\n");
                if (CardAccount.IsLocked == true)
                {
                    textMessage.Append(StringSource.CardAccountLocked());
                }
                else
                {
                    textMessage.Append(StringSource.CardAccountUnlocked());
                }
            }
            else
            {
                Information = StringSource.CardAccountNotFound();
                return(false);
            }

            Information   = textMessage.ToString();
            IdCardAccount = CardAccount.CardAccountID;
            return(true);
        }
示例#5
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);
        }
        public override bool Execute()
        {
            if (!Verifier.CheckLogin(Login))
            {
                Information = StringSource.LoginStructureError();
                return(false);
            }
            if (!Verifier.CheckPassword(Password))
            {
                Information = StringSource.PasswordStructureError();
                return(false);
            }

            using (var bankService = new BLL.ServiceReference1.BankServiceClient()) {
                var user = bankService.GetEmployeeByLogin(Login);
                if (user == null || user.Password != Password)
                {
                    Information = StringSource.CheckAutentificationFalse();
                    return(false);
                }
            }
            Information = String.Empty;
            return(true);
        }
示例#7
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);
        }
示例#8
0
        public override bool Execute()
        {
            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);
            }



            var gen = new BLL.Generator()
            {
                NumberCount = DataSource.LengthCardAccountNumber
            };

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

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

                //if (BankAccount.CustomerID != IdClient) {
                //	Information=StringSource.BankAccountBelongsOtherCliente();
                //	return false;
                //}


                while (true)
                {
                    CartNumber = gen.NumberGenerate().ToString();
                    if (bankservices.GetBankAccountByNumber(CartNumber) == null)
                    {
                        break;
                    }
                }

                CardAccount = new CardAccount {
                    BankAccountID = BankAccount.BankAccountID,
                    CreatedDate   = DateTime.Now,
                    IsLocked      = false,
                    CustomerID    = Client.CustomerID,
                    CardNumber    = CartNumber,
                    ///////////////////////////////////////////////////////////////////////
                    Name        = CardAccountName,
                    IsDefault   = false,
                    CardType    = CardType,
                    ExpiredDate = ExpiredDate,
                    //ExtensionData=new System.Runtime.Serialization.ExtensionDataObject(),
                    Status = CardAccountStatus,
                    /////////////////////////////////////////////////
                };

                bankservices.AddCardAccount(CardAccount);
            }
            Information   = StringSource.CardAccountRegistred(CardAccount.CardNumber);
            IdCardAccount = CardAccount.CardAccountID;
            IdClient      = BankAccount.CustomerID;
            return(true);
        }