Ejemplo n.º 1
0
        // Devuelve el histórico de pedidos del cliente 'client'
        public static List <HistoricalOrder> selectHistoricalOrders(string client)
        {
            List <HistoricalOrder> orders = new List <HistoricalOrder>();

            db.connect();
            MySqlDataReader data;

            if (client.Equals(""))
            {
                data = db.getData("SELECT * FROM Historical");
            }
            else
            {
                data = db.getData("SELECT * FROM Historical WHERE client = '" + client + "'");
            }
            while (data.Read())
            {
                HistoricalOrder o = new HistoricalOrder();
                o.Client  = data.GetString(1).Trim();
                o.Product = data.GetString(2).Trim();
                o.Amount  = data.GetInt32(3);
                o.Date    = DateTime.Parse(data.GetDateTime(4).ToString());
                orders.Add(o);
            }
            return(orders);
        }
Ejemplo n.º 2
0
        public static async Task Run([ActivityTrigger] HistoricalOrder historicalOrder, [CosmosDB(
                                                                                             databaseName: "FaceAggregator",
                                                                                             collectionName: "OrdersHistory",
                                                                                             ConnectionStringSetting = "CosmosDBConnection")] IAsyncCollector <dynamic> documents)
        {
            await documents.AddAsync(new { id = Guid.NewGuid(), historicalOrder.RecognitionOrder.RecognitionName, historicalOrder.RecognitionOrder.SourcePath, historicalOrder.RecognitionOrder.PatternFaces, historicalOrder.RecognitionOrder.DestinationFolder, historicalOrder.RecognitionOrder.EmailAddress, historicalOrder.RecognitionOrder.PhoneNumber, historicalOrder.RecognizedFiles });

            await documents.FlushAsync();
        }
Ejemplo n.º 3
0
        // Devuelve la lista de pedidos históricos de la tabla 'Historical'
        public static List <HistoricalOrder> selectHOrders(int amount, bool ascending)
        {
            List <HistoricalOrder> orders = new List <HistoricalOrder>();

            db.connect();
            // 'amount' indica la cantidad de elementos y 'ascending' el orden de búsqueda (ascendente o descendente)
            MySqlDataReader data = db.getData("SELECT * FROM Historical ORDER BY date " + (ascending ? "ASC" : "DESC") + " LIMIT 0," + (--amount));

            while (data.Read())
            {
                HistoricalOrder o = new HistoricalOrder();
                o.Client  = data.GetString(1).Trim();
                o.Product = data.GetString(2).Trim();
                o.Amount  = data.GetInt32(3);
                o.Date    = DateTime.Parse(data.GetDateTime(4).ToString());
                orders.Add(o);
            }
            return(orders);
        }