Exemple #1
0
        private void butEliminarAvance_Click(object sender, EventArgs e)
        {
            if (DgvAvance.SelectedRows.Count == 0)
            {
                MessageBox.Show("SELECCIONE ALGUN DATO PARA ELIMINAR");
                return;
            }
            var    EliminarAvance = Convert.ToInt32(DgvAvance.SelectedRows[0].Cells["Id"].Value);
            Avance avance         = new Avance();
            var    remove         = DB.Avance.Where(x => x.AvanceId == EliminarAvance).FirstOrDefault();

            DB.Avance.Remove(remove);
            DB.SaveChanges();
            CargarListaAvance();
        }
Exemple #2
0
        private void butGuardar_Click(object sender, EventArgs e)
        {
            if (!ValidarDatos())
            {
                return;
            }
            DB = new PC1_Web_20171Entities();
            Avance avance = new Avance();

            avance.Descripcion = textDescripcion.Text;
            avance.Fecha       = DateTime.Parse(DtpFecha.Text);
            avance.DesarrolladorReponsableId = Convert.ToInt32(CbDesarrollador.SelectedValue);
            avance.Porcentaje = Convert.ToInt32(textPorcentaje.Text);
            avance.Horas      = Convert.ToInt32(textHora.Text);
            avance.ProyectoId = Convert.ToInt32(CbProyecto.SelectedValue);

            DB.Avance.Add(avance);
            DB.SaveChanges();
            this.Close();
        }