示例#1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dictionaryManufacturers = Manufacturer.GetManufacturers();
            dictionarySymptoms      = Symptom.GetSymptoms();
            dictionaryCountries     = Country.GetCountries();

            foreach (Manufacturer manufacturer in dictionaryManufacturers)
            {
                CheckBox checkBox = new CheckBox
                {
                    Content = manufacturer.ManufacturerName
                };
                ManufacturerScrollViewer.Children.Add(checkBox);
            }
            foreach (Country country in dictionaryCountries)
            {
                CheckBox checkBox = new CheckBox
                {
                    Content = country.CountryName
                };
                checkBox.Click += CountryCheckBoxChange;
                CountryScrollViewer.Children.Add(checkBox);
            }
            foreach (Symptom symptom in dictionarySymptoms)
            {
                Button button = new Button();
                button.Click  += SymptomButton_Click;
                button.Content = symptom.SymptomName;
                SymptomScrollViewer.Children.Add(button);
            }

            //Randoming purchases

            //List<Drug> listOfDrugs = Drug.GetAllDrugs();

            //Random random = new Random();
            //for (int i = 0; i < 100; i++)
            //{
            //    int number = random.Next() % listOfDrugs.Count;
            //    int amount = random.Next() % 10 + 1;
            //    string wprice = "";

            //    if (listOfDrugs[number].WPricesList.Count > 0)
            //    {
            //        int j = 0;
            //        while (j < listOfDrugs[number].WPricesList.Count
            //            && amount >= listOfDrugs[number].WPricesList[j].Minimal_amount_of_product)
            //        {
            //            j++;
            //        }
            //        if (j != 0)
            //        {
            //            wprice = listOfDrugs[number].WPricesList[j - 1].Price;
            //        }
            //    }
            //    if (wprice != String.Empty)
            //    {
            //        List<Tuple<Drug, int, string>> d = new List<Tuple<Drug, int, string>>() {
            //            new Tuple<Drug, int, string>(listOfDrugs[number], amount, wprice)
            //        };
            //        Drug.AddPurchase(d, "newuser");
            //    }
            //    else
            //    {
            //        List<Tuple<Drug, int, string>> d = new List<Tuple<Drug, int, string>>() {
            //            new Tuple<Drug, int, string>(listOfDrugs[number], amount, listOfDrugs[number].Retail_price)
            //        };
            //        Drug.AddPurchase(d, "newuser");
            //    }

            //}

            ShowContent(FormFilterRequest());
        }