コード例 #1
0
        public void FillListData(IEnumerable <Object> query)
        {
            if (lvReports.Items.Count >= 1)
            {
                lvReports.Items.Clear();
            }
            var queryTrips = HandleItems.GetTrips();

            foreach (var item in queryTrips)
            {
                //Type type = item.GetType();
                //var properties = type.GetProperties();

                var id          = item.GetType().GetProperty("id").GetValue(item).ToString();
                var consultant  = item.GetType().GetProperty("consultant").GetValue(item).ToString();
                var destination = item.GetType().GetProperty("destination").GetValue(item).ToString();
                var date        = item.GetType().GetProperty("date").GetValue(item).ToString();
                var state       = item.GetType().GetProperty("status").GetValue(item);
                if (state == null)
                {
                    state = "Offline";
                }
                if ((int)state == 2)
                {
                    state = "EJ OK";
                }
                else if ((int)state == 1)
                {
                    state = "OK";
                }
                else
                {
                    state = "Väntar";
                }

                lvReports.Items.Add(new { id, consultant, destination, date, status = state });
            }
            var serializedTrips = Serializer.Load();

            foreach (var item in serializedTrips)
            {
                lvReports.Items.Add(new
                {
                    id          = item.myTrip.TripId,
                    consultant  = item.myTrip.User,
                    destination = item.myTrip.Destination,
                    date        = item.myTrip.Start,
                    status      = item.myTrip.Status
                });
            }
        }
コード例 #2
0
        private void rbFilterAll_Checked(object sender, RoutedEventArgs e)
        {
            var query = HandleItems.GetTrips();

            FillListData(query);
        }
コード例 #3
0
 private void btnGetOwnReports_Click(object sender, RoutedEventArgs e)
 {
     FillListData(HandleItems.GetTrips());
 }