private void dataGridView2_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView dgv = sender as DataGridView;

            int row    = e.RowIndex;
            int column = e.ColumnIndex;

            DataGridViewCell cell = dgv.Rows[row].Cells[column];

            if (cell is DataGridViewButtonCell)
            {
                DataGridViewRow rowSelected = dgv.Rows[row];

                int        id1 = int.Parse((string)rowSelected.Cells["IdFelul1"].Value);
                int        id2 = int.Parse((string)rowSelected.Cells["IdFelul2"].Value);
                int        id3 = int.Parse((string)rowSelected.Cells["IdFelul3"].Value);
                List <int> idProduse = new int[] { id1, id2, id3 }.ToList();

                FinalizareComanda.Finalizare(utilizator.Id, idProduse, new int[] { 1, 1, 1 }.ToList());

                MessageBox.Show("Comanda trimisa!");

                this.Close();
                Start.GetInsance().Show();
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <int> cantitati = new List <int>();
            List <int> idProduse = new List <int>();

            foreach (DataGridViewRow item in dataGridView1.Rows)
            {
                try
                {
                    cantitati.Add(int.Parse((string)item.Cells["Cantitate"].Value));
                    idProduse.Add(int.Parse((string)item.Cells["idProdus"].Value));
                }
                catch { }
            }

            FinalizareComanda.Finalizare(idClient, idProduse, cantitati);

            MessageBox.Show("Comanda trimisa!");

            Start.GetInsance().Show();

            this.Close();
        }