public ro_tipo_gastos_personales_Info get_info(string IdTipoGasto) { try { ro_tipo_gastos_personales_Info info = new ro_tipo_gastos_personales_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_tipo_gastos_personales Entity = Context.ro_tipo_gastos_personales.FirstOrDefault(q => q.IdTipoGasto == IdTipoGasto); if (Entity == null) { return(null); } info = new ro_tipo_gastos_personales_Info { IdTipoGasto = Entity.IdTipoGasto, nom_tipo_gasto = Entity.nom_tipo_gasto, }; } return(info); } catch (Exception) { throw; } }
public bool modificarDB(ro_tipo_gastos_personales_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_tipo_gastos_personales Entity = Context.ro_tipo_gastos_personales.FirstOrDefault(q => q.IdTipoGasto == info.IdTipoGasto); if (Entity == null) { return(false); } Entity.nom_tipo_gasto = info.nom_tipo_gasto; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool guardarDB(ro_tipo_gastos_personales_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_tipo_gastos_personales Entity = new ro_tipo_gastos_personales { IdTipoGasto = info.IdTipoGasto, nom_tipo_gasto = info.nom_tipo_gasto, estado = info.estado = "A", Fecha_Transac = DateTime.Now, IdUsuario = info.IdUsuario }; Context.ro_tipo_gastos_personales.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }