private void ObtenerLocales() { try { SolicitudLocalesBC s = new SolicitudLocalesBC(); DataTable dtlocales = s.CargaLocalesXSolicitudTrailer(Convert.ToInt32(hf_idTrailer.Value), txt_nroViaje.Text, Convert.ToInt32(this.dropsite.SelectedValue)); string output = ""; for (int i = 0; i < dtlocales.Rows.Count; i++) { output = output + dtlocales.Rows[i]["LOCA_COD"].ToString(); output += (i < dtlocales.Rows.Count) ? "," : string.Empty; } locales_YMS.Value = output; DataColumn[] key = new DataColumn[1]; key[0] = dtlocales.Columns["LOCA_COD"]; dtlocales.PrimaryKey = key; dtlocales.Columns.Add("SELLO", Type.GetType("System.String")); dtlocales.Columns.Add("SOBRE", Type.GetType("System.String")); dtlocales.Columns.Add("CARRO", Type.GetType("System.String")); dtlocales.Columns.Add("EMBARQUE", Type.GetType("System.String")); ViewState["locales"] = dtlocales; gilllocal.DataSource = dtlocales; gilllocal.DataBind(); } catch (Exception ex) { } dv_locales.Visible = true; dv_destino.Visible = false; }
private void ObtenerLocales() { try { SolicitudLocalesBC s = new SolicitudLocalesBC(); DataTable dtlocales = s.CargaLocalesXSolicitudTrailer(Convert.ToInt32(hf_idTrailer.Value), this.txt_nroViaje.Text, Convert.ToInt32(this.dropsite.SelectedValue)); string output = ""; for (int i = 0; i < dtlocales.Rows.Count; i++) { output = output + dtlocales.Rows[i]["LOCA_COD"].ToString(); output += (i < dtlocales.Rows.Count) ? "," : string.Empty; } locales_YMS.Value = output; DataColumn[] key = new DataColumn[4]; key[0] = dtlocales.Columns["SOLI_ID"]; key[1] = dtlocales.Columns["LUGA_ID"]; key[2] = dtlocales.Columns["SOAN_ORDEN"]; key[3] = dtlocales.Columns["LOCA_ID"]; dtlocales.PrimaryKey = key; dtlocales.Columns.Add("SOLD_SELLO", Type.GetType("System.String")); ViewState["locales"] = dtlocales; gilllocal.DataSource = dtlocales; gilllocal.DataBind(); } catch (Exception ex) { } dv_locales.Style.Add("display", "block"); dv_destino.Style.Add("display", "none"); }
protected void btn_confirmar_Click(object sender, EventArgs e) { SolicitudLocalesBC s = new SolicitudLocalesBC(); s.SOLI_ID = int.Parse(hf_idSolicitud.Value); s.LOCA_ID = int.Parse(hf_idLocal.Value); s.SOAN_ORDEN = int.Parse(hf_orden.Value); s.LUGA_ID = int.Parse(hf_idLugar.Value); if (s.Eliminar()) { SolicitudBC sol = new SolicitudBC(); Ordenar(sol.ObtenerAndenesXSolicitudId(s.SOLI_ID), true); gv_solLocales.DataSource = ViewState["datosA"]; gv_solLocales.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Registro eliminado!');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalConfirmar');", true); } }
protected void btn_reanudar_Click(object sender, EventArgs e) { if (hf_ordenAndenesOk.Value.ToLower() == "true") { SolicitudAndenesBC sa = new SolicitudAndenesBC(); SolicitudBC s = new SolicitudBC(); bool exito = false; s.SOLI_ID = int.Parse(hf_idSolicitud.Value); s.TIMESTAMP = DateTime.Parse(hf_timeStamp.Value); if (!s.validarTimeStamp()) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Timestamp incorrecto.');", true); exito = false; } else { sa.SOLI_ID = s.SOLI_ID; bool registros = false; DataView dw = new DataView((DataTable)ViewState["datosA"]); dw.RowFilter = "SOES_ID = -1"; DataTable dt = dw.ToTable(true, "SOAN_ORDEN", "ID_ANDEN"); DataTable dt2 = dw.ToTable(); exito = true; DataView dw2 = new DataView((DataTable)ViewState["datosA"]); dw2.RowFilter = "SOES_ID = -1 or SOES_ID = 100"; DataTable dt4 = dw2.ToTable(); registros = (dt4.Rows.Count > 0); // exito = registros; foreach (DataRow row in dt.Rows) { exito = true; registros = true; sa.MINS_CARGA_EST = 60; //Variable calculada automáticamente sa.LUGA_ID = int.Parse(row["ID_ANDEN"].ToString()); sa.SOAN_ORDEN = int.Parse(row["SOAN_ORDEN"].ToString()); if (sa.AgregarAnden()) { exito = true; } else { exito = false; break; } } if (exito) { foreach (DataRow row in dt2.Rows) { SolicitudLocalesBC sl = new SolicitudLocalesBC(); sl.SOLI_ID = s.SOLI_ID; sl.LUGA_ID = int.Parse(row["ID_ANDEN"].ToString()); sl.LOCA_ID = int.Parse(row["ID_LOCAL"].ToString()); sl.PALLETS = int.Parse(row["PALLETS"].ToString()); sl.SOAN_ORDEN = int.Parse(row["SOAN_ORDEN"].ToString()); sl.SOLD_ORDEN = int.Parse(row["ORDEN"].ToString()); if (sl.AgregarLocal(sl)) { exito = true; } else { exito = false; break; } } if (!registros) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Debe agregar al menos un andén de carga para continuar la carga.');", true); } else if (exito) { // int nuevolugar; //if (rb_nuevoSi.Checked) // nuevolugar = 0; //else // nuevolugar = int.Parse(ddl_nuevoAnden.SelectedValue); string resultado; bool ejecucion = sa.ReanudarCarga(sa.SOLI_ID, usuario.ID, out resultado); if (resultado == "" && ejecucion) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Se reanudó la carga correctamente.');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "cerrarModal('modalReanudar');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + resultado + "');", true); } btn_buscarSolicitud_Click(null, null); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Error');", true); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Error');", true); } } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error: Compruebe el órden de los andenes seleccionados.');", true); } }
public bool Eliminar(SolicitudLocalesBC s) { return(tran.SolicitudLocales_Eliminar(s)); }
public bool AgregarLocal(SolicitudLocalesBC local) { return(tran.SolicitudLocales_Crear(local)); }
protected void btn_reanudar_Click(object sender, EventArgs e) { SolicitudAndenesBC sa = new SolicitudAndenesBC(); SolicitudBC s = new SolicitudBC(); bool exito = false; s.SOLI_ID = int.Parse(this.hf_idSolicitud.Value); s.TIMESTAMP = DateTime.Parse(this.hf_timeStamp.Value); if (!s.validarTimeStamp()) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Timestamp incorrecto.');", true); exito = false; } else { sa.SOLI_ID = s.SOLI_ID; bool registros = false; DataTable dt2 = this.ViewState["datosA"] as DataTable; foreach (DataRow row in dt2.Rows) { exito = true; registros = true; if (row["SOES_ID"].ToString() == "100") { registros = true; sa.MINS_CARGA_EST = 60; //Variable calculada automáticamente sa.LUGA_ID = int.Parse(row["ID_ANDEN"].ToString()); int orden; if (sa.AgregarAnden(sa, out orden) && orden > 0) { DataRow[] dtLocales = dt2.Select(string.Format("ID_ANDEN = {0} and orden= {1}", sa.LUGA_ID, orden)); foreach (DataRow rowLocal in dtLocales) { SolicitudLocalesBC sl = new SolicitudLocalesBC(); sl.SOLI_ID = s.SOLI_ID; sl.LUGA_ID = int.Parse(rowLocal["ID_ANDEN"].ToString()); sl.LOCA_ID = int.Parse(rowLocal["ID_LOCAL"].ToString()); sl.PALLETS = int.Parse(rowLocal["PALLETS"].ToString()); sl.SOAN_ORDEN = orden; sl.SOLD_ORDEN = int.Parse(rowLocal["ORDEN"].ToString()); if (sl.AgregarLocal(sl)) { exito = true; } else { exito = false; break; } } } else { exito = false; break; } } } if (!registros) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Debe agregar al menos un andén de carga para continuar la carga.');", true); } else if (exito) { // int nuevolugar; //if (rb_nuevoSi.Checked) // nuevolugar = 0; //else // nuevolugar = int.Parse(ddl_nuevoAnden.SelectedValue); string resultado; bool ejecucion = sa.ReanudarCarga(sa.SOLI_ID, this.usuario.ID, out resultado); if (resultado == "" && ejecucion) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Se reanudó la carga correctamente.');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), true); } this.btn_buscarSolicitud_Click(null, null); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Error');", true); } } }
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 = ""; } } }