/// <summary>
        /// Обновление listview с Корзиной заказа. Содержит элементы корзины выделенного заказа.
        /// </summary>
        /// <returns></returns>
        private async Task Update_ListView_Carts()
        {
            List <Carts_Bouquets> lCarts_Bouquets = new List <Carts_Bouquets>();
            List <Carts>          lCarts          = await oCartsRepository.Select_Carts_Async("select * from carts where carts.orders_id = " + oClients_Orders.order.orders_id);

            foreach (var c in lCarts)
            {
                Carts_Bouquets carts_bouquets = new Carts_Bouquets();

                carts_bouquets.cart    = c;
                carts_bouquets.bouquet = await conn.GetAsync <Bouquets>(c.bouquets_id);

                lCarts_Bouquets.Add(carts_bouquets);
            }

            listview_Carts.ItemsSource = lCarts_Bouquets;
        }
Beispiel #2
0
        /// <summary>
        /// построение графика - отчет за день
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void button_build_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < day_chart.Series.Count; i++)
            {
                day_chart.Series.Remove(day_chart.Series[i]);
            }
            values = new List <KeyValuePair <string, int> >();
            List <Orders> list_orders = await oOrdersRepository.Select_All_Orders_Async();

            List <Data> list_data = new List <Data>();

            for (int i = 0; i < list_orders.Count; i++)
            {
                Data d = new Data();
                if (list_orders[i].datetime.Date == datepicker.SelectedDate)
                {
                    List <Carts> list_carts = await oCartsRepository.Select_Carts_Async("select count,bouquets_id from Carts where orders_id=" + list_orders[i].orders_id);

                    d.time = list_orders[i].datetime.TimeOfDay.ToString();
                    foreach (var c in list_carts)
                    {
                        d.count     = (int)c.count;
                        d.bouqet_id = c.bouquets_id;
                        list_data.Add(d);
                    }
                }
            }
            list_day_data = list_data;
            List <Bouquets> list_bouq = await oBouquetsRepository.Select_All_Bouquets_Async();

            for (int i = 0; i < list_bouq.Count; i++)
            {
                values = new List <KeyValuePair <string, int> >();
                for (int j = 0; j < list_data.Count; j++)
                {
                    if (list_data[j].bouqet_id == list_bouq[i].bouquets_id)
                    {
                        values.Add(new KeyValuePair <string, int>(list_data[j].time, list_data[j].count));
                    }
                }
                createLineSeries_Day(values, list_bouq[i].name);
                button_createExcel.IsEnabled = true;
            }
        }