public Boolean Actualizar_registro(ba_Archivo_Transferencia_Det_Info Info) { try { try { using (EntitiesBanco Conexion = new EntitiesBanco()) { ba_Archivo_Transferencia_Det Entity = Conexion.ba_Archivo_Transferencia_Det.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdArchivo == Info.IdArchivo && q.Secuencia == Info.Secuencia); if (Entity != null) { Entity.Id_Item = Info.Id_Item; Entity.IdEstadoRegistro_cat = Info.IdEstadoRegistro_cat == null ? "REG_COBR" : Info.IdEstadoRegistro_cat; Entity.Valor_cobrado = Info.Valor_cobrado; Entity.Fecha_proceso = Info.Fecha_Proceso; Entity.Contabilizado = Info.Contabilizado; Conexion.SaveChanges(); } } } catch (DbEntityValidationException ex) { string arreglo = ToString(); foreach (var item in ex.EntityValidationErrors) { foreach (var item_validaciones in item.ValidationErrors) { mensaje = "Propiedad: " + item_validaciones.PropertyName + " Mensaje: " + item_validaciones.ErrorMessage + "\n"; } } 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(mensaje, "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } return(true); } catch (Exception ex) { 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.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(ba_Archivo_Transferencia_Det_Info Info) { try { try { using (EntitiesBanco Conexion = new EntitiesBanco()) { ba_Archivo_Transferencia_Det Entity = Conexion.ba_Archivo_Transferencia_Det.FirstOrDefault(q => q.IdEmpresa == Info.IdEmpresa && q.IdArchivo == Info.IdArchivo && q.Secuencia == Info.Secuencia); if (Entity != null) { Entity.IdEmpresa_pago = Info.IdEmpresa_pago; Entity.IdTipoCbte_pago = Info.IdTipoCbte_pago; Entity.IdCbteCble_pago = Info.IdCbteCble_pago; Conexion.SaveChanges(); } } } catch (DbEntityValidationException ex) { string arreglo = ToString(); foreach (var item in ex.EntityValidationErrors) { foreach (var item_validaciones in item.ValidationErrors) { mensaje = "Propiedad: " + item_validaciones.PropertyName + " Mensaje: " + item_validaciones.ErrorMessage + "\n"; } } 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(mensaje, "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } return(true); } catch (Exception ex) { 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.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }
public bool GrabarDB(List <ba_Archivo_Transferencia_Det_Info> Lista) { try { try { int secuencia = 0; using (EntitiesBanco context = new EntitiesBanco()) { foreach (var item in Lista) { secuencia = secuencia + 1; ba_Archivo_Transferencia_Det Addres = new ba_Archivo_Transferencia_Det(); Addres.IdEmpresa = item.IdEmpresa; Addres.IdArchivo = item.IdArchivo; Addres.IdProceso_bancario = item.IdProceso_bancario; Addres.Secuencia = item.Secuencia = secuencia; Addres.IdEmpresa_OP = item.IdEmpresa_OP; Addres.IdOrdenPago = item.IdOrdenPago; Addres.Secuencia_OP = item.Secuencia_OP; Addres.IdNominaTipo = item.IdNominaTipo; Addres.IdNominaTipoLiqui = item.IdNominaTipoLiqui; Addres.IdPeriodo = item.IdPeriodo; Addres.IdEmpleado = item.IdEmpleado; Addres.IdRubro = item.IdRubro; Addres.Valor = item.Valor; Addres.IdEstadoRegistro_cat = item.IdEstadoRegistro_cat; Addres.Estado = true; Addres.IdEstadoRegistro_cat = item.IdEstadoRegistro_cat; Addres.Id_Item = item.Id_Item; Addres.Valor_cobrado = 0; Addres.Secuencial_reg_x_proceso = item.Secuencial_reg_x_proceso; Addres.IdPreFacturacion_col = item.IdPreFacturacion_col; Addres.Secuencia_Proce_col = item.Secuencia_Proce_col; Addres.secuencia_col = item.secuencia_col; Addres.IdInstitucion_col = item.IdInstitucion_Col; Addres.idContrato = item.IdContrato; Addres.IdInstitucion_contrato = item.IdInstitucion_contra; context.ba_Archivo_Transferencia_Det.Add(Addres); context.SaveChanges(); } if (Lista.Count() == 0) { return(false); } return(true); } } catch (DbEntityValidationException ex) { string arreglo = ToString(); foreach (var item in ex.EntityValidationErrors) { foreach (var item_validaciones in item.ValidationErrors) { mensaje = "Propiedad: " + item_validaciones.PropertyName + " Mensaje: " + item_validaciones.ErrorMessage + "\n"; } } 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(mensaje, "", arreglo, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } } catch (Exception ex) { 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.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }