Exemplo n.º 1
0
        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(); }));
                    }
                }
            });
        }
Exemplo n.º 2
0
        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 {}
            });
        }
Exemplo n.º 3
0
        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);
        }