Beispiel #1
0
        public override bool Execute()
        {
            var isbs = base.Execute();

            if (!isbs)
            {
                return(false);
            }

            int id = 0;

            using (var localrepos = new DAL.Repositories()) {
                id = LastElement == null?0:LastElement.CustomerID;
                if (!IsUpdate)
                {
                    if (IsNext)
                    {
                        Entities    = localrepos.Customers.GetAll(el => el.CustomerID > id);
                        CurrentList = Entities.Take(AmountElements).ToList();
                    }
                    else
                    {
                        id       = FirstElement == null?int.MaxValue:FirstElement.CustomerID;
                        Entities = localrepos.Customers.GetAll().OrderByDescending(el => el.CustomerID).
                                   Where(el => el.CustomerID < id);
                        CurrentList = Entities.Take(AmountElements).OrderBy(el => el.CustomerID).ToList();
                    }
                }
                else
                {
                    Entities    = localrepos.Customers.GetAll().Where(el => el.CustomerID >= id);
                    CurrentList = Entities.Take(AmountElements).ToList();
                }
            }

            if (CurrentList != null && CurrentList.Count > 0)
            {
                FirstElement = CurrentList.First();
                LastElement  = CurrentList.Last();
            }
            else
            {
                FirstElement = null;
                LastElement  = null;
                Information  = StringSource.EndList();
                return(false);
            }

            foreach (var el in CurrentList)
            {
                EntitiesInformation.Add(StringSource.ClientInformation(el, false));
                IdsEntities.Add(el.CustomerID);
            }

            Information = StringSource.Successfully();
            return(true);
        }
        public override bool Execute()
        {
            var isbs = base.Execute();

            if (!isbs)
            {
                return(false);
            }

            int id = 0;

            using (var services = new BankServiceClient()) {
                id = LastElement == null ? 0 : LastElement.BankAccountID;
                if (!IsUpdate)
                {
                    if (IsNext)
                    {
                        CurrentList = services.GetNextBankAccounts(id, AmountElements).ToList();
                    }
                    else
                    {
                        if (FirstElement == null)
                        {
                            id = int.MaxValue;
                        }
                        else
                        {
                            id = FirstElement.BankAccountID;
                        }
                        CurrentList = services.GetPrevBankAccounts(id, AmountElements).ToList();
                    }
                }
                else
                {
                    CurrentList = services.GetNextBankAccounts(id - 1, AmountElements).ToList();
                }

                Currencies = services.GetAllCurrency().ToArray();
            }

            if (CurrentList != null && CurrentList.Count > 0)
            {
                FirstElement = CurrentList.First();
                LastElement  = CurrentList.Last();
            }
            else
            {
                FirstElement = null;
                LastElement  = null;
                Information  = StringSource.EndList();
                return(false);
            }

            Customer cust = null;
            Currency curr = null;

            using (var localrepos = new DAL.Repositories()) {
                Customers = localrepos.Customers.GetAll();
                foreach (var el in CurrentList)
                {
                    if (Customers.Count() > 0)
                    {
                        cust = Customers.FirstOrDefault(cs => cs.CustomerID == el.CustomerID);
                    }
                    if (Currencies.Count() > 0)
                    {
                        curr = Currencies.FirstOrDefault(cur => cur.CurrencyID == el.CurrencyID);
                    }
                    EntitiesInformation.Add(
                        StringSource.BankAccountAndClientInfo(el, cust, curr));
                    IdsEntities.Add(el.BankAccountID);
                }
            }
            Information = StringSource.Successfully();
            return(true);
        }
Beispiel #3
0
        public override bool Execute()
        {
            var isbs = base.Execute();

            if (!isbs)
            {
                return(false);
            }

            int id = 0;

            using (var services = new BankServiceClient()) {
                id = LastElement == null ? 0 : LastElement.EmployeeID;
                if (!IsUpdate)
                {
                    if (IsNext)
                    {
                        CurrentList = services.GetNextOperators(id, AmountElements).ToList();
                    }
                    else
                    {
                        if (FirstElement == null)
                        {
                            id = int.MaxValue;
                        }
                        else
                        {
                            id = FirstElement.EmployeeID;
                        }
                        CurrentList = services.GetPrevOperators(id, AmountElements).ToList();
                    }
                }
                else
                {
                    CurrentList = services.GetNextOperators(id - 1, AmountElements).ToList();
                }
            }

            if (CurrentList != null && CurrentList.Count > 0)
            {
                FirstElement = CurrentList.First();
                LastElement  = CurrentList.Last();
            }
            else
            {
                FirstElement = null;
                LastElement  = null;
                Information  = StringSource.EndList();
                return(false);
            }

            foreach (var el in CurrentList)
            {
                EntitiesInformation.Add(
                    StringSource.OperatorInformation(el));
                IdsEntities.Add(el.EmployeeID);
            }

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