private void dataGridViewGepek_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { buttonSave.Visible = true; buttonCancel.Visible = true; modositva_gep = true; int sor = dataGridViewGepek.SelectedRows[0].Index; //int gepid = Convert.ToInt32(dataGridViewGepek.Rows[sor].Cells["id"].Value); Gepek gepek = new Gepek( Convert.ToInt32(dataGridViewGepek.SelectedRows[0].Cells["id"].Value), dataGridViewGepek.SelectedRows[0].Cells["gyarto"].Value.ToString(), dataGridViewGepek.SelectedRows[0].Cells["sorozat"].Value.ToString(), dataGridViewGepek.SelectedRows[0].Cells["tipus"].Value.ToString(), Convert.ToDouble(dataGridViewGepek.SelectedRows[0].Cells["pixel"].Value), dataGridViewGepek.SelectedRows[0].Cells["szenzor"].Value.ToString(), dataGridViewGepek.SelectedRows[0].Cells["objektiv"].Value.ToString(), Convert.ToInt32(dataGridViewGepek.SelectedRows[0].Cells["ar"].Value) ); GepekOperations go = new GepekOperations(gepek); Gepek modositottGepek = go.getModositottGepek(); dataGridViewGepek.Rows[sor].Cells["gyarto"].Value = modositottGepek.getGyarto(); dataGridViewGepek.Rows[sor].Cells["sorozat"].Value = modositottGepek.getSorozat(); dataGridViewGepek.Rows[sor].Cells["tipus"].Value = modositottGepek.getTipus(); dataGridViewGepek.Rows[sor].Cells["pixel"].Value = modositottGepek.getPixel(); dataGridViewGepek.Rows[sor].Cells["szenzor"].Value = modositottGepek.getSzenzor(); dataGridViewGepek.Rows[sor].Cells["objektiv"].Value = modositottGepek.getObjektiv(); dataGridViewGepek.Rows[sor].Cells["ar"].Value = modositottGepek.getAr(); }
private void buttonAdd_Click(object sender, EventArgs e) { int ujId = 0; GepekOperations go = new GepekOperations(ujId); ujId = go.getUjId(); string gyarto = textBoxGyarto.Text; string sorozat = textBoxSorozat.Text; string tipus = textBoxTipus.Text; double pixel = Convert.ToDouble(textBoxPixel.Text); string szenzor = textBoxSzenzor.Text; string objektiv = textBoxObjektiv.Text; int ar = Convert.ToInt32(textBoxAr.Text); Database update = new Database(); mdi = update.kapcsolodas(); mdi.open(); string query = ""; query += "INSERT INTO gepek (id,gyarto,sorozat,tipus,pixel,szenzor,objektiv,ar) VALUES "; query += "(" + ujId + ", "; query += "\"" + gyarto + "\", "; query += "\"" + sorozat + "\", "; query += "\"" + tipus + "\", "; query += pixel + ", "; query += "\"" + szenzor + "\", "; query += "\"" + objektiv + "\", "; query += ar + ")"; mdi.executeDMQuery(query); mdi.close(); int sor = dataGridViewGepek.Rows.Count - 1; dataGridViewGepek.Rows[sor].Cells["id"].Value = ujId; dataGridViewGepek.Rows[sor].Cells["gyarto"].Value = gyarto; dataGridViewGepek.Rows[sor].Cells["sorozat"].Value = sorozat; dataGridViewGepek.Rows[sor].Cells["tipus"].Value = tipus; dataGridViewGepek.Rows[sor].Cells["pixel"].Value = pixel; dataGridViewGepek.Rows[sor].Cells["szenzor"].Value = szenzor; dataGridViewGepek.Rows[sor].Cells["objektiv"].Value = objektiv; dataGridViewGepek.Rows[sor].Cells["ar"].Value = ar; textBoxGyarto.Clear(); textBoxSorozat.Clear(); textBoxTipus.Clear(); textBoxPixel.Clear(); textBoxSzenzor.Clear(); textBoxObjektiv.Clear(); textBoxAr.Clear(); }