コード例 #1
0
        private void BActualizar_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < dgElementos.RowCount; i++)
            {
                Elemento.error_test(dgElementos[0, i].Value.ToString(), dgElementos[1, i].Value.ToString(), dgElementos[2, i].Value.ToString());
            }

            for (int i = 0; i < dgElementos.RowCount; i++)
            {
                Elemento.actualizar(
                    Convert.ToInt32(dgElementos[3, i].Value),
                    dgElementos[1, i].Value.ToString(),
                    dgElementos[0, i].Value.ToString(),
                    dgElementos[2, i].Value.ToString()
                    );
            }
            MessageBox.Show("Todos los elementos están actualizados.");
            Fill();
        }
コード例 #2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            for (int i = aElementos.Count; i < dgElementos.RowCount - 1; i++)
            {
                Elemento.error_test(dgElementos[0, i].Value.ToString().ToUpper(),
                                    (dgElementos[1, i].Value != null) ? dgElementos[1, i].Value.ToString().ToUpper() : "",
                                    (dgElementos[2, i].Value != null) ? dgElementos[2, i].Value.ToString().ToUpper() : "");
            }

            for (int i = aElementos.Count; i < dgElementos.RowCount - 1; i++)
            {
                Elemento ele = Elemento.create(dgElementos[0, i].Value.ToString().ToUpper(),
                                               (dgElementos[1, i].Value != null)?dgElementos[1, i].Value.ToString().ToUpper():"",
                                               (dgElementos[2, i].Value != null) ? dgElementos[2, i].Value.ToString().ToUpper() : "");

                aElementos.Add(ele);
            }

            MessageBox.Show("Todos los elementos fueron añadidos correctamente.");

            dgElementos.Rows.Clear();
            Fill();
        }