public RestaurantFoodListing(ref Restaurant rest) { linRestaurant = rest; InitializeComponent(); CreateMyListView(); listener = db.CreateQueryForListener("orders", "RestaurantID", linRestaurant.RestaurantID).Listen( snapshot => { orders = new List <Order>(); foreach (DocumentSnapshot documentSnapshot in snapshot.Documents) { Order o = documentSnapshot.ConvertTo <Order>(); o.OrderID = documentSnapshot.Id; orders.Add(o); } //orders.Sort((x, y) => x.Status.CompareTo(y.Status)); if (orders != null) { orders = orders.OrderBy(order => order.Status).ToList(); if (orderShow) { listView1.Invoke(new Action(() => { refreshOrdersList(); })); } } }); }
public CustomerOrderHistory(Customer customer) { InitializeComponent(); CreateMyListView(); listener = db.CreateQueryForListener("orders", "CustomerID", customer.CustomerID).Listen( snapshot => { orders = new List <Order>(); foreach (DocumentSnapshot documentSnapshot in snapshot.Documents) { Order o = documentSnapshot.ConvertTo <Order>(); o.OrderID = documentSnapshot.Id; orders.Add(o); } try { //orders.Sort((x, y) => x.Status.CompareTo(y.Status)); if (orders != null) { orders = orders.OrderBy(order => order.Status).ToList(); listView1.BeginInvoke(new Action(() => { refreshOrdersList(); })); } } catch {} }); }
public CourierMain(ref Courier cour) { linCourier = cour; InitializeComponent(); CreateMyListView(); listView1.Visible = false; listener = db.CreateQueryForListener("orders", "CourierID", cour.CourierID).Listen( snapshot => { orders = new List <Order>(); foreach (DocumentSnapshot documentSnapshot in snapshot.Documents) { Order o = documentSnapshot.ConvertTo <Order>(); o.OrderID = documentSnapshot.Id; orders.Add(o); } //orders.Sort((x, y) => x.Status.CompareTo(y.Status)); orders = orders.OrderBy(order => order.Status).ToList(); listView1.Invoke(new Action(() => { refreshOrdersList(); })); }); //db.changeAvailabity(linCourier.CourierID, false); }