private void GetAllButton_Click(object sender, EventArgs e) { string text = CargoComboBox.Text; if (CargoComboBox.Items.Count != 0 && text != "") { string selectStatement = "select * from cargoList where warehouse_id = \"" + cargo_name + "\" and " + "cargo_id = \"" + text + "\""; com = new MySqlCommand(selectStatement, Login.con); MySqlDataReader data_reader = com.ExecuteReader(); if (data_reader.HasRows) { while (data_reader.Read()) { int i = Convert.ToInt32(data_reader.GetString("row_id")); int j = Convert.ToInt32(data_reader.GetString("column_id")); MetroTileA[i, j].Style = MetroColorStyle.Green; } } TableLayOut.Refresh(); data_reader.Close(); string deleteStatement = "delete from cargoList where warehouse_id = \"" + cargo_name + "\" and " + "cargo_id = \"" + text + "\""; com = new MySqlCommand(deleteStatement, Login.con); com.ExecuteNonQuery(); string insertStatement = "insert into finishlist values(\"" + worker_id + "\",\"" + text + "\",localtimestamp())"; com = new MySqlCommand(insertStatement, Login.con); com.ExecuteNonQuery(); CargoComboBox.Items.Remove(text); } }
private void CargoComboBox_SelectedValueChanged(object sender, EventArgs e) { string text = CargoComboBox.Text; Console.Write("test:" + text); UpdataTable(cargo_name); string selectStatement = "select * from cargoList where warehouse_id = \"" + cargo_name + "\" and " + "cargo_id = \"" + text + "\""; com = new MySqlCommand(selectStatement, Login.con); MySqlDataReader data_reader = com.ExecuteReader(); if (data_reader.HasRows) { while (data_reader.Read()) { int i = Convert.ToInt32(data_reader.GetString("row_id")); int j = Convert.ToInt32(data_reader.GetString("column_id")); Console.WriteLine("i:" + i.ToString()); MetroTileA[i, j].Style = MetroColorStyle.Yellow; } } TableLayOut.Refresh(); data_reader.Close(); }
private void metroButton1_Click(object sender, EventArgs e) { FillComboBox(); UpdataTable(cargo_name); TableLayOut.Refresh(); }