public bool GuardarDB(ct_distribucion_gastos_x_periodo_Info info) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { ct_distribucion_gastos_x_periodo Entity = new ct_distribucion_gastos_x_periodo(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdDistribucion = info.IdDistribucion = get_id(info.IdEmpresa); Entity.IdPeriodo = info.IdPeriodo; Entity.Fecha = info.Fecha; Entity.Estado = info.Estado; Entity.Observacion = info.Observacion; Context.ct_distribucion_gastos_x_periodo.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception ex) { string mensaje = ""; string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }
public bool AnularDB(int IdEmpresa, decimal IdDistribucion) { try { using (EntitiesContabilidad_FJ Context = new EntitiesContabilidad_FJ()) { ct_distribucion_gastos_x_periodo Entity = Context.ct_distribucion_gastos_x_periodo.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdDistribucion == IdDistribucion); if (Entity != null) { Entity.Estado = false; Context.SaveChanges(); } } return(true); } catch (Exception ex) { string mensaje = ""; string arreglo = 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(), "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }