private void adaugareToolStripMenuItem_Click(object sender, EventArgs e) { AddMasina addMasina = new AddMasina(); addMasina.uid = this.masini.uid; addMasina.an = this.masini.an; addMasina.model = this.masini.model; addMasina.marca = this.masini.marca; addMasina.serie = this.masini.serie; addMasina.motor = this.masini.motor; addMasina.kW = this.masini.kW; addMasina.categorii = this.piese.categorii(); int num = (int)addMasina.ShowDialog(); if (!this.masini.insert(addMasina.output)) { return; } this.init(); }
private void doneBtn_Click(object sender, EventArgs e) { this.muid = AddMasina.str_rand(32); this.output = "INSERT INTO `masina` (`uid`, `marca`, `model`, `an`, `motor`, `kW`, `serie`, `sters`, `cmc`) VALUES ('" + this.muid + "', '" + this.marcaBox.Text + "', '" + this.modelBox.Text + "', '" + this.anBox.Text + "', '" + this.motorBox.Text + "', '" + this.kwBox.Text + "', '" + this.serBox.Text + "', '0', " + this.comboBox1.Text + "); "; if (this.dataGridView1.Rows.Count > 0) { foreach (DataGridViewRow row in (IEnumerable)this.dataGridView1.Rows) { string str1 = AddMasina.str_rand(32); Thread.Sleep(10); string str2 = ""; if (row.Cells[0].Value == null) { str2 = " "; } if (row.Cells[1].Value != null) { this.output = this.output + string.Format(" INSERT INTO `piese` (`uid`, `pret`, `cod_piesa`, `nume_piesa`, `cantitate`, `status`, `muid`, `cuid`) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}'); ", (object)str1, row.Cells[2].Value, (object)str2, row.Cells[1].Value, row.Cells[3].Value, (object)"1", (object)this.muid, row.Cells[4].Value); } } } this.Close(); }