protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CargaTipoBC ct = new CargaTipoBC(); ShorteckBC sh = new ShorteckBC(); YMS_ZONA_BC yms = new YMS_ZONA_BC(); DataTable ds = yms.ObteneSites(((UsuarioBC)Session["Usuario"]).ID); utils.CargaDropNormal(this.DDL_SITE, "ID", "NOMBRE", ds); TrailerEstadoBC estadobc = new TrailerEstadoBC(); CaractCargaBC car = new CaractCargaBC(); utils.CargaDropTodos(DDL_disponibilidad, "ID", "NOMBRE", estadobc.ObtenerTodosSTOCK()); utils.CargaDropTodos(this.ddl_capacidad, "ID", "DESCRIPCION", car.obtenerXTipo(0)); utils.CargaDropTodos(this.ddl_tipocarga, "ID", "DESCRIPCION", ct.obtenerTodo()); utils.CargaDropTodos(this.ddl_shortec, "SHOR_ID", "SHOR_DESC", sh.ObtenerTodos()); } }
protected void btn_buscar_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); try { dt = new TrailerBC().ObtenerSalidaXViaje(txt_nroViaje.Text); } catch (Exception EX) { utils.ShowMessage(this, EX.Message, "error", false); btn_limpiar_Click(null, null); return; } if (dt.Rows.Count == 0) { btn_limpiar_Click(null, null); utils.ShowMessage2(this, "buscarViaje", "warn_noEncontrado"); return; } DataRow dr = dt.Rows[0]; TrailerBC trailer = new TrailerBC().obtenerXPlaca(dr["TRAILER"].ToString()); if (trailer.ID == 0) { utils.ShowMessage2(this, "buscarViaje", "warn_trailerNoExiste"); btn_limpiar_Click(null, null); return; } if (!trailer.SITE_IN) { utils.ShowMessage2(this, "buscarViaje", "warn_trailerFuera"); btn_limpiar_Click(null, null); return; } if (trailer.SITE_ID != Convert.ToInt32(dropsite.SelectedValue)) { utils.ShowMessage2(this, "buscarViaje", "warn_trailerOtroSite"); btn_limpiar_Click(null, null); return; } ConductorBC conductor = new ConductorBC().ObtenerXRutSAP(dr["RUT_CONDUCTOR"].ToString()); if (conductor.ID != 0) { hf_idCond.Value = conductor.ID.ToString(); txt_conductorRut.Text = utils.rutANumero(conductor.RUT); txt_conductorNombre.Text = conductor.NOMBRE; chk_conductorExtranjero.Checked = conductor.COND_EXTRANJERO; } else { hf_idCond.Value = ""; txt_conductorRut.Text = dr["RUT_CONDUCTOR"].ToString(); txt_conductorNombre.Text = dr["NOMBRE_CONDUCTOR"].ToString(); chk_conductorExtranjero.Checked = !new FuncionesGenerales().ValidaRut(txt_conductorRut.Text); txt_rutChofer_TextChanged(null, null); } TrailerEstadoBC estado = new TrailerEstadoBC().ObtenerXId(trailer.TRES_ID); LugarBC lugar = new LugarBC().obtenerXID(trailer.LUGAR_ID); hf_idTrailer.Value = trailer.ID.ToString(); lblPlacaTrailer.Text = trailer.PLACA; lblFlotaTrailer.Text = trailer.NUMERO; lbl_trailerTransportista.Text = trailer.TRANSPORTISTA; lbl_trailerTipo.Text = trailer.TIPO; lbl_trailerEstado.Text = estado.DESCRIPCION; dv_contenido.Attributes.Add("style", "display:block"); lbl_trailerUbicacion.Text = lugar.DESCRIPCION; txt_patenteTracto.Text = dr["TRACTO"].ToString(); estado_yms.Value = ""; if (trailer.TRES_ID == 400) { ObtenerLocales(); } else { gilllocal.DataSource = null; gilllocal.DataBind(); dv_locales.Style.Add("display", "none"); dv_destino.Style.Add("display", "block"); } try { lblTemperatura.Text = dr["TEM"].ToString(); lbl_trailerGPS.Text = dr["ESTADO_TRAILER"].ToString(); lblauditoria.Text = dr["AU"].ToString(); lbl_trailerFechaDatos.Text = dr["FH_TRAILER"].ToString(); lbl_tractoFecha.Text = dr["FH_TRACTO"].ToString(); txt_tractoGps.Text = dr["ESTADO_TRACTO"].ToString(); lbl_tractoTransportista.Text = dr["TRANSPORTE"].ToString(); } catch { lblTemperatura.Text = ""; lbl_trailerGPS.Text = ""; lblauditoria.Text = ""; lbl_trailerFechaDatos.Text = ""; lbl_tractoFecha.Text = ""; txt_tractoGps.Text = ""; lbl_tractoTransportista.Text = ""; } }