Esempio n. 1
0
        private ClientDates PostNY(ClientDates clientD)
        {
            Console.WriteLine(clientD.dateS);

            var ordersNY = (from c in _context.Clientes
                            join oNY in _context.OrdenesNewYork
                            on c.IdCliente equals oNY.IdCliente
                            where c.IdCliente == clientD.idClient
                            select new
            {
                OrderId = oNY.IdOrden,
                IdCliente = c.IdCliente,
                FechasOrden = oNY.FechaOrden,
                RequiredDate = oNY.RequiredDate
            }).ToList();
            int totalO = 0;

            foreach (var orders in ordersNY)
            {
                if (orders.FechasOrden >= clientD.dateS.Date && orders.FechasOrden <= clientD.dateE.Date)
                {
                    OrderDet orderTemp = new OrderDet();
                    orderTemp.OrderId      = orders.OrderId;
                    orderTemp.FechasOrden  = orders.FechasOrden;
                    orderTemp.RequiredDate = orders.RequiredDate;
                    clientD.orders.Add(orderTemp);
                    totalO += 1;
                }
            }

            clientD.totalOrders = totalO;

            return(clientD);
        }
Esempio n. 2
0
        public ClientDates Post(ClientDates clientD)
        {
            switch (Environment.GetEnvironmentVariable("CITY"))
            {
            case "NY":
                return(PostNY(clientD));

            case "CA":
                return(PostCal(clientD));

            case "TX":
                return(PostTX(clientD));

            default:
                return(clientD);
            }
        }