Example #1
0
        public async Task Init()
        {
            // calls to api/meats
            JsonServiceClient jsonClient = new JsonServiceClient("http://10.15.10.71:8989/");

            string response = await jsonClient.GetAsync <string>("api/meats");

            MeatList             = JsonConvert.DeserializeObject <List <Meat> >(response);
            BufferedMeatList     = MeatList.GetRange(0, bufferSize - 1);
            BufferedImageSources = new List <ImageSource>();
            foreach (var item in BufferedMeatList)
            {
                BufferedImageSources.Add(ImageHelper.GetImageSourceFromUrl(item.URI));
            }

            string response2 = await jsonClient.GetAsync <string>("api/restaurants");

            RestaurantList = JsonConvert.DeserializeObject <List <Restaurant> >(response2);

            CurrentIndex = 0;



            IsInitialized = true;
        }
Example #2
0
        public void MoveNext()
        {
            if (CurrentIndex < MeatList.Count() - 2)
            {
                CurrentIndex++;
            }

            if (!(bufferSize + CurrentIndex - 1 >= MeatList.Count()))
            {
                BufferedMeatList.Add(MeatList[bufferSize + CurrentIndex - 1]);
                BufferedImageSources.Add(ImageHelper.GetImageSourceFromUrl(MeatList[bufferSize + CurrentIndex - 1].URI));
            }
        }
        protected void CompanyList_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyPoint " + CompanyList.SelectedItem.Value, connection);
                connection.Open();
                Label25.Text = command.ExecuteScalar().ToString();
            }

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyFoods " + CompanyList.SelectedItem.Value + ", 'Soups'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                SoupList.DataSource     = reader;
                SoupList.DataTextField  = "FoodName";
                SoupList.DataValueField = "ID";
                SoupList.DataBind();
            }

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyFoods " + CompanyList.SelectedItem.Value + ", 'Main Foods'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                MainFoodList.DataSource     = reader;
                MainFoodList.DataTextField  = "FoodName";
                MainFoodList.DataValueField = "ID";
                MainFoodList.DataBind();
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyFoods " + CompanyList.SelectedItem.Value + ", 'Meats'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                MeatList.DataSource     = reader;
                MeatList.DataTextField  = "FoodName";
                MeatList.DataValueField = "ID";
                MeatList.DataBind();
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyFoods " + CompanyList.SelectedItem.Value + ", 'Salads'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                SaladList.DataSource     = reader;
                SaladList.DataTextField  = "FoodName";
                SaladList.DataValueField = "ID";
                SaladList.DataBind();
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyFoods " + CompanyList.SelectedItem.Value + ", 'Drinks'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                DrinkList.DataSource     = reader;
                DrinkList.DataTextField  = "FoodName";
                DrinkList.DataValueField = "ID";
                DrinkList.DataBind();
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetCompanyFoods " + CompanyList.SelectedItem.Value + ", 'Desserts'", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();
                DessertList.DataSource     = reader;
                DessertList.DataTextField  = "FoodName";
                DessertList.DataValueField = "ID";
                DessertList.DataBind();
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetStartHour " + CompanyList.SelectedItem.Value, connection);
                connection.Open();
                if (command.ExecuteScalar() != null)
                {
                    Label29.Text = command.ExecuteScalar().ToString();
                }
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetEndHour " + CompanyList.SelectedItem.Value, connection);
                connection.Open();
                if (command.ExecuteScalar() != null)
                {
                    Label31.Text = command.ExecuteScalar().ToString();
                }
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetMinimumPrice " + CompanyList.SelectedItem.Value, connection);
                connection.Open();
                if (command.ExecuteScalar() != null)
                {
                    Label33.Text = command.ExecuteScalar().ToString();
                }
            }
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("EXEC GetServiceTime " + CompanyList.SelectedItem.Value, connection);
                connection.Open();
                if (command.ExecuteScalar() != null)
                {
                    Label35.Text = command.ExecuteScalar().ToString();
                }
            }
        }