Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Connect_to_sql conn = new Connect_to_sql();
                string connect_string = conn.Con_str();
                TextBox[] stolbec1 = GetTextBoxVesVlazhPochvi();
                TextBox[] stolbec2 = GetTextBoxVesSuhojPochvi();
                TextBox[] stolbec3 = GetTextBoxVesStakan();
                TextBox[] stolbec4 = GetTextBoxPole4();
                TextBox[] stolbec5 = GetTextBoxPole5();
                TextBox[] stolbec6 = GetTextBoxPole6();
                TextBox[] stolbec7 = GetTextBoxPole7();
                for (int i = 0; i < 11; i++)
                {
                    stolbec1[i].Text = stolbec1[i].Text.Replace('.', ',');
                    stolbec2[i].Text = stolbec2[i].Text.Replace('.', ',');
                    stolbec3[i].Text = stolbec3[i].Text.Replace('.', ',');
                }
                if (!ras_param.sloj0_5)
                {
                    for (int i = 1; i < 11; i++)
                    {
                        stolbec4[i].Text = Convert.ToString(conn.RoundTo((Convert.ToDouble(stolbec1[i].Text) - Convert.ToDouble(stolbec2[i].Text)), 1));
                    }
                    for (int i = 1; i < 11; i++)
                    {
                        stolbec5[i].Text = Convert.ToString(conn.RoundTo((Convert.ToDouble(stolbec2[i].Text) - Convert.ToDouble(stolbec3[i].Text)), 1));
                    }
                    for (int i = 1; i < 11; i++)
                    {
                        stolbec6[i].Text = Convert.ToString(conn.RoundTo(((Convert.ToDouble(stolbec4[i].Text) / Convert.ToDouble(stolbec5[i].Text)) * 100), 1));
                    }
                    for (int i = 1; i < 11; i++)
                    {
                        stolbec7[i].Text = Convert.ToString(conn.RoundTo((Convert.ToDouble(stolbec1[i].Text) - Convert.ToDouble(stolbec3[i].Text)), 1));
                    }
                }
                else
                {
                    for (int i = 0; i < 11; i++)
                    {
                        stolbec4[i].Text = Convert.ToString(conn.RoundTo((Convert.ToDouble(stolbec1[i].Text) - Convert.ToDouble(stolbec2[i].Text)), 1));
                    }
                    for (int i = 0; i < 11; i++)
                    {
                        stolbec5[i].Text = Convert.ToString(conn.RoundTo((Convert.ToDouble(stolbec2[i].Text) - Convert.ToDouble(stolbec3[i].Text)), 1));
                    }
                    for (int i = 0; i < 11; i++)
                    {
                        stolbec6[i].Text = Convert.ToString(conn.RoundTo(((Convert.ToDouble(stolbec4[i].Text) / Convert.ToDouble(stolbec5[i].Text)) * 100), 1));
                    }
                    for (int i = 0; i < 11; i++)
                    {
                        stolbec7[i].Text = Convert.ToString(conn.RoundTo((Convert.ToDouble(stolbec1[i].Text) - Convert.ToDouble(stolbec3[i].Text)), 1));
                    }
                }

                Connect_to_sql.AgroDataPovt[] DataPovt = new Connect_to_sql.AgroDataPovt[11];
                for (int i = 0; i < 11; i++)
                {
                    DataPovt[i].ves_vlazhnoj = ConvertStringToFloat(stolbec1[i].Text);
                    DataPovt[i].ves_suhoj = ConvertStringToFloat(stolbec2[i].Text);
                    DataPovt[i].ves_stakan = ConvertStringToFloat(stolbec3[i].Text);
                    DataPovt[i].vlazhn_suhaya = ConvertStringToFloat(stolbec4[i].Text);
                    DataPovt[i].suhaya_stakan = ConvertStringToFloat(stolbec5[i].Text);
                    DataPovt[i].procent_isparivsh_vlagi = ConvertStringToFloat(stolbec6[i].Text);
                    DataPovt[i].vlazhnaya_stakan = ConvertStringToFloat(stolbec7[i].Text);
                }

                string query_progress = "SELECT progress FROM t_Glavnaya WHERE kod=" + ras_param.Glav_ID;
                if (!ras_param.marshrut)
                {
                    if (((int)comboBox1.SelectedItem == comboBox1.Items.Count) && ((int)comboBox1.SelectedItem <= 4))
                    {
                        int progress = conn.ExecQueryWithResult(connect_string, query_progress);
                        if (progress == 4)
                        {
                            string query_delRowFrom = "DELETE FROM t_data_povt WHERE kod_Glavn=" + ras_param.Glav_ID + " AND Povtornost=" + (int)comboBox1.SelectedItem;
                            conn.ExecQuery(connect_string, query_delRowFrom);
                        }
                        conn.InsertRowToDataPovt(ras_param.Glav_ID, (int)comboBox1.SelectedItem, DataPovt, ras_param.sloj0_5, textBox134.Text, connect_string);

                        string query_edit_progress = "UPDATE t_Glavnaya SET progress=" + comboBox1.Items.Count + " WHERE kod=" + ras_param.Glav_ID;
                        conn.ExecQuery(connect_string, query_edit_progress);
                        if (comboBox1.Items.Count < 4)
                        {
                            comboBox1.Items.Add((int)comboBox1.SelectedItem + 1);
                        }
                    }
                    else
                    {
                        string query_delRowFrom = "DELETE FROM t_data_povt WHERE kod_Glavn=" + ras_param.Glav_ID + " AND Povtornost=" + (int)comboBox1.SelectedItem;
                        conn.ExecQuery(connect_string, query_delRowFrom);
                        conn.InsertRowToDataPovt(ras_param.Glav_ID, (int)comboBox1.SelectedItem, DataPovt, ras_param.sloj0_5, textBox134.Text, connect_string);
                    }
                }
                else
                {
                    if (((int)comboBox1.SelectedItem == comboBox1.Items.Count) && ((int)comboBox1.SelectedItem <= 2))
                    {
                        int progress = conn.ExecQueryWithResult(connect_string, query_progress);
                        if (progress == 2)
                        {
                            string query_delRowFrom = "DELETE FROM t_data_povt WHERE kod_Glavn=" + ras_param.Glav_ID + " AND Povtornost=" + (int)comboBox1.SelectedItem;
                            conn.ExecQuery(connect_string, query_delRowFrom);
                        }
                        conn.InsertRowToDataPovt(ras_param.Glav_ID, (int)comboBox1.SelectedItem, DataPovt, ras_param.sloj0_5, textBox134.Text, connect_string);
                        // int progress = conn.ExecQueryWithResult(connect_string, query_progress);
                        string query_edit_progress = "UPDATE t_Glavnaya SET progress=" + comboBox1.Items.Count + " WHERE kod=" + ras_param.Glav_ID;
                        conn.ExecQuery(connect_string, query_edit_progress);
                        if (comboBox1.Items.Count < 2)
                        {
                            comboBox1.Items.Add((int)comboBox1.SelectedItem + 1);
                        }
                    }
                    else
                    {
                        string query_delRowFrom = "DELETE FROM t_data_povt WHERE kod_Glavn=" + ras_param.Glav_ID + " AND Povtornost=" + (int)comboBox1.SelectedItem;
                        conn.ExecQuery(connect_string, query_delRowFrom);
                        conn.InsertRowToDataPovt(ras_param.Glav_ID, (int)comboBox1.SelectedItem, DataPovt, ras_param.sloj0_5, textBox134.Text, connect_string);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
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

                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int ind_selRow = dataGridView1.CurrentRow.Index;
            Connect_to_sql.AgroNewRaschet edit_ras = new Connect_to_sql.AgroNewRaschet();
            int id_glav = Convert.ToInt32(dataGridView1[0, ind_selRow].Value);
            Connect_to_sql conn = new Connect_to_sql();
            string connect_string = conn.Con_str();
            SqlConnection myConnection = new SqlConnection(connect_string);
            string myInsertQuery = "SELECT     t_Glavnaya.Date, t_Glavnaya.Kod_Polya, t_Naz_poley.Ima_polya, t_Glavnaya.Kod_Sred, t_Glavnaya.Progress, t_Glavnaya.sloj0_5, "
                      + "t_Glavnaya.marshrut "
                      + "FROM         t_Glavnaya INNER JOIN "
                      + "t_Naz_poley ON t_Glavnaya.Kod_Polya = t_Naz_poley.kod_polya "
                      + "WHERE     (t_Glavnaya.Kod =" + id_glav + ")";
            SqlCommand myCommand = new SqlCommand(myInsertQuery);
            myCommand.Connection = myConnection;
            myConnection.Open();
            SqlDataReader reader = myCommand.ExecuteReader();
            while (reader.Read())
            {
                edit_ras.date = Convert.ToDateTime(reader[0]);
                edit_ras.kod_polya = Convert.ToInt32(reader[1]);
                edit_ras.name_polya = Convert.ToString(reader[2]);
                if ((reader[3]).ToString() != "")
                {
                    edit_ras.kod_sred = Convert.ToInt32(reader[3]);
                }
                else
                    edit_ras.kod_sred = -1;
                edit_ras.progress = Convert.ToInt32(reader[4]);
                edit_ras.sloj0_5 = Convert.ToBoolean(reader[5]);
                edit_ras.marshrut = Convert.ToBoolean(reader[6]);
                edit_ras.Glav_ID = id_glav;

            }
            myCommand.Connection.Close();
            Excel.Workbooks excelappworkbooks;
            Excel.Workbook excelappworkbook;
            Excel.Application appl = new Excel.Application();
            appl.Visible = false;
            appl.SheetsInNewWorkbook = edit_ras.progress+1;
            appl.Workbooks.Add(Type.Missing);
            Excel.Sheets excelsheets;
            Excel.Worksheet excelworksheet;
            Excel.Range excelcells;
            excelappworkbooks = appl.Workbooks;
            excelappworkbook = excelappworkbooks[1];
            excelsheets = excelappworkbook.Worksheets;
            string[] polya = {"Слой почвы см", "Масса влажной почвы\n и стаканчика", "Масса сухой почвы\n и стаканчика", "Масса стаканчиков",
                             "Масса испарившейся\n воды", "Масса сухой почвы\n без стаканчика", "Влажность почвы %", "Масса влажной почвы\n без стаканчика"};
            for (int j = 1; j <= edit_ras.progress; j++)
            {
                int sl = 0;

                Connect_to_sql.AgroDataPovt[] agro_data = new Connect_to_sql.AgroDataPovt[11];
                excelworksheet = (Excel.Worksheet)excelsheets.get_Item(j);

                excelcells = excelworksheet.get_Range("A1", "H4");
                excelcells.Merge(Type.Missing);
                excelcells.Font.Bold = true;
                excelcells.Font.Size = 15;
                excelcells.Borders.Weight = 3;
                excelcells.Borders.Value = 1;
                excelcells.HorizontalAlignment = Excel.Constants.xlCenter;
                excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                excelcells.Value2 = "Отчет по " + j.ToString() + "й повторности\n Дата:" + edit_ras.date.ToLongDateString();
                if(edit_ras.sloj0_5)
                    excelcells = excelworksheet.get_Range("A7", "H17");
                else
                    excelcells = excelworksheet.get_Range("A7", "H16");
                excelcells.HorizontalAlignment = Excel.Constants.xlCenter;
                excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                excelcells.Borders.Weight = 2;
                excelcells.Borders.Value = 1;

                for (int i = 1; i < 9; i++)
                {
                    excelcells = (Excel.Range)excelworksheet.Cells[6, i];
                    excelcells.Borders.Weight = 2;
                    excelcells.Orientation = 90;
                    excelcells.HorizontalAlignment = Excel.Constants.xlCenter;
                    excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                    excelcells.Font.Size = 9;
                    excelcells.NumberFormat = "@";
                    excelcells.Borders.Value = 1;
                    excelcells.Value2 = polya[i - 1];
                }
                bool tr = false;
                int col;
                if (edit_ras.sloj0_5)
                    col = 0;
                else
                    col = 1;

                string query_ifex = "SELECT kod_data FROM t_data_povt WHERE kod_Glavn=" + edit_ras.Glav_ID + " AND povtornost=" + j;
                int ifexist = conn.ExecQueryWithResult(connect_string, query_ifex);
                if (ifexist != -1)
                {
                    int kod_st; //неиспользуемае переменная, нужна для работы функции
                    agro_data = conn.SelectFromDataPovt(edit_ras.Glav_ID, j,out kod_st, connect_string);
                    for (int i = col; i < 11; i++)
                    {

                        if (i == 0)
                        {
                            excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 1];
                            excelcells.NumberFormat = "@";
                            excelcells.Value2 = sl.ToString() + " - " + (sl + 5).ToString();
                            sl += 5;
                            tr = true;
                        }
                        else
                        {
                            excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 1];
                            excelcells.NumberFormat = "@";

                            if (tr)
                            {
                                excelcells.Value2 = sl.ToString() + " - " + (sl + 5).ToString();
                                sl += 5;
                                tr = false;
                            }
                            else
                            {
                                excelcells.Value2 = sl.ToString() + " - " + (sl + 10).ToString();
                                sl += 10;
                            }
                        }

                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 2];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].ves_vlazhnoj);
                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 3];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].ves_suhoj);
                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 4];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].ves_stakan);
                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 5];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].vlazhn_suhaya);
                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 6];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].suhaya_stakan);
                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 7];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].procent_isparivsh_vlagi);
                        excelcells = (Excel.Range)excelworksheet.Cells[i + 7 - col, 8];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_data[i].vlazhnaya_stakan);
                    }
                }
            }
            if (edit_ras.kod_sred != -1)
            {
                int kod_sred;
                Connect_to_sql.AgroDataSredn[] agro_sred = conn.SelectDataFromDataSredn(edit_ras.kod_sred,edit_ras.sloj0_5,out kod_sred,connect_string);
                excelworksheet = (Excel.Worksheet)excelsheets.get_Item(edit_ras.progress+1);

                string name_r = "";

                myConnection = new SqlConnection(connect_string);
                myInsertQuery = "SELECT * FROM t_razrez WHERE kod_razrez=" + kod_sred;
               myCommand = new SqlCommand(myInsertQuery);
                myCommand.Connection = myConnection;
                myConnection.Open();
                reader = myCommand.ExecuteReader();
                //Connect_to_sql.AgroRazrez[] raz = new Connect_to_sql.AgroRazrez[11];
                int ii = 0;
                string[,] raz = new string[2,11];
                while (reader.Read())
                {
                    name_r = reader[1].ToString();
                    for (int i = 2; i < 13; i++)
                    {
                        raz[0,ii] = reader[i].ToString();
                        ii++;
                    }
                    ii = 0;
                    for (int i = 13; i < 24; i++)
                    {
                        raz[1, ii] = reader[i].ToString();
                        ii++;
                    }
                }
                myCommand.Connection.Close();

                            string[] polya_2 = {"Слой","Объемная масса почвы", "Влажность устойчивого\nзавядание", "Расчитанная влажность\n%","Запасы влаги\nв мм.", "Запасы влаги\nнарастающим итогом"};
                int sl = 0;
                if(edit_ras.sloj0_5)
                    excelcells = excelworksheet.get_Range("A1", "L3");
                else
                    excelcells = excelworksheet.get_Range("A1", "K3");
                excelcells.Merge(Type.Missing);
                excelcells.Font.Bold = true;
                excelcells.Font.Size = 15;
                excelcells.Borders.Weight = 3;
                excelcells.Borders.Value = 1;
                excelcells.HorizontalAlignment = Excel.Constants.xlCenter;
                excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                excelcells.Value2 = "Отчет по по запасам влаги, на " + edit_ras.date.ToLongDateString();
                if(edit_ras.sloj0_5)
                    excelcells = excelworksheet.get_Range("A4", "L9");
                else
                    excelcells = excelworksheet.get_Range("A4", "K9");
                excelcells.HorizontalAlignment = Excel.Constants.xlCenter;
                excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                excelcells.Borders.Weight = 2;
                excelcells.Borders.Value = 1;

                for (int i = 4; i < 10; i++)
                {
                    excelcells = (Excel.Range)excelworksheet.Cells[i, 1];
                    excelcells.Borders.Weight = 2;
                    //excelcells.Orientation = 90;
                    excelcells.HorizontalAlignment = Excel.Constants.xlLeft;
                    excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                    excelcells.Font.Size = 9;
                    excelcells.NumberFormat = "@";
                    excelcells.Borders.Value = 1;
                    excelcells.Value2 = polya_2[i - 4];
                    excelcells.ColumnWidth = 20;
                }
                bool tr = false;
                int col;
                if (edit_ras.sloj0_5)
                    col = 0;
                else
                    col = 1;

                    for (int i = col; i < 11; i++)
                    {

                        if (i == 0)
                        {
                            excelcells = (Excel.Range)excelworksheet.Cells[4,i + 2 - col];
                            excelcells.NumberFormat = "@";
                            excelcells.Value2 = sl.ToString() + " - " + (sl + 5).ToString();
                            sl += 5;
                            tr = true;
                        }
                        else
                        {
                            excelcells = (Excel.Range)excelworksheet.Cells[4,i + 2 - col];
                            excelcells.NumberFormat = "@";

                            if (tr)
                            {
                                excelcells.Value2 = sl.ToString() + " - " + (sl + 5).ToString();
                                sl += 5;
                                tr = false;
                            }
                            else
                            {
                                excelcells.Value2 = sl.ToString() + " - " + (sl + 10).ToString();
                                sl += 10;
                            }
                        }
                        excelcells = (Excel.Range)excelworksheet.Cells[5, i + 2 - col];
                        excelcells.Value2 = raz[0, i];
                        excelcells = (Excel.Range)excelworksheet.Cells[6, i + 2 - col];
                        excelcells.Value2 = raz[1, i];

                        excelcells = (Excel.Range)excelworksheet.Cells[7, i + 2 - col];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_sred[i].stroka3);
                        excelcells = (Excel.Range)excelworksheet.Cells[8, i + 2 - col];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_sred[i].stroka4);
                        excelcells = (Excel.Range)excelworksheet.Cells[9, i + 2 - col];
                        excelcells.Value2 = conn.ConvertFloatToString(agro_sred[i].stroka5);
                    }
                    float[] val = new float[10];
                    for (int k = 0; k < 10; k++)
                    {
                        val[k] = agro_sred[k+1].stroka5;
                    }
                    Form1 f_owner = (Form1)this.Owner;
                    string[] step_t = new string[7];
                    step_t[0] = "Почвенная засуха сильная";
                    step_t[1] = "Почвенная засуха слабая";
                    step_t[2] = "Недостаточное увлажнение сильное";
                    step_t[3] = "Недостаточное увлажнение слабое";
                    step_t[4] = "Оптимальное увлажнение";
                    step_t[5] = "Избыточное увлажнение";
                    step_t[6] = "Заболачивание";

                    Connect_to_sql.ResultStepUvl[] res_step = conn.GetResultStepUvl(val, name_r, connect_string);
                    for (int k = 12; k < 17; k++)
                    {
                        for (int p = 1; p < 9; p++)
                        {
                            excelcells = (Excel.Range)excelworksheet.Cells[k, p];
                            excelcells.Merge(Type.Missing);
                            excelcells.Font.Bold = true;
                            excelcells.Font.Size = 10;
                            excelcells.Borders.Weight = 2;
                            excelcells.Borders.Value = 1;
                            excelcells.HorizontalAlignment = Excel.Constants.xlLeft;
                            excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                        }
                    }
                    excelcells = excelworksheet.get_Range("A11", "h12");
                    excelcells.Merge(Type.Missing);
                    excelcells.Font.Bold = true;
                    excelcells.Font.Size = 15;
                    excelcells.Borders.Weight = 3;
                    excelcells.Borders.Value = 1;
                    excelcells.HorizontalAlignment = Excel.Constants.xlCenter;
                    excelcells.VerticalAlignment = Excel.Constants.xlCenter;
                    excelcells.Value2 = "Степень увлажнения почвы по слоям";

                    excelcells = excelworksheet.get_Range("a13", "b13");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = "Слой 0-10";
                    excelcells = excelworksheet.get_Range("c13", "h13");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = step_t[res_step[0].znachenie];

                    excelcells = excelworksheet.get_Range("a14", "b14");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = "Слой 0-20";
                    excelcells = excelworksheet.get_Range("c14", "h14");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = step_t[res_step[1].znachenie];

                    excelcells = excelworksheet.get_Range("a15", "b15");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = "Слой 0-50";
                    excelcells = excelworksheet.get_Range("c15", "h15");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = step_t[res_step[4].znachenie];

                    excelcells = excelworksheet.get_Range("a16", "b16");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = "Слой 0-100";
                    excelcells = excelworksheet.get_Range("c16", "h16");
                    excelcells.Merge(Type.Missing);
                    excelcells.Value2 = step_t[res_step[9].znachenie];

            }

            appl.Visible = true;
        }