예제 #1
0
 public Form1()
 {
     InitializeComponent();
     for (int i = 0; i < 20; i++)
     {
         sh[i]     = new Shtani();
         sh_pod[i] = new Shtani();
         fb[i]     = new Footbolka();
         fb_pod[i] = new Footbolka();
         ob[i]     = new Obuv();
         ob_pod[i] = new Obuv();
     }
     LoadData();
     UznatPogodu();
     VremyaVibrano(2, 7);
 }
예제 #2
0
        private void Form3_Load(object sender, EventArgs e)
        {
            Footbolka[] fb = new Footbolka[20];
            int         kolvo_footb = 0, kolvo_shtanov = 0, kolvo_obuv = 0;

            Shtani[] sh = new Shtani[20];
            Obuv[]   ob = new Obuv[20];
            for (int i = 0; i < 20; i++)
            {
                sh[i] = new Shtani();

                fb[i] = new Footbolka();

                ob[i] = new Obuv();
            }
            SqlConnection myConnection = new SqlConnection();

            myConnection.ConnectionString = Properties.Settings.Default.bd_odejdaConnectionString1;
            myConnection.Open();
            string        query   = "SELECT * FROM tb_footbolki ORDER BY st_id";
            SqlCommand    command = new SqlCommand(query, myConnection);
            SqlDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                fb[kolvo_footb].id       = (int)reader["st_id"];
                fb[kolvo_footb].nazvanie = (string)reader["st_nazvanie"];
                fb[kolvo_footb].pop      = (int)reader["st_pop"];
                fb[kolvo_footb].min_t    = (int)reader["st_min_temp"];
                fb[kolvo_footb].max_t    = (int)reader["st_max_temp"];
                fb[kolvo_footb].kartinka = reader["st_kart"].ToString();
                kolvo_footb++;
            }
            reader.Close();
            myConnection.Close();
            for (int i = 0; i < kolvo_footb; i++)
            {
                dataGridView1.Rows.Add();
                dataGridView1[0, i].Value = fb[i].id;
                dataGridView1[1, i].Value = fb[i].nazvanie;
                dataGridView1[2, i].Value = fb[i].pop;
                dataGridView1[3, i].Value = fb[i].min_t;
                dataGridView1[4, i].Value = fb[i].max_t;
                dataGridView1[5, i].Value = fb[i].kartinka;
            }

            for (int i = 0; i < kolvo_footb; i++)
            {
                //pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                dataGridView1[6, i].Value = Image.FromFile(dataGridView1[5, i].Value.ToString());
            }

            query = "SELECT * FROM tb_shtani";
            myConnection.Open();
            SqlCommand command2 = new SqlCommand(query, myConnection);

            reader = command2.ExecuteReader();

            while (reader.Read())
            {
                sh[kolvo_shtanov].id       = (int)reader["st_id"];
                sh[kolvo_shtanov].nazvanie = (string)reader["st_nazvanie"];
                sh[kolvo_shtanov].pop      = (int)reader["st_pop"];
                sh[kolvo_shtanov].min_t    = (int)reader["st_min_temp"];
                sh[kolvo_shtanov].max_t    = (int)reader["st_max_temp"];
                sh[kolvo_shtanov].kartinka = reader["st_kart"].ToString();
                kolvo_shtanov++;
            }
            reader.Close();
            myConnection.Close();

            for (int i = 0; i < kolvo_shtanov; i++)
            {
                dataGridView2.Rows.Add();
                dataGridView2[0, i].Value = sh[i].id;
                dataGridView2[1, i].Value = sh[i].nazvanie;
                dataGridView2[2, i].Value = sh[i].pop;
                dataGridView2[3, i].Value = sh[i].min_t;
                dataGridView2[4, i].Value = sh[i].max_t;
                dataGridView2[5, i].Value = sh[i].kartinka;
            }

            for (int i = 0; i < kolvo_shtanov; i++)
            {
                dataGridView2[6, i].Value = Image.FromFile(dataGridView2[5, i].Value.ToString());
            }

            query = "SELECT * FROM tb_obuv";
            myConnection.Open();
            SqlCommand command3 = new SqlCommand(query, myConnection);

            reader = command3.ExecuteReader();

            while (reader.Read())
            {
                ob[kolvo_obuv].id       = (int)reader["st_id"];
                ob[kolvo_obuv].nazvanie = (string)reader["st_nazvanie"];
                ob[kolvo_obuv].pop      = (int)reader["st_pop"];
                ob[kolvo_obuv].min_t    = (int)reader["st_min_temp"];
                ob[kolvo_obuv].max_t    = (int)reader["st_max_temp"];
                ob[kolvo_obuv].kartinka = reader["st_kart"].ToString();
                kolvo_obuv++;
            }
            reader.Close();
            myConnection.Close();

            for (int i = 0; i < kolvo_obuv; i++)
            {
                dataGridView3.Rows.Add();
                dataGridView3[0, i].Value = ob[i].id;
                dataGridView3[1, i].Value = ob[i].nazvanie;
                dataGridView3[2, i].Value = ob[i].pop;
                dataGridView3[3, i].Value = ob[i].min_t;
                dataGridView3[4, i].Value = ob[i].max_t;
                dataGridView3[5, i].Value = ob[i].kartinka;
            }

            for (int i = 0; i < kolvo_obuv; i++)
            {
                dataGridView3[6, i].Value = Image.FromFile(dataGridView3[5, i].Value.ToString());
            }
        }
예제 #3
0
        public void PodobratOdejdu()
        {
            kolvo_pod_shtan = 0;
            kolvo_pod_footb = 0;
            kolvo_pod_footb = 0;

            VibratMaxMinTemp();

            for (int i = 0; i < kolvo_footb; i++)
            {
                if (fb[i].get_min_temp() < temp_min)
                {
                    if (fb[i].max_t > temp_max)
                    {
                        fb_pod[kolvo_pod_footb] = fb[i];
                        kolvo_pod_footb++;
                    }
                }
            }
            if (kolvo_pod_footb > 0)
            {
                est_foot = true;
            }
            Footbolka f_ok = get_max_pop_footb(fb_pod, kolvo_pod_footb);

            for (int i = 0; i < kolvo_shtanov; i++)
            {
                if (fb[i].get_min_temp() < temp_min)
                {
                    if (fb[i].max_t > temp_max)
                    {
                        sh_pod[kolvo_pod_shtan] = sh[i];
                        kolvo_pod_shtan++;
                    }
                }
            }
            Shtani sh_ok = get_max_pop_shtan(sh_pod, kolvo_pod_shtan);

            if (kolvo_pod_shtan > 0)
            {
                est_shtan = true;
            }
            for (int i = 0; i < kolvo_obuv; i++)
            {
                if (ob[i].min_t < temp_min)
                {
                    if (ob[i].max_t > temp_max)
                    {
                        ob_pod[kolvo_pod_obuv] = ob[i];
                        kolvo_pod_obuv++;
                    }
                }
            }
            Obuv ob_ok = get_max_pop_obuv(ob_pod, kolvo_pod_obuv);

            if (kolvo_pod_obuv > 0)
            {
                est_obuv = true;
            }
            if (est_foot & est_obuv & est_shtan)
            {
                pictureBox1.Image    = Image.FromFile(f_ok.kartinka);
                pictureBox2.Image    = Image.FromFile(sh_ok.kartinka);
                pictureBox3.Image    = Image.FromFile(ob_ok.kartinka);
                pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
                pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
            }
        }