Esempio n. 1
0
        void LlenarTemporales()
        {
            foreach (DataGridViewRow f in grdData.Rows)
            {
                if (f.Cells["type"].Value != null && f.Cells["status"].Value != null && f.Cells["status"].Value.ToString() == "Editado")
                {
                    DocenteDto _u = new DocenteDto();
                    switch (f.Cells["type"].Value.ToString())
                    {
                    case "noTemp":
                        _u.IdDocente = int.Parse(f.Cells["IdDocente"].Value.ToString());
                        _u.Nombre    = f.Cells["Nombre"].Value != null ? f.Cells["Nombre"].Value.ToString() : null;
                        _u.Apellidos = f.Cells["Apellidos"].Value != null ? f.Cells["Apellidos"].Value.ToString() : null;
                        _u.Email     = f.Cells["Email"].Value != null ? f.Cells["Email"].Value.ToString() : null;
                        temp_edit.Add(_u);
                        break;

                    case "temp":
                        _u.Nombre    = f.Cells["Nombre"].Value != null ? f.Cells["Nombre"].Value.ToString() : null;
                        _u.Apellidos = f.Cells["Apellidos"].Value != null ? f.Cells["Apellidos"].Value.ToString() : null;
                        _u.Email     = f.Cells["Email"].Value != null ? f.Cells["Email"].Value.ToString() : null;
                        temp_insert.Add(_u);
                        break;
                    }
                }
            }
        }
Esempio n. 2
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (grdData.SelectedRows.Count != 0)
     {
         if (grdData.Rows[grdData.SelectedRows[0].Index].Cells["type"].Value.ToString() == "noTemp")
         {
             DocenteDto _u = new DocenteDto();
             _u.IdDocente = int.Parse(grdData.Rows[grdData.SelectedRows[0].Index].Cells["IdDocente"].Value.ToString());
             temp_delete.Add(_u);
         }
         grdData.Rows.Remove(grdData.Rows[grdData.SelectedRows[0].Index]);
     }
     else
     {
         MessageBox.Show("Seleccione 1 o más filas para eliminar");
     }
 }