private void addColumnToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectHeaderColumnIndex > -1) { if (stationComboBox.Text != "" && modelComboBox.Text != "" && customerComboBox.Text != "") { TABLECOLUMN tableCol = new TABLECOLUMN(); tableCol.Name = "New"; DataGridViewColumn dtCol = new DataGridViewColumn(); dtCol.Name = "New"; dtCol.Width = 60; dtCol.SortMode = DataGridViewColumnSortMode.NotSortable; dtCol.CellTemplate = new DataGridViewTextBoxCell(); DataGridView1.Columns.Insert(SelectHeaderColumnIndex, dtCol); tableColList.Insert(SelectHeaderColumnIndex, tableCol); Sqlite.InsertColumnInfo(stationComboBox.Text, modelComboBox.Text, customerComboBox.Text, SelectHeaderColumnIndex, tableCol); Sqlite.UpdateProduct(stationComboBox.Text, modelComboBox.Text, customerComboBox.Text, DataGridView1.RowCount, DataGridView1.ColumnCount); } SelectHeaderColumnIndex = -1; } }
private void deleteColumnToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectHeaderColumnIndex > -1) { if (stationComboBox.Text != "" && modelComboBox.Text != "" && customerComboBox.Text != "") { tableColList.RemoveAt(SelectHeaderColumnIndex); DataGridView1.Columns.RemoveAt(SelectHeaderColumnIndex); Sqlite.DeleteColumnInfo(stationComboBox.Text, modelComboBox.Text, customerComboBox.Text, SelectHeaderColumnIndex); Sqlite.UpdateProduct(stationComboBox.Text, modelComboBox.Text, customerComboBox.Text, DataGridView1.RowCount, DataGridView1.ColumnCount); } SelectHeaderColumnIndex = -1; } }
private void addRowToolStripMenuItem_Click(object sender, EventArgs e) { if (SelectHeaderRowIndex > -1) { DataGridView1.Rows.Insert(SelectHeaderRowIndex); for (int i = 0; i < DataGridView1.RowCount; i++) { DataGridView1.Rows[i].HeaderCell.Value = (i + 1).ToString(); } SelectHeaderRowIndex = -1; Sqlite.UpdateProduct(stationComboBox.Text, modelComboBox.Text, customerComboBox.Text, DataGridView1.RowCount, DataGridView1.ColumnCount); } }