private void ObtenerTrailer(bool forzarBD) { if (ViewState["lista"] == null || forzarBD) { TrailerLogiBC trailer = new TrailerLogiBC(); int play_id = Convert.ToInt32(this.ddl_buscarPlaya.SelectedValue); DataTable dt = trailer.obtenerXParametroDesc(this.txt_buscarNombre.Text, this.txt_buscarNro.Text, this.chk_buscarInterno.Checked, Convert.ToInt32(ddl_buscarTipo.SelectedValue), Convert.ToInt32(ddl_buscarTransportista.SelectedValue), Convert.ToInt32(dropsite.SelectedValue), play_id); ViewState["lista"] = dt; ViewState.Remove("filtrados"); } DataView dw = new DataView((DataTable)ViewState["lista"]); if (ViewState["filtrados"] == null) { dw = new DataView((DataTable)ViewState["lista"]); } else { dw = new DataView((DataTable)ViewState["filtrados"]); } if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)ViewState["sortExpresion"]; } gv_listar.DataSource = dw; gv_listar.DataBind(); }
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); }