예제 #1
0
 public apropos(string city, InfoJour.weatherinfo.Root output)
 {
     InitializeComponent();
     wilaya     = wilaya.Trim(new Char[] { ' ', '\r', '\n', '\t' }); // suppression de tout caractére bizarre lors de la récupération du fichier
     wilaya     = city;
     output_out = output;
 }
예제 #2
0
        public static void add_BDD(InfoJour.weatherinfo.Root output, string wilaya)
        {
            // Role : Ajout d'une donnée dans la bdd
            ///string connectionstring = null;
            ///SqlConnection connect;
            //connectionstring = @"Data Source = INFO\SQLEXPRESS ; Initial Catalog =weather1 ; User ID =sa ; password =kerem1987";
            //connectionstring = @"Data Source=ABCOMPUTER-PC\SQLEXPRESS;Initial Catalog=weather;User ID=sa;Password=ayaz oyku";

            SqlConnection connect = new SqlConnection(@"Data Source = .\SQLEXPRESS;Initial Catalog=weather;Integrated Security=True");

            ///connect = new SqlConnection(connectionstring);
            // Commanda d'insertion dans un bdd
            SqlCommand command = new SqlCommand("INSERT INTO [" + wilaya + "]VALUES(" + "'" + InfoJour.weatherinfo.UnixTimeStampToDateTime(output.dt).Day + "/" + InfoJour.weatherinfo.UnixTimeStampToDateTime(output.dt).Month + "/" + InfoJour.weatherinfo.UnixTimeStampToDateTime(output.dt).Year + "'" + "," + output.main.temp_max + "," + output.main.temp_min + "," + output.wind.speed + ",' ',' ',' ',' '," + output.main.humidity + "," + output.visibility + "," + output.main.pressure + "," + output.clouds.all + ",' ',' '," + output.wind.deg + ")", connect);
            // Instancier un objet datasert ==> Utilisation du mode deconnecté ==> comme la connexion
            DataSet        data    = new DataSet();
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = command;
            try
            {
                connect.Open();             // Ouverture de la connexion
                adapter.Fill(data, wilaya); // recuperation du resultat de la commande
                connect.Close();            // fermeture de la connexion
            }
            catch (Exception)
            {
            }
        }
예제 #3
0
 public mise_a_jour(string city, InfoJour.weatherinfo.Root output)
 {
     wilaya = wilaya.Trim(new Char[] { ' ', '\r', '\n', '\t' });
     InitializeComponent();
     wilaya     = city;
     output_out = output;
 }
예제 #4
0
        public parametre(string city, InfoJour.weatherinfo.Root output)//la fenetre parametres
        {
            wilaya = wilaya.Trim(new Char[] { ' ', '\r', '\n', '\t' });
            InitializeComponent();
            wilaya = wilaya.Replace(" ", "");

            wilaya     = city;
            output_out = output;
        }
예제 #5
0
        public credit(string city, InfoJour.weatherinfo.Root output)
        {
            wilaya = wilaya.Trim(new Char[] { ' ', '\r', '\n', '\t' });
            InitializeComponent();
            wilaya = wilaya.Replace(" ", "");

            wilaya     = city;
            output_out = output;
        }
예제 #6
0
 public connexion(string city, InfoJour.weatherinfo.Root output)
 {
     wilaya = wilaya.Trim(new Char[] { ' ', '\r', '\n', '\t' }); // suppression des caractéres bizarres
     InitializeComponent();
 }
예제 #7
0
        public static void recherche(InfoJour.weatherinfo.Root output, int[] tab_id, String wilaya)
        {
            /* Role :
             *  Rechercher une donnée "output " dans la table de la bdd de la wilaya "wilaya" et nous rend un table d'id qui défini les jours dont l'observation est similaire à output
             */
            bool     b = false; int cpt = 1;
            DateTime today = DateTime.Now;
            string   mnth  = "'" + today.Month % 12 + "'";
            string   mnth2 = "'" + (today.Month - 1) % 12 + "'";
            string   mnth3 = "'" + (today.Month + 1) % 12 + "'";

            string table = "[dbo].[" + wilaya + "]";
            // Commande de la recherche */
            string cmmd = "SELECT * FROM " + table + " WHERE Month(DATE) = " + mnth + " or Month(DATE) = " + mnth2 + " or Month(DATE) = " + mnth3;

retour:
            DataSet data = new DataSet();

            connection(cmmd, b, ref data, wilaya); int j = 0;
            double seuil  = 0.92;
            double seuil2 = 0.92;

            if ((-8 <= output.main.getTempMin()) && (output.main.getTempMin() <= 8))
            {
                seuil = 0.66;
            }
            else
            {
                seuil = 0.92;
            }
            if ((-8 <= output.main.getTempMax()) && (output.main.getTempMax() <= 8))
            {
                seuil2 = 0.66;
            }
            else
            {
                seuil2 = 0.92;
            }

            foreach (DataRow row in data.Tables[wilaya].Rows)
            {
                string txt  = Convert.ToString(row["CLOUDCOVER_AVG_PERCENT"]);
                string txt2 = Convert.ToString(row["HUMIDITY_MAX_PERCENT"]);
                txt  = txt.Replace('.', ',');
                txt2 = txt2.Replace('.', ',');
                double a = Convert.ToDouble(txt);


                if ((similarite_Bray_Curtis(Convert.ToDouble(row["MAX_TEMPERATURE_C"]), output.main.getTempMax()) > seuil2) && (similarite_Bray_Curtis(Convert.ToDouble(row["MIN_TEMPERATURE_C"]), output.main.getTempMin()) > seuil) && (similarite_Bray_Curtis(Convert.ToDouble(row["HUMIDITY_MAX_PERCENT"]), output.main.humidity) > 0.75))
                {
                    tab_id[j] = Convert.ToInt32(row["id"]); j++;
                }
            }
            if (tab_id[0] == 0)
            {
                cmmd = cmmd + " or Month(DATE) = " + "'" + (today.Month + 2) % 12 + "'"; cpt += 1;
                if (cpt < 10)
                {
                    goto retour;
                }
            }
        }
예제 #8
0
 public nbre(InfoJour.weatherinfo.Root output)
 {
     wilaya = wilaya.Trim(new Char[] { ' ', '\r', '\n', '\t' });
     InitializeComponent();
     wilaya = wilaya.Replace(" ", "");
 }