public static bool ExistGerente(string codigoNomina) { bool respuesta = true; SO_Gerente sO_Gerente = new SO_Gerente(); IList informacionBD = sO_Gerente.GetGerente(codigoNomina); if (informacionBD != null) { if (informacionBD.Count == 0) { respuesta = false; } } return(respuesta); }
public static DO_Gerente GetGerente(int idGerente) { DO_Gerente gerente = new DO_Gerente(); SO_Gerente sO_Gerente = new SO_Gerente(); IList informacionBD = sO_Gerente.GetGerente(idGerente); if (informacionBD != null) { foreach (var itemGerente in informacionBD) { gerente = new DO_Gerente(); Type tipo = itemGerente.GetType(); gerente.IdGerente = (int)tipo.GetProperty("Id").GetValue(itemGerente, null); gerente.CodigoNomina = (string)tipo.GetProperty("CodigoNomina").GetValue(itemGerente, null); gerente.Nombre = (string)tipo.GetProperty("Nombre").GetValue(itemGerente, null); gerente.Entidad = (string)tipo.GetProperty("Entidad").GetValue(itemGerente, null); gerente.IsActive = (bool)tipo.GetProperty("Activo").GetValue(itemGerente, null); if (Convert.ToDateTime(tipo.GetProperty("FechaInicio").GetValue(itemGerente, null)) != DateTime.MinValue) { gerente.FechaInicio = (DateTime)tipo.GetProperty("FechaInicio").GetValue(itemGerente, null); } if (Convert.ToDateTime(tipo.GetProperty("FechaTermino").GetValue(itemGerente, null)) != DateTime.MinValue) { gerente.FechaTermino = (DateTime)tipo.GetProperty("FechaTermino").GetValue(itemGerente, null); } gerente.Cargo = (string)tipo.GetProperty("Cargo").GetValue(itemGerente, null); } } return(gerente); }