public override bool Execute() { Client = null; if (IdClient <= 0) { Information = StringSource.ClientNotFound(); return(false); } using (var localrepos = new DAL.Repositories()) { Client = localrepos.Customers.GetSingle(IdClient); } if (Client != null) { Information = StringSource.ClientInformation(Client); return(true); } else { Information = StringSource.ClientNotFound(); return(false); } }
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); }
public override bool Execute() { IdClient = -1; if (PassportNumber == null) { if (!Verifier.CheckLogin(Login)) { Information = StringSource.LoginStructureError(); return(false); } using (var localrepos = new DAL.Repositories()) { ////////////////////////////////////////////////////////////////////////// var tempo = localrepos.Customers.GetAll(); if (tempo != null && tempo.Count() > 0) { var tt = tempo.Where(el => el.Login == Login).ToList(); Client = tt.Count() > 0 ? tt.ElementAt(0) : null; } } } else { if (!Verifier.CheckPassportNumber(PassportNumber)) { Information = StringSource.PassportNumberStructureError(); return(false); } using (var localrepos = new DAL.Repositories()) { if (localrepos.Customers.GetAll(el => el.PassportNumber == PassportNumber).Count() > 1) { Information = StringSource.MorePassportnumberError(); return(false); } ////////////////////////////////////////////////////////////////////////// var tempo = localrepos.Customers.GetAll(); if (tempo != null && tempo.Count() > 0) { var tt = tempo.Where(el => el.PassportNumber == PassportNumber).ToList(); Client = tt.Count() > 0 ? tt.ElementAt(0) : null; } } } if (Client != null) { IdClient = Client.CustomerID; PassportNumber = Client.PassportNumber; Login = Client.Login; Information = StringSource.ClientInformation(Client); return(true); } else { Information = StringSource.ClientNotFound(); return(false); } }