protected void btn_mover_Click(object sender, EventArgs e) { if (this.ddl_bloqLugar.SelectedIndex > 0) { TrailerBC t = new TrailerBC().obtenerXID(int.Parse(this.hf_idTrailer.Value)); MovimientoBC m = new MovimientoBC(); m.ID_DESTINO = int.Parse(this.ddl_bloqLugar.SelectedValue); m.ID_TRAILER = t.ID; string resultado; if (m.MOVIMIENTO(t.SITE_ID, this.usuario.ID, out resultado) && resultado == "") { this.ObtenerTrailer(true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar4", "showAlert('Movimiento Exitoso');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar3", "cerrarModal('modalBloqueo');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", string.Format("alert('{0}');", resultado), true); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Seleccione un lugar de destino');", true); } }
public void btn_confirmar_Click(object sender, EventArgs e) { try { MovimientoBC mov = new MovimientoBC(); //SolicitudBC solicitud = new SolicitudBC(); //TrailerUltEstadoBC traiue = new TrailerUltEstadoBC(); //int id = int.Parse(hf_trailerId.Value); //traiue = traiue.CargaTrue(id); //string fh = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); //solicitud.ID_TIPO = 2; //solicitud.ID_USUARIO = 1; // Variable de sesión //solicitud.FECHA_CREACION = DateTime.Now; //solicitud.FECHA_PLAN_ANDEN = DateTime.Parse(fh); //solicitud.DOCUMENTO = traiue.DOC_INGRESO; //solicitud.OBSERVACION = ""; //solicitud.ID_TRAILER = id; //solicitud.ID_DESTINO = int.Parse(ddl_destinoPos.SelectedValue); //if (solicitud.Descarga(solicitud)) // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Solicitud ingresada correctamente');", true); //else // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ocurrió un error!');", true); if (this.hf_trailerId.Value == "" || this.hf_trailerId.Value == null) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe seleccionar un trailer.');", true); } else { mov.ID_TRAILER = int.Parse(this.hf_trailerId.Value); mov.FECHA_CREACION = DateTime.Now; mov.OBSERVACION = ""; mov.FECHA_ORIGEN = DateTime.Parse(DateTime.Now.ToString()); mov.FECHA_DESTINO = mov.FECHA_ORIGEN.AddMinutes(15); mov.ID_DESTINO = int.Parse(this.ddl_destinoPos.SelectedValue); mov.ID_ESTADO = 10; mov.OBSERVACION = ""; TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC(); trailerUE.ID = int.Parse(this.hf_trailerId.Value); trailerUE.SITE_ID = 1; // Cambiar después de introducir variables de sesión trailerUE.SITE_IN = true; trailerUE.LUGAR_ID = int.Parse(this.ddl_destinoPos.SelectedValue); TrailerBC trailer = new TrailerBC(); mov.MANT_EXTERNO = false; mov.ID_TRAILER = int.Parse(this.hf_trailerId.Value); // trailer.PLACA = this.txt_buscarPatente.Text; // trailer.CODIGO = "S/ CODIGO"; // trailer.NUMERO = this.txt_buscarNro.Text; trailer.ID = mov.ID_TRAILER; UsuarioBC usuario = (UsuarioBC)Session["USUARIO"]; string resultado; bool ejecucion = mov.MOVIMIENTO(mov, trailerUE, trailer, usuario.ID, out resultado); if (ejecucion && resultado == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Se ingresaron correctamente los datos.');", true); ddl_destinoZona.SelectedValue = "0"; ddl_destinoZona_SelectedIndexChanged(null, null); this.pnl_detalleLugar.Attributes.Remove("style"); this.pnl_detalleTrailer.CssClass = ""; this.pnl_detalleTrailer.Attributes.Remove("style"); this.img_reloj.ImageUrl = ""; this.img_trailer.ImageUrl = ""; this.lbl_lugar.Text = ""; this.lbl_origenZona.Text = ""; this.lbl_origenPlaya.Text = ""; } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ocurrió un error!');", true); } }
protected void btn_guardar_Click(object sender, EventArgs e) { TrailerLogiBC t = new TrailerLogiBC(); SolicitudBC s = new SolicitudBC(); int soli_id = Convert.ToInt32(hf_idSolicitud.Value); int luga_trailer = 0; int soan_orden = 0; try { luga_trailer = Convert.ToInt32(hf_lugaid.Value); soan_orden = Convert.ToInt32(hf_soanorden.Value); } catch (Exception) { } int luga_id = 0; int site_id = 0; try { luga_id = Convert.ToInt32(ddl_posicion.SelectedValue); site_id = Convert.ToInt32(dropsite.SelectedValue); } catch (Exception) { } string mensaje = ""; bool error = true; switch (hf_accion.Value) { case "DEF_PALLETS": case "DEF_DESECHOS": if (luga_id != 0) { error = CrearSolicitud(luga_id, "", out mensaje); } else { utils.ShowMessage(this, "Complete todos los datos", "warn", true); return; } break; case "DEF_DESCARGA_LI": if (luga_id != 0) { s = new SolicitudBC(); s.ID_SITE = site_id; s.ID_USUARIO = usuario.ID; s.DOCUMENTO = txt_doc.Text; s.OBSERVACION = txt_obs.Text; s.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); error = t.DescargaLI_Crear(s, luga_id, out mensaje); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha creado la solicitud."; } } else { utils.ShowMessage(this, "Complete todos los datos", "warn", true); return; } break; case "DEF_MOVER": MovimientoBC mov = new MovimientoBC(); mov.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); mov.OBSERVACION = ""; mov.ID_DESTINO = Convert.ToInt32(ddl_posicion.SelectedValue); mov.OBSERVACION = txt_obs.Text; mov.petroleo = null; error = mov.MOVIMIENTO(mov, site_id, usuario.ID, out mensaje); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha generado el movimiento"; } break; case "DESCARGA_EDITA": break; case "DESCARGA_POSICION_LI": break; case "DESCARGA_COMPLETA_LI": error = t.DescargaLI_Completar(soli_id, luga_trailer, soan_orden, usuario.ID, out mensaje); if (string.IsNullOrEmpty(mensaje)) { string error_out; mensaje = "Se ha completado la solicitud."; error = CrearSolicitud(luga_id, mensaje, out error_out); mensaje = error_out; } break; case "DESECHOS_COMPLETAR": error = t.Desechos_Completar(soli_id, luga_trailer, soan_orden, usuario.ID, out mensaje); if (string.IsNullOrEmpty(mensaje) && !rb_Nada.Checked) { mensaje = "Se ha completado la solicitud. "; string error_out; error = CrearSolicitud(luga_id, mensaje, out error_out); mensaje = error_out; } break; case "PALLETS_COMPLETAR": error = t.PALLETS_Completar(soli_id, luga_trailer, soan_orden, usuario.ID, out mensaje); if (string.IsNullOrEmpty(mensaje) && !rb_Nada.Checked) { mensaje = "Se ha completado la solicitud. "; string error_out; error = CrearSolicitud(luga_id, mensaje, out error_out); mensaje = error_out; } break; case "PALLETS_TRASLADO_ANDEN": error = t.Pallets_Reiniciar(soli_id, luga_trailer, luga_id, usuario.ID, soan_orden, soan_orden + 1, out mensaje); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha generado el movimiento"; } break; case "PALLETS_TRASLADO_EST": error = t.Pallets_TrasladoEst(soli_id, luga_trailer, luga_id, soan_orden, usuario.ID, out mensaje); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha generado el movimiento"; } break; case "PALLETS_REINICIAR": error = t.Pallets_Reiniciar(soli_id, luga_trailer, luga_id, usuario.ID, 0, soan_orden + 1, out mensaje); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha reanudado la descarga"; } break; case "DEF_DESCARGA": case "DESCARGA_COMPLETA": error = s.DescargaCompleta(soli_id, out mensaje, usuario.ID, luga_id); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha completado la descarga"; } break; case "DESCARGA_POSICION": s = new SolicitudBC(); s.SOLI_ID = Convert.ToInt32(hf_idSolicitud.Value); s.OBSERVACION = ""; s.ID_DESTINO = luga_id; s.TIMESTAMP = Convert.ToDateTime(hf_timestamp.Value); if (s.validarTimeStamp()) { error = s.ModificarDescarga(s); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha modificado la solicitud"; } else { mensaje = "Error"; } } else { mensaje = "No se pudo validar timestamp."; } break; case "DESCARGA_MOVER": MovimientoBC m = new MovimientoBC(); s = new SolicitudBC(); m.ID_DESTINO = luga_id; m.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); m.ID_SOLICITUD = soli_id; m.OBSERVACION = ""; error = s.DescargaMovimiento(m, site_id, usuario.ID, out mensaje); if (string.IsNullOrEmpty(mensaje)) { mensaje = "Se ha generado el movimiento"; } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrarmodal", "cerrarModal('modalLogistica');", true); break; } if (error) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", string.Format("showAlert('{0}');", mensaje), true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalLogistica');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", string.Format("showAlert4('{0}');", mensaje), true); } ObtenerTrailer(true); }
private bool CrearSolicitud(int luga_id, string error_in, out string error_out) { bool error = true; error_out = error_in; int soli_id = Convert.ToInt32(hf_idSolicitud.Value); SolicitudBC s = new SolicitudBC(); TrailerLogiBC t = new TrailerLogiBC(); s.ID_SITE = Convert.ToInt32(dropsite.SelectedValue); s.SOLI_ID = soli_id; s.ID_USUARIO = usuario.ID; s.DOCUMENTO = txt_doc.Text; s.OBSERVACION = txt_obs.Text; s.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); if (rb_Desechos.Checked) { error = t.Desechos_Crear(s, luga_id, out error_in); if (string.IsNullOrEmpty(error_in)) { error_out += "Se ha creado la solicitud"; } else { error_out += error_in; } } if (rb_Pallets.Checked) { error = t.Pallets_Crear(s, luga_id, out error_in); if (string.IsNullOrEmpty(error_in)) { error_out += "Se ha creado la solicitud"; } else { error_out += error_in; } } if (rb_estacionamiento.Checked) { MovimientoBC mov = new MovimientoBC(); mov.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); mov.OBSERVACION = ""; mov.ID_DESTINO = 0; mov.OBSERVACION = txt_obs.Text; mov.petroleo = null; error = mov.MOVIMIENTO_automatico_estacinamiento(mov, Convert.ToInt32(dropsite.SelectedValue), usuario.ID, out error_in); if (string.IsNullOrEmpty(error_in)) { error_out += "Trailer al estacionamiento"; } else { error_out += error_in; } } if (rb_estacionamientoMan.Checked) { MovimientoBC mov = new MovimientoBC(); mov.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); mov.OBSERVACION = ""; mov.ID_DESTINO = luga_id; mov.OBSERVACION = txt_obs.Text; mov.petroleo = null; error = mov.MOVIMIENTO(mov, Convert.ToInt32(dropsite.SelectedValue), usuario.ID, out error_in); if (string.IsNullOrEmpty(error_in)) { error_out += "Trailer al estacionamiento"; } else { error_out += error_in; } } if (rb_descargar.Checked) { s = new SolicitudBC(); s.ID_SITE = Convert.ToInt32(dropsite.SelectedValue); s.ID_USUARIO = usuario.ID; s.DOCUMENTO = txt_doc.Text; s.OBSERVACION = txt_obs.Text; s.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); error = t.DescargaLI_Crear(s, luga_id, out error_in); if (string.IsNullOrEmpty(error_in)) { error_out = "Se ha creado la solicitud."; } else { error_out += error_in; } } return(error); }
protected void btn_confirmar_Click(object sender, EventArgs e) { MovimientoBC mov = new MovimientoBC(); if (this.hf_idTrailer.Value == "" || this.hf_idTrailer.Value == null) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe seleccionar un trailer.');", true); } else { mov.ID_TRAILER = int.Parse(this.hf_idTrailer.Value); mov.FECHA_CREACION = DateTime.Now; mov.OBSERVACION = ""; mov.FECHA_ORIGEN = DateTime.Parse(this.txt_fechaMovimiento.Text); mov.FECHA_DESTINO = mov.FECHA_ORIGEN.AddMinutes(15); mov.ID_DESTINO = int.Parse(this.ddl_destinoPos.SelectedValue); mov.ID_ESTADO = 10; mov.OBSERVACION = this.txt_refOp.Text; mov.petroleo = petroleo.Checked.ToString(); TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC(); trailerUE.ID = int.Parse(this.hf_idTrailer.Value); trailerUE.SITE_ID = int.Parse(this.dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión trailerUE.SITE_IN = true; trailerUE.LUGAR_ID = int.Parse(this.ddl_destinoPos.SelectedValue); TrailerBC trailer = new TrailerBC(); mov.MANT_EXTERNO = false; mov.ID_TRAILER = int.Parse(this.hf_idTrailer.Value); // trailer = trailer.obtenerXID(int.Parse(this.hf_idTrailer.Value)); trailer.PLACA = this.txt_buscarPatente.Text; trailer.CODIGO = "S/ CODIGO"; if (this.rb_trailerExterno.Checked) { trailer.EXTERNO = true; } else { trailer.EXTERNO = false; } trailer.NUMERO = this.txt_buscarNro.Text; trailer.ID = int.Parse(this.ddl_transportista.SelectedValue); UsuarioBC usuario = (UsuarioBC)Session["USUARIO"]; string resultado; bool ejecucion = mov.MOVIMIENTO(mov, trailerUE, trailer, usuario.ID, out resultado); if (resultado == "" && ejecucion) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Se ingresaron correctamente los datos.');", true); limpiar(); ddl_destinoZona.SelectedValue = "0"; ddl_destinoZona_SelectedIndexChanged(null, null); this.pnl_detalleLugar.Attributes.Remove("style"); this.pnl_detalleTrailer.CssClass = ""; this.pnl_detalleTrailer.Attributes.Remove("style"); //this.img_reloj.ImageUrl = ""; this.img_trailer.ImageUrl = ""; this.lbl_lugar.Text = ""; this.lbl_origenZona.Text = ""; this.lbl_origenPlaya.Text = ""; } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + resultado + "');", true); } } }