private void b_add_Click(object sender, EventArgs e) { #region Clean Data.Name = ""; Data.Type = ""; Data.Voltage = ""; Data.cab_Climate = ""; Data.har = ""; Data.pol = ""; Data.sw_Climate = ""; Data.def = ""; Data.off_poss = ""; Data.Branch = ""; Data.ID_switch = ""; Data.switch_name = ""; Data.switch_cur = ""; Data.har_cur = ""; Data.sw_p_1 = ""; Data.sw_p_2 = ""; Data.sw_p_3 = ""; Data.ID_cab_1 = ""; Data.cab_name_1 = ""; Data.cab_type_1 = ""; Data.cab_gils_1 = ""; Data.cab_len_1 = ""; Data.cab_name_2 = ""; Data.cab_type_2 = ""; Data.cab_gils_2 = ""; Data.cab_len_2 = ""; Data.pr_name = ""; Data.pr_p = ""; Data.pr_i = ""; Data.pr_type = ""; Data.koef = ""; Data.order = ""; #endregion for (int i = 4; i < dataGridView1.Rows.Count; i = i + 4) { MySqlConnection conn; conn = new MySqlConnection("Database=test;Data Source=localhost;User Id=user;Password=1234"); conn.Open(); string SQL_String = "UPDATE pr_table SET ord=@ord WHERE ID = '" + dataGridView1.Rows[last_row + i].Cells[0].Value + "'"; MySqlCommand comm = new MySqlCommand(SQL_String, conn); comm.Connection = conn; comm.Parameters.AddRange(new MySqlParameter[] { new MySqlParameter("ord", MySqlDbType.Int16, 11, "ord")}); comm.Parameters[0].Value = Convert.ToInt16(dataGridView1.Rows[last_row + i].Cells[3].Value) + 1; int rows = comm.ExecuteNonQuery(); conn.Close(); } dataGridView1.Rows.Clear(); a_update_project_Load(sender, e); a_insert_cabel f_insert_cab = new a_insert_cabel(); f_insert_cab.Show(); }
private void b_change_Click(object sender, EventArgs e) { #region Fill Data.Name = ""; Data.Type = ""; Data.Voltage = ""; Data.cab_Climate = ""; Data.har = ""; Data.pol = ""; Data.sw_Climate = ""; Data.def = ""; Data.off_poss = ""; Data.Branch = ""; Data.ID_switch = ""; Data.switch_name = ""; Data.switch_cur = dataGridView1.Rows[last_row + 2].Cells[4].Value.ToString(); Data.har_cur = ""; Data.sw_p_1 = dataGridView1.Rows[last_row + 2].Cells[7].Value.ToString(); Data.sw_p_2 = dataGridView1.Rows[last_row + 1].Cells[7].Value.ToString(); Data.sw_p_3 = dataGridView1.Rows[last_row].Cells[7].Value.ToString(); Data.ID_cab_1 = ""; Data.cab_name_1 = dataGridView1.Rows[last_row + 1].Cells[8].Value.ToString(); Data.cab_type_1 = ""; Data.cab_gils_1 = dataGridView1.Rows[last_row + 1].Cells[10].Value.ToString(); Data.cab_len_1 = dataGridView1.Rows[last_row + 1].Cells[11].Value.ToString(); Data.cab_name_2 = dataGridView1.Rows[last_row + 2].Cells[8].Value.ToString(); Data.cab_type_2 = ""; Data.cab_gils_2 = dataGridView1.Rows[last_row + 2].Cells[10].Value.ToString(); Data.cab_len_2 = dataGridView1.Rows[last_row + 2].Cells[11].Value.ToString(); Data.pr_name = dataGridView1.Rows[last_row + 2].Cells[12].Value.ToString(); Data.pr_p = dataGridView1.Rows[last_row + 2].Cells[13].Value.ToString(); Data.pr_i = dataGridView1.Rows[last_row + 2].Cells[14].Value.ToString(); Data.pr_type = dataGridView1.Rows[last_row + 2].Cells[15].Value.ToString(); Data.koef = dataGridView1.Rows[last_row + 2].Cells[16].Value.ToString(); Data.order = ""; #endregion a_insert_cabel f_insert_cab = new a_insert_cabel(); f_insert_cab.Show(); }
private void button13_Click(object sender, EventArgs e) { Data.ord = 1; a_insert_cabel f_insert_cab = new a_insert_cabel(); f_insert_cab.Show(); }