Esempio n. 1
0
        private void CodedBy_Click(object sender, RoutedEventArgs e)
        {
            popup win = new popup();

            win.popupWindow.Text = "Coded by Team Charlie:\nDitte Slyngborg\nJanus B. Reedtz\nMartin Nørholm\nRezan Razoul";
            win.Show();
        }
Esempio n. 2
0
 public void choiceClick(popup choiceOne)
 {
     choice.SetActive(false);
     currentChoice = choiceOne;
     sentances     = HandleText();
     startConvo(choiceOne);
 }
Esempio n. 3
0
        private void CallDownload_Click(object sender, RoutedEventArgs e)
        {
            if (Directory.Exists(fileExtract) == false)
            {
                Directory.CreateDirectory(fileExtract);
            }
            else
            {
                DirectoryInfo dir = new DirectoryInfo(fileExtract);
                foreach (FileInfo fi in dir.GetFiles())
                {
                    fi.Delete();
                }
            }
            KommuneName.Text = "";
            var          hw  = new HtmlWeb();
            HtmlDocument doc = hw.Load("https://covid19.ssi.dk/overvagningsdata/download-fil-med-overvaagningdata");
            string       url = doc.DocumentNode.SelectSingleNode("//blockquote[@class='factbox']//p//a").Attributes["href"].Value.ToString();

            if (!string.IsNullOrEmpty(url))
            {
                Uri uri = new Uri(url);
                client.DownloadFileAsync(uri, @"C:\Temp\Corona.zip");
            }
            //hejhej
            Thread.Sleep(500);

            ExtractFile();
            popup p = new popup();

            p.popupWindow.Text = "Files downloaded!";
            p.Show();
        }
Esempio n. 4
0
        public void showCheck(string msj)
        {
            contador += 1;
            popup p = new popup("", contador, popup.AlertType.check);

            l.Add(p);
            new Thread(new ThreadStart(manage)).Start();
        }
Esempio n. 5
0
 public void ChoiceTwoClick()
 {
     currentChoice = currentChoice.choiceTwo;
     choice.SetActive(false);
     sentances    = HandleText();
     index        = 0;
     textBox.text = "";
     startConvo(currentChoice);
 }
Esempio n. 6
0
 public void startConvo(popup Talking)
 {
     dialogueParent.SetActive(true);
     currentChoice    = Talking;
     sentances        = HandleText();
     sentancesWONames = HandleSentences();
     characterNames   = HandleNames();
     textBox.text     = "";
     nameBox.text     = characterNames[index];
     isTalking        = true;
     StartCoroutine("Type");
 }
        //Data to insert to Infected but in a "perfect" version of the app it would be inserted from the csv-files.
        public void InsertSomeData()
        {
            popup win = new popup();

            try
            {
                SqlCommand inserts = new SqlCommand(
                    @"INSERT INTO Infected (numberTested,numberInfected,municipalityID,date)VALUES
                (1050, 1, 4, '2020-01-01'),(1060, 2, 5, '2020-01-01'),(1070, 3, 6, '2020-01-01'),
                (1180, 4, 4, '2020-02-01'),(1190, 5, 5, '2020-02-01'),(1200, 6, 6, '2020-02-01'),
                (1300, 7, 4, '2020-03-01'),(1310, 8, 5, '2020-03-01'),(1320, 9, 6, '2020-03-01'),
                (1500, 21, 4, '2020-04-01'),(1510, 22, 5,'2020-04-01'),(1520, 23, 6, '2020-04-01'),
                (1600, 14, 4, '2020-05-01'),(1610, 15, 5, '2020-05-01'),(1620, 16, 6, '2020-05-01'),
                (1700, 17, 4, '2020-06-01'),(1710, 18, 5, '2020-06-01'),(1720, 19, 6, '2020-06-01'),
                (1750, 21, 4, '2020-07-01'),(1760, 22, 5, '2020-07-01'),(1770, 23, 6, '2020-07-01'),
                (1800, 24, 4, '2020-08-01'),(1810, 25, 5, '2020-08-01'),(1820, 26, 6, '2020-08-01'),
                (1850, 27, 4, '2020-09-01'),(1860, 28, 5, '2020-09-01'),(1870, 29, 6, '2020-09-01'),
                (2018, 17, 4, '2020-10-01'), (2019, 18, 5, '2020-10-01'), (2020, 19, 6, '2020-10-01'),
                (2069, 21, 4, '2020-11-01'), (2069, 22, 5, '2020-11-01'), (2070, 23, 6, '2020-11-01'),
                (2118, 24, 4, '2020-12-01'), (2119, 25, 5, '2020-12-01'), (2120, 26, 6, '2020-12-01'),
                (2268, 27, 4, '2021-01-14'), (2269, 28, 5, '2021-01-14'), (2270, 29, 6, '2021-01-14')"
                    , connString);
                connString.Open();
                inserts.ExecuteNonQuery();
                win.popupWindow.Text     = "DATA ER SENDT!";
                win.popupWindow.FontSize = 40;
                win.Show();
            }
            catch (Exception ex)
            {
                win.popupWindow.Text = "Kunne ikke hente data. Dette er fejlmeddelelsen:\n" + ex.Message;
                win.Show();
            }
            finally
            {
                if (connString != null && connString.State == ConnectionState.Open)
                {
                    connString.Close();
                }
            }
        }
        //Method to pick the other database-data we need.
        public string[] ShowInfectionLevelsWithBusinesses(float currentInfectionPercent)
        {
            string[] output = new string[3];
            try
            {
                SqlCommand infectedLevels = new SqlCommand(@"SELECT 
                    SubIndustry.industryGroupName, 
                    SubIndustry.subIndustryName 
                    FROM ContaminationLevelAndIndustryGroup
                    INNER JOIN Industry ON Industry.ID = ContaminationLevelAndIndustryGroup.industryID
                    INNER JOIN SubIndustry ON SubIndustry.subIndustryCode = Industry.subIndustryCode
                    WHERE contaminationLevelID IN
                    (SELECT ID FROM ContaminationLevel WHERE infectionLowerBorder <= @infectionLevel)
                    ORDER BY SubIndustry.industryGroupName"
                                                           , connString);
                infectedLevels.Parameters.Add("@infectionLevel", SqlDbType.Decimal).Value = currentInfectionPercent;
                connString.Open();
                SqlDataReader rdInfectedLevels = infectedLevels.ExecuteReader();

                //this is a way to get the length (number of rows) in rdInfectedLevels...
                DataTable dt = new DataTable();
                dt.Load(rdInfectedLevels);

                // ...to use for defining length of this array:
                infectedLevelsIncoming = new string[dt.Rows.Count][];
                rdInfectedLevels       = infectedLevels.ExecuteReader();
                i = 0;
                foreach (var str in rdInfectedLevels)
                {
                    infectedLevelsIncoming[i] = new string[] {
                        rdInfectedLevels.GetValue(0).ToString(),
                        rdInfectedLevels.GetValue(1).ToString(),
                    };
                    i++;
                }
                ;
                //Can't call the reader with a new query before it's closed.
                rdInfectedLevels.Close();
                connString.Close();

                SqlCommand infLvl = new SqlCommand(@"SELECT TOP(1) * FROM ContaminationLevel 
				WHERE infectionLowerBorder<=@infectionLevel
				ORDER BY infectionLowerBorder DESC"                , connString);
                infLvl.Parameters.Add("@infectionLevel", SqlDbType.Decimal).Value = currentInfectionPercent;

                connString.Open();
                SqlDataReader rdInfLvl = infLvl.ExecuteReader();
                dt = new DataTable();
                dt.Load(rdInfLvl);
                output[0] = dt.Rows[0]["ID"].ToString();
                output[1] = dt.Rows[0]["contaminationLevelName"].ToString();

                rdInfLvl.Close();
                connString.Close();

                string closeBusinesses = "";

                for (int y = 0; y < infectedLevelsIncoming.Length; y++)
                {
                    for (int x = 0; x < infectedLevelsIncoming[y].Length; x++)
                    {
                        if (x == 0)
                        {
                            closeBusinesses += infectedLevelsIncoming[y][x] + ":\n";
                        }
                        else
                        {
                            closeBusinesses += infectedLevelsIncoming[y][x] + "\n\n";
                        }
                    }
                }
                output[2] = closeBusinesses;
            }
            catch (Exception ex)
            {
                popup win = new popup();
                win.popupWindow.Text = "Kunne ikke hente data. Dette er fejlmeddelelsen:\n" + ex.Message;
            }
            finally
            {
                if (connString != null && connString.State == ConnectionState.Open)
                {
                    connString.Close();
                }
            }

            return(output);
        }