private void butFILTRAR_Click(object sender, EventArgs e) { DB = new PC1_Web_20171Entities(); var Filtro = textFILTRO.Text; if (Filtro == "") { MessageBox.Show("NO HA ESCRITO NADA EN LA CASILLA DEL TEXTO ESCRIBA UN NOMBRE O DESCRIPCION"); Cargar(); } else if (Filtro == "POR NOMBRE O POR DESCRIPCION") { MessageBox.Show("NO HA ESCRITO NADA EN LA CASILLA DEL TEXTO ESCRIBA UN NOMBRE O DESCRIPCION"); Cargar(); } else if (Filtro != "" && Filtro != "POR NOMBRE O POR DESCRIPCION") { var Query = DB.Proyecto.Select(x => new { ProyectoId = x.ProyectoId, Finalizado = x.EstaFinalizado, Fecha = x.Fecha, Nombre = x.Nombre, Desarrollador_Responsable = x.Desarrollador.Nombre + " " + x.Desarrollador.Apellido, Porcentaje_Acumulado = x.Avance.Sum(y => (Decimal?)y.Porcentaje), Horas_Totales = x.Avance.Sum(z => (Decimal?)z.Horas), Descripcion = x.Descripcion }).Where(x => x.Nombre.Contains(Filtro) || x.Descripcion.Contains(Filtro)).AsQueryable(); dgvPROYECTOS.DataSource = Query.ToList(); } textFILTRO.Clear(); }
private void butFILTRAR_Click(object sender, EventArgs e) { DB = new PC1_Web_20171Entities(); var filtro = textFILTRO.Text; if (filtro == "") { MessageBox.Show("NO HA ESCRITO NADA EN LA CASILLA DEL TEXTO ESCRIBA UN NOMBRE O APELLIDO"); CargarResultados(); } else if (filtro == "POR NOMBRE O APELLIDO") { MessageBox.Show("NO HA ESCRITO NADA EN LA CASILLA DEL TEXTO ESCRIBA UN NOMBRE O APELLIDO"); CargarResultados(); } else if (filtro != "" && filtro != "POR NOMBRE O APELLIDO") { var QueryTipoDoc = DB.Desarrollador.Select(x => new { Sigla_De_Documento = x.TipoDocumento.Siglas, Nro_Documento = x.NroDocumento, Nombre = x.Nombre, Apellido = x.Apellido }).Where(x => x.Nombre.Contains(filtro) || x.Apellido.Contains(filtro)).AsQueryable(); dgVDESARROLLADOR.DataSource = QueryTipoDoc.ToList(); } textFILTRO.Clear(); textFILTRO.ForeColor = System.Drawing.Color.DarkGray; textFILTRO.Text = "POR NOMBRE Y APELLIDO"; }
private void CargarBox() { DB = new PC1_Web_20171Entities(); var cb = DB.Proyecto.Select(x => new { Nombre = x.Nombre, Id = x.ProyectoId }).AsQueryable(); CbElegirEquipo.DataSource = cb.ToList(); CbElegirEquipo.DisplayMember = "Nombre"; CbElegirEquipo.ValueMember = "Id"; }
public void ListarCbDesarrollador() { DB = new PC1_Web_20171Entities(); var Lista = DB.Desarrollador.Select(x => new { Id = x.DesarrolladorId, NombreCompleto = x.Nombre + " " + x.Apellido }).AsQueryable(); CbDESARROLLADOR.DataSource = Lista.ToList(); CbDESARROLLADOR.DisplayMember = "NombreCompleto"; CbDESARROLLADOR.ValueMember = "Id"; }
private void CargarCbProyecto() { DB = new PC1_Web_20171Entities(); var query = DB.Proyecto.Select(x => new { Name = x.Nombre, Id = x.ProyectoId }).AsQueryable(); CbProyecto.DataSource = query.ToList(); CbProyecto.DisplayMember = "Name"; CbProyecto.ValueMember = "Id"; }
private void CargarTipoDocumento() { DB = new PC1_Web_20171Entities(); var TD = DB.TipoDocumento.Select(x => new { Id = x.TipoDocumentoId, sigla = x.Siglas }).AsQueryable(); CbTIPODOCUMENTO.DataSource = TD.ToList(); CbTIPODOCUMENTO.DisplayMember = "sigla"; CbTIPODOCUMENTO.ValueMember = "Id"; }
private void CargarDGVEQUIPO() { DB = new PC1_Web_20171Entities(); var query = DB.Proyecto.Select(x => new { NombreProyecto = x.Nombre, Descripcion = x.Descripcion, Finalizado = x.EstaFinalizado, }).AsQueryable(); DgvEQUIPO.DataSource = query.ToList(); }
public void Cargar() { DB = new PC1_Web_20171Entities(); if (ProyectoID.HasValue) { var proyecto = DB.Proyecto.Find(ProyectoID); textNOMBRE.Text = proyecto.Nombre; textDESCRIPCION.Text = proyecto.Descripcion; CbDESARROLLADOR.SelectedValue = proyecto.DesarrolladorReponsableId; DtpFECHAFINALIZADO.Value = proyecto.Fecha; checkFINALIZADO.Checked = Convert.ToBoolean(proyecto.EstaFinalizado); } }
private void CargarCBEQUIPO() { DB = new PC1_Web_20171Entities(); var query = DB.Proyecto.Select(x => new { proyecto = x.Nombre, id = x.ProyectoId }).AsQueryable(); CbSELECCIONAREQUIPO.DataSource = query.ToList(); CbSELECCIONAREQUIPO.DisplayMember = "proyecto"; CbSELECCIONAREQUIPO.ValueMember = "id"; }
private void CargarResultados() { DB = new PC1_Web_20171Entities(); var QueryTipoDoc = DB.Desarrollador.Select(x => new { Sigla_De_Documento = x.TipoDocumento.Siglas, Nro_Documento = x.NroDocumento, Nombre = x.Nombre, Apellido = x.Apellido }).AsQueryable(); dgVDESARROLLADOR.DataSource = QueryTipoDoc.ToList(); }
private void butListar_Click(object sender, EventArgs e) { DB = new PC1_Web_20171Entities(); var cb = Convert.ToInt32(CbProyecto.SelectedValue); var query = DB.DesarrolladorProyecto.Where(y => y.ProyectoId == cb).Select(x => new { Id = x.Desarrollador.DesarrolladorId, Name = x.Desarrollador.Nombre + " " + x.Desarrollador.Apellido }).AsQueryable(); CbDesarrollador.DataSource = query.ToList(); CbDesarrollador.DisplayMember = "Name"; CbDesarrollador.ValueMember = "Id"; }
private void NoAsignadoYProyecto() { DB = new PC1_Web_20171Entities(); var cb = Convert.ToInt32(CbSELECCIONAREQUIPO.SelectedValue); var query = DB.Proyecto.Where(x => x.ProyectoId == cb) .Select(x => new { NombreProyecto = x.Nombre, Descripcion = x.Descripcion, Finalizado = x.EstaFinalizado }).AsQueryable(); DgvEQUIPO.DataSource = query.ToList(); }
private void CargarDGVDESARROLLADOR() { DB = new PC1_Web_20171Entities(); var query = DB.Desarrollador.Select(x => new { SiglaDocumento = x.TipoDocumento.Siglas, NroDocumento = x.NroDocumento, Nombre = x.Nombre, Apellido = x.Apellido, id = x.DesarrolladorId }).AsQueryable(); DgvDESARROLLADORESDISPONIBLES.DataSource = query.ToList(); }
private void CargarListaAvance() { DB = new PC1_Web_20171Entities(); var QueryAvance = DB.Avance.OrderByDescending(y => y.Fecha).Select(x => new { Id = x.AvanceId, FechaAvance = x.Fecha, SiglaDelDocumentoDelDesarrollador = x.Desarrollador.TipoDocumento.Siglas, NombreCompleto = x.Desarrollador.Nombre + " " + x.Desarrollador.Apellido, Porcentaje = x.Porcentaje, Horas = x.Horas }).AsQueryable(); DgvAvance.DataSource = QueryAvance.ToList(); }
private void Cargar() { DB = new PC1_Web_20171Entities(); var Query = DB.Proyecto.Select(x => new { ProyectoId = x.ProyectoId, Finalizado = x.EstaFinalizado, Fecha = x.Fecha, Nombre = x.Nombre, Desarrollador_Responsable = x.Desarrollador.Nombre + " " + x.Desarrollador.Apellido, Porcentaje_Acumulado = x.Avance.Sum(y => (Decimal?)y.Porcentaje), Horas_Totales = x.Avance.Sum(z => (Decimal?)z.Horas), Descripcion = x.Descripcion }).AsQueryable(); dgvPROYECTOS.DataSource = Query.ToList(); }
private void CargarDgv() { DB = new PC1_Web_20171Entities(); var query = DB.DesarrolladorProyecto.Select(x => new { FechaAsociacion = x.Fecha, SiglaDocumento = x.Desarrollador.TipoDocumento.Siglas, NroDocumento = x.Desarrollador.NroDocumento, NombreCompleto = x.Desarrollador.Nombre + " " + x.Desarrollador.Apellido, Nombre = x.Desarrollador.Nombre, Apellido = x.Desarrollador.Apellido, Id = x.Proyecto.ProyectoId }).AsQueryable(); DgvEquipo.Columns["PorcentajeAcumulado"].Visible = false; DgvEquipo.Columns["HorasTotales"].Visible = false; DgvEquipo.DataSource = query.ToList(); }
private void butReportesDeProyecto_Click(object sender, EventArgs e) { DB = new PC1_Web_20171Entities(); var query = DB.Proyecto.Select(x => new { Finalizado = x.EstaFinalizado, //LISTO FechaInicio = x.Fecha, //FECHA DE INICIO DE LA CREACION Name = x.Nombre, //LISTO PorcentajeAvanceAcumulado = x.Avance.Sum(n => (Decimal?)n.Porcentaje), //LISTO HorasTotalesAvance = x.Avance.Sum(ñ => (Decimal?)ñ.Horas), //LISTO CantDesarrolladoresAsignados = x.DesarrolladorProyecto.Select(o => o.DesarrolladorId).Count(), //LISTO FechaUltimaActualizacion = x.Avance.OrderByDescending(m => m.Fecha).Select(l => l.Fecha).FirstOrDefault(), //LISTO UltimoDesarrolladorEnActualizar = x.Avance.OrderByDescending(m => m.Fecha) .Select(o => o.Desarrollador.Nombre).FirstOrDefault() }).AsQueryable(); DgvReporteProyecto.DataSource = query.ToList(); }
private void butSELECT_Click(object sender, EventArgs e) { DB = new PC1_Web_20171Entities(); var cb = Convert.ToInt32(CbSELECCIONAREQUIPO.SelectedValue); var query = DB.Proyecto.Where(x => x.ProyectoId == cb) .Select(x => new { NombreProyecto = x.Nombre, Descripcion = x.Descripcion, Finalizado = x.EstaFinalizado }).AsQueryable(); DgvEQUIPO.DataSource = query.ToList(); //MOSTRAR EN EL OTRO DGV LOS DESARROLLADORES NO ASGINADOS /*SELECT DISTINCT DesarrolladorId FROM DesarrolladorProyecto WHERE DesarrolladorId NOT IN * (SELECT DesarrolladorId FROM DesarrolladorProyecto WHERE ProyectoId = 4)*/ var Q = (from c in DB.Desarrollador where !(from o in DB.DesarrolladorProyecto where o.ProyectoId == cb select o.DesarrolladorId).Contains(c.DesarrolladorId) select new { SiglaDocumento = c.TipoDocumento.Siglas, NroDocumento = c.NroDocumento, Nombre = c.Nombre, Apellido = c.Apellido, Id = c.DesarrolladorId }).Distinct(); DgvDESARROLLADORESDISPONIBLES.DataSource = Q.ToList(); /*************************************************/ var I = DB.DesarrolladorProyecto.Where(y => y.ProyectoId == cb).Select(x => new { NombreIntegrante = x.Desarrollador.Nombre, ApellidoIntegrante = x.Desarrollador.Apellido, IdIntegrante = x.DesarrolladorId, }).AsQueryable(); DgvASIGNADOS.DataSource = I.ToList(); }
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(); }
private void butReportesPorResponsable_Click(object sender, EventArgs e) { DB = new PC1_Web_20171Entities(); var query = DB.Proyecto.Select(x => new { SiglaDocumento = x.Desarrollador.TipoDocumento.Siglas, NroDocumento = x.Desarrollador.NroDocumento, Nombre = x.Desarrollador.Nombre, Apellido = x.Desarrollador.Apellido, CantProyectosFinalizados = DB.Proyecto .Where(z => z.DesarrolladorReponsableId == x.DesarrolladorReponsableId) .Where(a => a.EstaFinalizado == true) .Select(y => y.EstaFinalizado).Count(), CantProyectosPendientes = DB.Proyecto .Where(z => z.DesarrolladorReponsableId == x.DesarrolladorReponsableId) .Where(a => a.EstaFinalizado == false) .Select(y => y.EstaFinalizado).Count(), PorcentajeDeAvance = (DB.Avance .Where(w => (w.Proyecto.DesarrolladorReponsableId == x.DesarrolladorReponsableId) && (w.Proyecto.EstaFinalizado == false)) .Sum(s => (Decimal?)s.Porcentaje)) / (DB.Proyecto .Where(w => (w.DesarrolladorReponsableId == x.DesarrolladorReponsableId) && (w.EstaFinalizado == false)) .Select(s => s.ProyectoId).Count()) }).Distinct().ToList(); DgvReporteResponsable.DataSource = query.ToList(); }