protected void btn_mover_Click(object sender, EventArgs e) { MovimientoBC m = new MovimientoBC(); SolicitudBC s = new SolicitudBC(); s = s.ObtenerXId(int.Parse(this.hf_idSolicitud.Value)); string resultado; m.ID_DESTINO = int.Parse(this.ddl_editPos.SelectedValue); m.ID_TRAILER = s.ID_TRAILER; m.ID_SOLICITUD = s.SOLI_ID; m.OBSERVACION = ""; bool ejecucion = s.DescargaMovimiento(m, s.ID_SITE, this.u.ID, out resultado); if (resultado == "" && ejecucion) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Se generó movimiento correctamente.');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrarModal", "$('#modalPosicion').modal('hide');", true); this.ObtenerSolicitudes(true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), 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); }