//texis agrego este metodo private static void ConsultarInfoComplementaria(int IDEmpresa, string Usuario, int? IDAutotanque, DireccionEntrega DireccionEntrega) { ConsultasGenerales consultaInformacionComplementaria = new ConsultasGeneralesCreator().FactoryMethod(DireccionEntrega.IDEmpresa, Fuente.CRM); if (!consultaInformacionComplementaria.ConsultarInformacionComplementaria(DireccionEntrega.IDEmpresa, DireccionEntrega)) { DireccionEntrega.Success = false; DireccionEntrega.Message = consultaInformacionComplementaria.Message; DireccionEntrega.InternalException = consultaInformacionComplementaria.InternalException; } }
public bool Consultar(DbDataReader GReader = null) { DataManager.DataManager datos = null; DbDataReader reader = null; bool controladorDatosLocal = true; if (GReader != null) { controladorDatosLocal = false; reader = GReader; } else { datos = new DataManager.DataManager(App.CadenaConexion(IDEmpresa), App.ProveedorDatos(IDEmpresa)); } ConsultasGenerales consultaInformacionComplementaria = new ConsultasGeneralesCreator().FactoryMethod(this.IDEmpresa, this.FuenteDatos); try { if (GReader == null) { List <DbParameter> listParams = new List <DbParameter>(); DbCommand cmd = datos.Connection.CreateCommand(); DbParameter IdCliente = cmd.CreateParameter(); IdCliente.DbType = DbType.Int32; IdCliente.ParameterName = "@Cliente"; IdCliente.Value = this.IDDireccionEntrega; listParams.Add(IdCliente); DbParameter pFecha = cmd.CreateParameter(); pFecha.DbType = DbType.DateTime; pFecha.ParameterName = "@Fecha"; pFecha.Value = this.FechaConsulta.HasValue ? this.FechaConsulta : DateTime.Now.Date; listParams.Add(pFecha); reader = datos.Data.LoadData("spSCConsultaCliente", CommandType.StoredProcedure, listParams.ToArray()); } if (controladorDatosLocal) { while (reader.Read()) { this.ConsultarDatosCliente(reader); //consultaInformacionComplementaria.ConsultarInformacionComplementaria(this.IDEmpresa, this, reader); } this.Success = true; } else { this.ConsultarDatosCliente(reader); consultaInformacionComplementaria.ConsultarInformacionComplementaria(this.IDEmpresa, this, reader); this.Success = true; } } catch (Exception ex) { this.Success = false; this.Message = "Ocurrió un error:" + ex.Message; this.internalException = ex; } finally { if (controladorDatosLocal) { datos.Data.CloseConnection(); } } return(this.Success); }