Exemple #1
0
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            PanelMain.Hide();
            WebMaps.Hide();
            PanelSearch.Show();
            PnlBg.Hide();
            BtnCari.Hide();
            DTPicker.Hide();
            TxtCari.Focus();
            PnlTxt.Show();
            DGView.Show();
            BtnBTempat.Image = global::Retakan.Properties.Resources.tempat_on;
            BtnBWaktu.Image  = global::Retakan.Properties.Resources.waktu_off;
            BtnTerkini.Image = global::Retakan.Properties.Resources.terkini_off;
            BtnMaps.Image    = global::Retakan.Properties.Resources.peta_off;
            BtnSearch.Image  = global::Retakan.Properties.Resources.cari_on;

            //insert
            koneksiObj.Open();
            SqlDataAdapter adapter = new SqlDataAdapter();
            string         sql     = null;

            sql = "insert into DataGempa (gempa,tempat,waktu,tsunami) values('" + C.mag + "','" + C.place + "','" + C.time.ToString("MM/dd/yyy hh:mm:ss") + "','" + C.tsunami + "')";
            try
            {
                adapter.InsertCommand = new SqlCommand(sql, koneksiObj);
                adapter.InsertCommand.ExecuteNonQuery();

                koneksiObj.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("ex" + ex);
            }
        }
Exemple #2
0
        private void BtnTerkini_Click(object sender, EventArgs e)
        {
            PanelMain.Show();
            WebMaps.Hide();
            PanelSearch.Hide();
            BtnTerkini.Image = global::Retakan.Properties.Resources.terkini_on;
            BtnMaps.Image    = global::Retakan.Properties.Resources.peta_off;
            BtnSearch.Image  = global::Retakan.Properties.Resources.cari_off;

            rssData        = getRssData("https://rss.sciencedaily.com/earth_climate/earthquakes.xml");
            LblJudul1.Text = rssData[0, 0];
            LblJudul2.Text = rssData[1, 0];
            LblJudul3.Text = rssData[2, 0];
            LblIsi1.Text   = rssData[0, 1];
            LblIsi2.Text   = rssData[1, 1];
            LblIsi3.Text   = rssData[2, 1];

            A.AmbilDataBesar();
            D.AmbilDataMenengah();
            C.AmbilDataKecil();

            LblMag1.Text    = A.mag.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture);
            LblLokasi1.Text = A.place;
            LblWaktu1.Text  = A.time.ToString();
            if (A.tsunami == "0")
            {
                LblPTsunami1.Text = "Tidak Berpotensi Tsunami";
            }
            else
            {
                LblPTsunami1.Text = "Berpotensi Tsunami";
            }
            Console.WriteLine(A.mag.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture) + " Mag");

            LblMag2.Text    = D.mag.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture);;
            LblLokasi2.Text = D.place;
            LblWaktu2.Text  = D.time.ToString();
            Console.WriteLine(D.mag.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture) + " Mag");
            Console.WriteLine(D.tsunami);
            if (D.tsunami == "0")
            {
                LblPTsunami2.Text = "Tidak Berpotensi Tsunami";
            }
            else
            {
                LblPTsunami2.Text = "Berpotensi Tsunami";
            }
            LblMag3.Text    = C.mag.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture);;
            LblLokasi3.Text = C.place;
            LblWaktu3.Text  = C.time.ToString();
            if (C.tsunami == "0")
            {
                LblPTsunami3.Text = "Tidak Berpotensi Tsunami";
            }
            else
            {
                LblPTsunami3.Text = "Berpotensi Tsunami";
            }
            Console.WriteLine(C.mag.ToString("0.0", System.Globalization.CultureInfo.InvariantCulture) + " Mag");
        }