public ro_tipo_gastos_personales_maxim_x_anio_Info get_info(int IdGasto) { try { ro_tipo_gastos_personales_maxim_x_anio_Info info = new ro_tipo_gastos_personales_maxim_x_anio_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_tipo_gastos_personales_tabla_valores_x_anio Entity = Context.ro_tipo_gastos_personales_tabla_valores_x_anio.FirstOrDefault(q => q.IdGasto == IdGasto); if (Entity == null) { return(null); } info = new ro_tipo_gastos_personales_maxim_x_anio_Info { IdGasto = Entity.IdGasto, IdTipoGasto = Entity.IdTipoGasto, AnioFiscal = Entity.AnioFiscal, estado = Entity.estado, Monto_max = Entity.Monto_max, EstadoBool = Entity.estado == "A" ? true : false }; } return(info); } catch (Exception) { throw; } }
public bool guardarDB(ro_tipo_gastos_personales_maxim_x_anio_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_tipo_gastos_personales_tabla_valores_x_anio Entity = new ro_tipo_gastos_personales_tabla_valores_x_anio { IdGasto = info.IdGasto = get_id(), IdTipoGasto = info.IdTipoGasto, AnioFiscal = info.AnioFiscal, Monto_max = info.Monto_max, estado = info.estado = "A", Fecha_Transac = DateTime.Now, IdUsuario = info.IdUsuario, observacion = info.observacion = " " }; Context.ro_tipo_gastos_personales_tabla_valores_x_anio.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool anularDB(ro_tipo_gastos_personales_maxim_x_anio_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_tipo_gastos_personales_tabla_valores_x_anio Entity = Context.ro_tipo_gastos_personales_tabla_valores_x_anio.FirstOrDefault(q => q.IdTipoGasto == info.IdTipoGasto && q.IdGasto == info.IdGasto); if (Entity == null) { return(false); } Entity.estado = info.estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean GuardarDB(List <ro_tipo_gastos_personales_tabla_valores_x_anio_Info> List_Info, ref string msg) { try { foreach (var item in List_Info) { using (EntitiesRoles Context = new EntitiesRoles()) { var Address = new ro_tipo_gastos_personales_tabla_valores_x_anio(); Address.IdGasto = getId(); Address.IdTipoGasto = item.IdTipoGasto; Address.AnioFiscal = item.AnioFiscal; Address.observacion = item.observacion; Address.Monto_max = item.Monto_max; Address.IdUsuario = item.IdUsuario; Address.Fecha_Transac = item.Fecha_Transac; Address.estado = "A"; Context.ro_tipo_gastos_personales_tabla_valores_x_anio.Add(Address); Context.SaveChanges(); } } return(true); } catch (Exception ex) { string array = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }