public Boolean AnularDB(fa_pre_facturacion_Info info) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_pre_facturacion Entity = Context.fa_pre_facturacion.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdPreFacturacion == info.IdPreFacturacion); if (Entity != null) { info.Observacion = "**ANULADO**" + Entity.Observacion; Entity.estado_cierre = info.estado_cierre = true; info.estado = Entity.estado; Context.SaveChanges(); } } return(true); } catch (Exception ex) { string MensajeError = ""; 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public fa_pre_facturacion_Info Get_Info_x_periodo(int IdEmpresa, int IdPeriodo) { try { fa_pre_facturacion_Info info = new fa_pre_facturacion_Info(); using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_pre_facturacion Entity = Context.fa_pre_facturacion.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdPeriodo == IdPeriodo); if (Entity != null) { info.IdEmpresa = Entity.IdEmpresa; info.IdPreFacturacion = Entity.IdPreFacturacion; info.IdPeriodo = Entity.IdPeriodo; info.Observacion = Entity.Observacion; info.IdEstado_Proceso = Entity.IdEstado_Proceso; info.fecha = Entity.fecha; info.estado = Entity.estado; } } return(info); } catch (Exception ex) { string MensajeError = ""; 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(fa_pre_facturacion_Info info) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_pre_facturacion Entity = new fa_pre_facturacion(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdPreFacturacion = info.IdPreFacturacion = GetId(info.IdEmpresa); Entity.IdPeriodo = info.IdPeriodo; Entity.Observacion = info.Observacion; Entity.estado_cierre = info.estado_cierre; Entity.fecha = info.fecha; Entity.estado = "A"; Entity.IdCentroCosto = info.IdCentroCosto; Entity.ValorFacturar = (info.ValorFacturar == null) ? 0 : Convert.ToDouble(info.ValorFacturar); Entity.TotalEquipos = (info.TotalEquipos == null) ? 0 : Convert.ToInt32(info.TotalEquipos); Context.fa_pre_facturacion.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception ex) { string MensajeError = ""; 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean GuardarDB(fa_pre_facturacion_Info info) { try { using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ()) { fa_pre_facturacion Entity = new fa_pre_facturacion(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdPreFacturacion = info.IdPreFacturacion; Entity.IdPeriodo = info.IdPeriodo; Entity.Observacion = info.Observacion; Entity.IdEstado_Proceso = info.IdEstado_Proceso; Entity.fecha = info.fecha; Entity.estado = "A"; Context.fa_pre_facturacion.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception ex) { string MensajeError = ""; 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }