protected void btn_limpiar_Click(object sender, EventArgs e) { dv_contenido.Attributes.Add("style", "display:none"); //txt_nroViaje.Text = ""; txt_Patente.Text = ""; txt_NroFlota.Text = ""; hf_idTrailer.Value = ""; lblPlacaTrailer.Text = ""; lblFlotaTrailer.Text = ""; lblFechaDatos.Text = ""; lblFechaDatos2.Text = ""; lblEstado.Text = ""; lblTransportista.Text = ""; lblTipo.Text = ""; lblauditoria.Text = ""; lblEstadoSol.Text = ""; lblTemperatura.Text = ""; lblUbicacion.Text = ""; txt_patenteTracto.Text = ""; txt_conductorRut.Text = ""; txt_conductorNombre.Text = ""; hf_idCond.Value = ""; dv_locales.Visible = false; dv_destino.Visible = false; gilllocal.DataSource = null; gilllocal.DataBind(); Gridviajes.DataSource = null; Gridviajes.DataBind(); txt_gpsActivoTracto.Text = ""; }
protected void btn_limpiar_Click(object sender, EventArgs e) { dv_contenido.Attributes.Add("style", "display:none"); txt_Patente.Text = ""; hf_idTrailer.Value = ""; lblPlacaTrailer.Text = ""; lblFlotaTrailer.Text = ""; lblFechaDatos.Text = ""; lblFechaDatos2.Text = ""; //lblFechaDatos3.Text = dt.Rows[0]["FECHA_MODIFICACION"].ToString(); lblEstado.Text = ""; lblTransportista.Text = ""; lblTipo.Text = ""; lblauditoria.Text = ""; lblEstadoSol.Text = ""; lblTemperatura.Text = ""; lblUbicacion.Text = ""; txt_patenteTracto.Text = ""; // txt_rutChofer.Text = utils.rutANumero(dt.Rows[0]["TRUE_CHOFER_RUT"].ToString()); // txt_nombreChofer.Text = dt.Rows[0]["TRUE_CHOFER_NOMBRE"].ToString(); txt_conductorRut.Text = ""; txt_conductorNombre.Text = ""; hf_idCond.Value = ""; dv_locales.Visible = false; dv_destino.Visible = false; gilllocal.DataSource = null; gilllocal.DataBind(); Gridviajes.DataSource = null; Gridviajes.DataBind(); datosViaje(null); txt_gpsActivoTracto.Text = ""; }
protected void btn_limpiar_Click(object sender, EventArgs e) { hf_idTrailer.Value = ""; hf_idCond.Value = ""; dv_contenido.Style.Add("display", "none"); dv_locales.Style.Add("display", "none"); dv_destino.Style.Add("display", "none"); lblPlacaTrailer.Text = ""; lblFlotaTrailer.Text = ""; lbl_trailerFechaDatos.Text = ""; lbl_tractoFecha.Text = ""; lbl_trailerEstado.Text = ""; lbl_trailerTransportista.Text = ""; lbl_trailerTipo.Text = ""; lblauditoria.Text = ""; lblTemperatura.Text = ""; lbl_trailerUbicacion.Text = ""; txt_nroViaje.Text = ""; txt_patenteTracto.Text = ""; txt_conductorRut.Text = ""; txt_conductorNombre.Text = ""; gilllocal.DataSource = null; gilllocal.DataBind(); datosViaje(null); txt_tractoGps.Text = ""; dv_contenido.Style.Add("display", "none"); Gridviajes.DataSource = null; Gridviajes.DataBind(); }
protected void btn_buscar_Click(object sender, EventArgs e) { TrailerBC trailer = new TrailerBC(); if (txt_nroViaje.Text != "") { trailer = trailer.obtenerXviaje(txt_nroViaje.Text); } else if (txt_NroFlota.Text != "") { trailer = trailer.obtenerXNro(txt_NroFlota.Text); } else if (utils.patentevalida(txt_Patente.Text) == true) { trailer = trailer.obtenerXPlaca(txt_Patente.Text); } else { btn_limpiar_Click(null, null); utils.ShowMessage2(this, "trailer", "warn_placaInvalida"); } if (trailer.ID == 0) { btn_limpiar_Click(null, null); utils.ShowMessage2(this, "trailer", "warn_noExiste"); return; } DataSet datos = trailer.obtenerDatosSalida(trailer.PLACA, trailer.NUMERO); if (datos.Tables.Count == 0) { btn_limpiar_Click(null, null); utils.ShowMessage2(this, "trailer", "warn_noExiste"); return; } DataTable dt = datos.Tables[0]; string site = dt.Rows[0]["SITE_ID"].ToString(); if (!Convert.ToBoolean(dt.Rows[0]["TRUE_SITE_IN"])) { utils.ShowMessage2(this, "trailer", "warn_fueraSite"); btn_limpiar_Click(null, null); return; } if (site != dropsite.SelectedValue || string.IsNullOrEmpty(site)) { utils.ShowMessage2(this, "trailer", "warn_otroSite"); btn_limpiar_Click(null, null); return; } hf_idTrailer.Value = dt.Rows[0]["TRAI_ID"].ToString(); hf_idTran.Value = dt.Rows[0]["TRAN_ID"].ToString(); hf_trueCodInterno.Value = dt.Rows[0]["TRUE_COD_INTERNO_IN"].ToString(); lblPlacaTrailer.Text = dt.Rows[0]["PLACA"].ToString(); lblFlotaTrailer.Text = dt.Rows[0]["FLOTA"].ToString(); lblFechaDatos.Text = dt.Rows[0]["FECHA_MODIFICACION"].ToString(); lblFechaDatos2.Text = dt.Rows[0]["FECHA_MODIFICACION"].ToString(); lblEstado.Text = dt.Rows[0]["TRAILER_ESTADO"].ToString(); lblTransportista.Text = dt.Rows[0]["TRANSPORTISTA"].ToString(); lblTipo.Text = dt.Rows[0]["TIPO_TRAILER"].ToString(); lblauditoria.Text = "En Construcción"; lblEstadoSol.Text = dt.Rows[0]["ESTADO_SOL"].ToString(); dv_contenido.Attributes.Add("style", "display:block"); lblUbicacion.Text = dt.Rows[0]["UBICACION"].ToString(); txt_obs.Text = dt.Rows[0]["TRUE_OBS"].ToString(); txt_patenteTracto.Text = dt.Rows[0]["PATENTE_TRACTO"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["COND_ID"].ToString())) { int cond_id = Convert.ToInt32(dt.Rows[0]["COND_ID"].ToString()); ConductorBC c = new ConductorBC(cond_id); txt_conductorRut.Text = utils.rutANumero(c.RUT); txt_conductorNombre.Text = c.NOMBRE; chk_conductorExtranjero.Checked = c.COND_EXTRANJERO; hf_idCond.Value = cond_id.ToString(); } string estado = dt.Rows[0]["TRES_ID"].ToString().ToLower(); estado_yms.Value = ""; if (site == "10") { try { DataTable dt3 = datos.Tables[4]; if (dt3.Rows[0]["Cargado"].ToString() == "NO" && txt_nroViaje.Text == "") { lblEstado.Text = "VACIO"; estado = "100"; estado_yms.Value = "1"; } else { lblEstado.Text = "CARGADO"; estado = "400"; estado_yms.Value = "0"; } } catch (Exception ex) { estado = dt.Rows[0]["TRES_ID"].ToString().ToLower(); } } locales_YMS.Value = ""; if (estado == "400") { ObtenerLocales(); } else { gilllocal.DataSource = null; gilllocal.DataBind(); dv_locales.Visible = false; dv_destino.Visible = true; } try { DataTable dtviaje = datos.Tables[2]; Gridviajes.DataSource = dtviaje; Gridviajes.DataBind(); } catch (Exception) { } try { DataTable dttracto = datos.Tables[3]; txt_gpsActivoTracto.Text = dttracto.Rows[0]["STATUS"].ToString(); lbl_tran.Text = dttracto.Rows[0]["TRANSPORTE"].ToString(); } catch (Exception ex) { } try { DataTable dttrailerGPS = datos.Tables[1]; lblTemperatura.Text = dttrailerGPS.Rows[0]["TEMPERATURA"].ToString(); lblGPS.Text = dttrailerGPS.Rows[0]["STATUS"].ToString(); lblauditoria.Text = dttrailerGPS.Rows[0]["AU"].ToString(); lblFechaDatos2.Text = dttrailerGPS.Rows[0]["fh_dato"].ToString(); } catch (Exception) { } }
protected void btn_buscar_Click(object sender, EventArgs e) { TrailerBC trailer = new TrailerBC(); trailer = (!string.IsNullOrEmpty(txt_NroFlota.Text)) ? trailer.obtenerXNro(txt_NroFlota.Text) : trailer.obtenerXPlaca(txt_Patente.Text); if (trailer.ID == 0) { utils.ShowMessage2(this, "trailer", "warn_noExiste"); btn_limpiar_Click(null, null); return; } DataSet datos = trailer.obtenerDatosSalida(trailer.PLACA, trailer.NUMERO); DataTable dt; if (datos.Tables.Count > 0) { dt = datos.Tables[0]; string site = dt.Rows[0]["SITE_ID"].ToString(); if (!Convert.ToBoolean(dt.Rows[0]["TRUE_SITE_IN"])) { utils.ShowMessage2(this, "trailer", "warn_fueraSite"); btn_limpiar_Click(null, null); return; } if (site != dropsite.SelectedValue || string.IsNullOrEmpty(site)) { utils.ShowMessage2(this, "trailer", "warn_otroSite"); btn_limpiar_Click(null, null); return; } hf_idTrailer.Value = dt.Rows[0]["TRAI_ID"].ToString(); hf_idTran.Value = dt.Rows[0]["TRAN_ID"].ToString(); lblPlacaTrailer.Text = dt.Rows[0]["PLACA"].ToString(); lblFlotaTrailer.Text = dt.Rows[0]["FLOTA"].ToString(); lblFechaDatos.Text = dt.Rows[0]["FECHA_MODIFICACION"].ToString(); lblFechaDatos2.Text = dt.Rows[0]["FECHA_MODIFICACION"].ToString(); lblEstado.Text = dt.Rows[0]["TRAILER_ESTADO"].ToString(); lblTransportista.Text = dt.Rows[0]["TRANSPORTISTA"].ToString(); lblTipo.Text = dt.Rows[0]["TIPO_TRAILER"].ToString(); lblauditoria.Text = "En Construcción"; lblEstadoSol.Text = dt.Rows[0]["ESTADO_SOL"].ToString(); dv_contenido.Attributes.Add("style", "display:block"); lblUbicacion.Text = dt.Rows[0]["UBICACION"].ToString(); txt_patenteTracto.Text = dt.Rows[0]["PATENTE_TRACTO"].ToString(); if (dt.Rows[0]["COND_ID"] != DBNull.Value) { int cond_id = Convert.ToInt32(dt.Rows[0]["COND_ID"]); ConductorBC c = new ConductorBC(cond_id); txt_conductorRut.Text = utils.rutANumero(c.RUT); txt_conductorNombre.Text = c.NOMBRE; chk_conductorExtranjero.Checked = c.COND_EXTRANJERO; hf_idCond.Value = cond_id.ToString(); } string estado = dt.Rows[0]["TRES_ID"].ToString(); estado_yms.Value = ""; if (site == "10") { try { if (datos.Tables[4].Rows[0]["Cargado"].ToString() == "NO") { lblEstado.Text = "VACIO"; estado = "100"; estado_yms.Value = "1"; } else { lblEstado.Text = "CARGADO"; estado = "400"; estado_yms.Value = "0"; } } catch { estado = dt.Rows[0]["TRES_ID"].ToString(); } } locales_YMS.Value = ""; if (estado != "400") { gilllocal.DataSource = null; gilllocal.DataBind(); dv_locales.Visible = false; dv_destino.Visible = true; } else { try { DataTable dtlocales = new SolicitudLocalesBC().CargaLocalesXSolicitudTrailer(Convert.ToInt32(hf_idTrailer.Value), "", Convert.ToInt32(this.dropsite.SelectedValue)); string output = ""; foreach (DataRow dr in dtlocales.Rows) { if (!string.IsNullOrEmpty(output)) { output += ","; } output += dr["LOCA_COD"].ToString(); } locales_YMS.Value = output; gilllocal.DataSource = dtlocales; gilllocal.DataBind(); } catch { gilllocal.DataSource = null; gilllocal.DataBind(); } dv_locales.Visible = true; dv_destino.Visible = false; } try { Gridviajes.DataSource = datos.Tables[2]; Gridviajes.DataBind(); } catch { Gridviajes.DataSource = null; Gridviajes.DataBind(); } try { DataRow dr = datos.Tables[3].Rows[0]; txt_gpsActivoTracto.Text = dr["STATUS"].ToString(); lbl_tran.Text = dr["TRANSPORTE"].ToString(); } catch { txt_gpsActivoTracto.Text = ""; lbl_tran.Text = ""; } try { DataRow dr = datos.Tables[1].Rows[0]; lblTemperatura.Text = dr["TEMPERATURA"].ToString(); lblGPS.Text = dr["STATUS"].ToString(); lblauditoria.Text = dr["AU"].ToString(); lblFechaDatos2.Text = dr["fh_dato"].ToString(); } catch (Exception) { lblTemperatura.Text = ""; lblGPS.Text = ""; lblauditoria.Text = ""; lblFechaDatos2.Text = ""; } } }
private void datosViaje(DataTable dt) { Gridviajes.DataSource = dt; Gridviajes.DataBind(); }