Esempio n. 1
0
        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            Connect_to_sql conn = new Connect_to_sql();
            string connect_string = conn.Con_str();
            int sel_povt = (int)((ComboBox)(sender)).SelectedItem;
            string query_ifex = "SELECT kod_data FROM t_data_povt WHERE kod_Glavn=" + ras_param.Glav_ID + " AND povtornost=" + sel_povt;
            int ifexist = conn.ExecQueryWithResult(connect_string, query_ifex);
            if (ifexist != -1)
            {
                TextBox[] stolbec1 = GetTextBoxVesVlazhPochvi();
                TextBox[] stolbec2 = GetTextBoxVesSuhojPochvi();
                TextBox[] stolbec3 = GetTextBoxVesStakan();
                TextBox[] stolbec4 = GetTextBoxPole4();
                TextBox[] stolbec5 = GetTextBoxPole5();
                TextBox[] stolbec6 = GetTextBoxPole6();
                TextBox[] stolbec7 = GetTextBoxPole7();

                Connect_to_sql.AgroDataPovt[] agro_data = new Connect_to_sql.AgroDataPovt[11];
                int kod_st;
                agro_data = conn.SelectFromDataPovt(ras_param.Glav_ID, sel_povt, out kod_st, connect_string);
                for (int i = 0; i < 11; i++)
                {
                    stolbec1[i].Text = conn.ConvertFloatToString(agro_data[i].ves_vlazhnoj);
                    stolbec2[i].Text = conn.ConvertFloatToString(agro_data[i].ves_suhoj);
                    stolbec3[i].Text = conn.ConvertFloatToString(agro_data[i].ves_stakan);
                    stolbec4[i].Text = conn.ConvertFloatToString(agro_data[i].vlazhn_suhaya);
                    stolbec5[i].Text = conn.ConvertFloatToString(agro_data[i].suhaya_stakan);
                    stolbec6[i].Text = conn.ConvertFloatToString(agro_data[i].procent_isparivsh_vlagi);
                    stolbec7[i].Text = conn.ConvertFloatToString(agro_data[i].vlazhnaya_stakan);
                }
                listBox2.SelectedIndex = -1;
                textBox134.Text = "";
                if (kod_st != -1)
                {
                    string[] num_stak = conn.SelectNomerFormStaka(kod_st, connect_string);
                    string name_stak_grup = conn.SelectNameFormStakanGrup(kod_st, connect_string);
                    Label[] num_st = GetLabelNumStakan();
                    for (int i = 0; i < 11; i++)
                    {
                        num_st[i].Text = num_stak[i];
                    }

                    int ii = 0;
                    System.Collections.IEnumerator numerator = listBox2.Items.GetEnumerator();
                    while(numerator.MoveNext())
                    {
                        if (numerator.Current.ToString() == name_stak_grup)
                        {
                            listBox2.SelectedIndex = ii;
                            textBox134.Text = name_stak_grup;
                            break;
                        }
                        else
                        {
                            ii++;
                        }
                    }
                    //int ind = listBox2.Items.GetEnumerator

                }
            }
        }