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); }
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); }
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); }
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); }