public ResponseConsultarTransportista ConsultarTransportista(RequestConsultarTransportista request) { ResponseConsultarTransportista response = new ResponseConsultarTransportista(); TransportistaBL tbl = new TransportistaBL(); response = tbl.ConsultarTransportista(request); return(response); }
public ResponseConsultarTransportista ConsultarTransportista(RequestConsultarTransportista request) { ResponseConsultarTransportista response = new ResponseConsultarTransportista(); TransportistaDA da = new TransportistaDA(); response = da.ConsultarTransportista(request); return(response); }
public ResponseConsultarTransportista ConsultarTransportista(RequestConsultarTransportista request) { ResponseConsultarTransportista response = new ResponseConsultarTransportista(); List <Transportista> TransportistaList = new List <Transportista>(); SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cnxANTP"].ToString()); try { SqlCommand com = new SqlCommand("USP_CONSULTAR_TRANSPORTISTA", con); com.CommandType = CommandType.StoredProcedure; com.Parameters.Add("@RUC", SqlDbType.VarChar, 11).Value = request.Ruc; //com.CommandTimeout = 30000; con.Open(); SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { Transportista tp = new Transportista(); tp.Ruc = dr.IsDBNull(dr.GetOrdinal("Ruc")) ? "" : dr.GetString(dr.GetOrdinal("Ruc")); tp.RazonSocial = dr.IsDBNull(dr.GetOrdinal("RazonSocial")) ? "" : dr.GetString(dr.GetOrdinal("RazonSocial")); tp.Email = dr.IsDBNull(dr.GetOrdinal("Email")) ? "" : dr.GetString(dr.GetOrdinal("Email")); tp.Telefono1 = dr.IsDBNull(dr.GetOrdinal("Telefono1")) ? "" : dr.GetString(dr.GetOrdinal("Telefono1")); tp.Telefono2 = dr.IsDBNull(dr.GetOrdinal("Telefono2")) ? "" : dr.GetString(dr.GetOrdinal("Telefono2")); tp.Telefono3 = dr.IsDBNull(dr.GetOrdinal("Telefono3")) ? "" : dr.GetString(dr.GetOrdinal("Telefono3")); tp.Vigencia = dr.IsDBNull(dr.GetOrdinal("Vigencia")) ? default(DateTime) : dr.GetDateTime(dr.GetOrdinal("Vigencia")); tp.Estado = dr.IsDBNull(dr.GetOrdinal("Estado")) ? true : dr.GetBoolean(dr.GetOrdinal("Estado")); TransportistaList.Add(tp); } response.TransportistaList = TransportistaList; } catch (Exception ex) { response.TransportistaList = null; } finally { con.Close(); } return(response); }