protected void btn_confirmar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(hf_idCond.Value)) { ConductorBC c = new ConductorBC(); c.RUT = txt_conductorRut.Text; c.NOMBRE = txt_conductorNombre.Text; c.TRAN_ID = Convert.ToInt32(ddl_transportista.SelectedValue); c.COND_EXTRANJERO = chk_conductorExtranjero.Checked; hf_idCond.Value = c.AgregarIdentity().ToString(); } MovimientoBC mov = new MovimientoBC(); TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC(); TrailerBC trailer = new TrailerBC(); mov.FECHA_CREACION = DateTime.Now; mov.ID_ESTADO = 10; mov.OBSERVACION = txt_obs.Text; DateTime fh = DateTime.Parse(string.Format("{0} {1}", txt_ingresoFecha.Text, txt_ingresoHora.Text)); mov.FECHA_ORIGEN = fh; mov.ID_DESTINO = Convert.ToInt32(this.ddl_posicion.SelectedValue); mov.FECHA_DESTINO = fh.AddMinutes(30); mov.PATENTE_TRACTO = txt_buscarPatente.Text; mov.MANT_EXTERNO = false; mov.ID_TRAILER = 0; trailer.ID = 0; trailer.PLACA = ""; trailer.TRAN_ID = Convert.ToInt32(ddl_transportista.SelectedValue); trailerUE.SITE_ID = Convert.ToInt32(dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión trailerUE.CHOFER_RUT = utils.formatearRut(txt_conductorRut.Text); trailerUE.CHOFER_NOMBRE = txt_conductorNombre.Text; trailerUE.ACOMP_RUT = txt_acomRut.Text; trailerUE.COND_ID = Convert.ToInt32(hf_idCond.Value); UsuarioBC usuario = (UsuarioBC)Session["USUARIO"]; string resultado; bool ejecucion = mov.ProcesoEntrada(mov, trailerUE, trailer, usuario.ID, out resultado); if (ejecucion && resultado == "") { utils.ShowMessage2(this, "confirmar", "success"); limpiarTodo(); } else { utils.ShowMessage(this, resultado, "error", false); } } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } }
protected void btn_confirmar_Click(object sender, EventArgs e) { try { if (this.ddl_posicion.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe seleccionar posicion Destino');", true); } else if (this.hf_idTrailer.Value == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe ingresar Trailer');", true); limpiarTodo(); } else if (this.txt_conductorRut.Text == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe ingresar Conductor');", true); } else { ConductorBC c = new ConductorBC(); if (string.IsNullOrEmpty(hf_idCond.Value)) { if (extranjero.Checked == false) { c.RUT = utils.formatearRut(txt_conductorRut.Text); } else { c.RUT = txt_conductorRut.Text; } c.NOMBRE = txt_conductorNombre.Text; c.TRAN_ID = int.Parse(ddl_transportista.SelectedValue); hf_idCond.Value = c.AgregarIdentity().ToString(); } MovimientoBC mov = new MovimientoBC(); TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC(); TrailerBC trailer = new TrailerBC(); mov.FECHA_CREACION = DateTime.Now; mov.ID_ESTADO = 10; mov.OBSERVACION = this.txt_obs.Text; DateTime fh = DateTime.Parse(string.Format("{0} {1}", this.txt_ingresoFecha.Text, this.txt_ingresoHora.Text)); mov.FECHA_ORIGEN = fh; mov.ID_DESTINO = int.Parse(this.ddl_posicion.SelectedValue); mov.FECHA_DESTINO = fh.AddMinutes(30); mov.PATENTE_TRACTO = this.txt_traExtPat.Text; trailerUE.COND_ID = int.Parse(hf_idCond.Value); mov.MANT_EXTERNO = false; mov.ID_TRAILER = int.Parse(this.hf_idTrailer.Value); trailer.ID = int.Parse(this.hf_idTrailer.Value); trailer.PLACA = this.txt_buscarPatente.Text; trailer.CODIGO = string.Format("{0}_{1}", this.ddl_transportista.SelectedItem.Text, this.txt_buscarPatente.Text); if (rb_externo.Checked) { trailer.EXTERNO = true; } else { trailer.EXTERNO = false; } trailer.TRAN_ID = int.Parse(this.ddl_transportista.SelectedValue); trailerUE.SITE_ID = Convert.ToInt32(this.dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión if (extranjero.Checked == false) { trailerUE.CHOFER_RUT = utils.formatearRut(this.txt_conductorRut.Text); } else { trailerUE.CHOFER_RUT = this.txt_conductorRut.Text; } trailerUE.CHOFER_NOMBRE = this.txt_conductorNombre.Text; trailerUE.ACOMP_RUT = this.txt_acomRut.Text; trailerUE.PROV_ID = int.Parse(this.ddl_proveedor.SelectedValue); trailerUE.DOC_INGRESO = this.txt_buscarDoc.Text; trailerUE.SELLO_INGRESO = this.txt_idSello.Text; trailerUE.TIPO_INGRESO_CARGA = this.ddl_tipo_carga.SelectedValue; trailerUE.motivo_TIPO_INGRESO_CARGA = this.ddl_motivo.SelectedValue; PreEntradaBC p = new PreEntradaBC(); trailerUE.pring_id = hf_pring_id.Value.ToString(); // p.CargarPreEntrada( //p.CargarPreEntrada(mov.ID_TRAILER, int.Parse(dropsite.SelectedValue)).ID.ToString(); if (this.rb_ingresoCargado.Checked) //Trailer cargado: Entrada a destino { trailerUE.CARGADO = true; } else //Trailer sin carga: Entrada a origen { trailerUE.CARGADO = false; } UsuarioBC usuario = (UsuarioBC)Session["USUARIO"]; if (trailer.ID == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe ingresar Trailer);", true); limpiarTodo(); } else { string resultado; bool ejecucion = mov.ProcesoEntrada(mov, trailerUE, trailer, usuario.ID, out resultado); if (ejecucion && resultado == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje8", "showAlert('Ingreso correcto.');", true); limpiarTodo(); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + resultado + "');", true); } } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error! No se pudo ingresar los datos.');", true); } }
protected void btn_confirmar_Click(object sender, EventArgs e) { try { ConductorBC c = new ConductorBC(); MovimientoBC mov = new MovimientoBC(); TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC(); TrailerBC trailer = new TrailerBC(); if (string.IsNullOrEmpty(hf_idCond.Value)) { c.RUT = utils.formatearRut(txt_conductorRut.Text); c.NOMBRE = txt_conductorNombre.Text; c.TRAN_ID = Convert.ToInt32(ddl_transportista.SelectedValue); c.COND_EXTRANJERO = chk_conductorExtranjero.Checked; hf_idCond.Value = c.AgregarIdentity().ToString(); } mov.FECHA_CREACION = DateTime.Now; mov.ID_ESTADO = 10; mov.OBSERVACION = txt_obs.Text; mov.FECHA_ORIGEN = Convert.ToDateTime(string.Format("{0} {1}", txt_ingresoFecha.Text, txt_ingresoHora.Text)); mov.ID_DESTINO = Convert.ToInt32(ddl_posicion.SelectedValue); mov.FECHA_DESTINO = mov.FECHA_ORIGEN.AddMinutes(30); if (utils.patentevalida(txt_traExtPat.Text) == true) { mov.PATENTE_TRACTO = txt_traExtPat.Text; if (rb_mantExterno.Checked) { mov.MANT_EXTERNO = true; } else { trailerUE.COND_ID = Convert.ToInt32(hf_idCond.Value); mov.MANT_EXTERNO = false; mov.ID_TRAILER = Convert.ToInt32(hf_idTrailer.Value); trailer.ID = Convert.ToInt32(hf_idTrailer.Value); trailer.PLACA = txt_buscarPatente.Text; trailer.CODIGO = string.Format("{0}_{1}", ddl_transportista.SelectedItem.Text, txt_buscarPatente.Text); trailer.EXTERNO = (rb_externo.Checked || rb_proveedor.Checked || rb_mantExterno.Checked); trailer.TRAN_ID = Convert.ToInt32(ddl_transportista.SelectedValue); trailerUE.SITE_ID = Convert.ToInt32(dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión trailerUE.CHOFER_RUT = utils.formatearRut(txt_conductorRut.Text); trailerUE.CHOFER_NOMBRE = txt_conductorNombre.Text; trailerUE.ACOMP_RUT = txt_acomRut.Text; trailerUE.PROV_ID = Convert.ToInt32(ddl_proveedor.SelectedValue); trailerUE.DOC_INGRESO = txt_buscarDoc.Text; trailerUE.SELLO_INGRESO = txt_idSello.Text; trailerUE.TIPO_INGRESO_CARGA = ddl_tipo_carga.SelectedValue; trailerUE.motivo_TIPO_INGRESO_CARGA = ddl_motivo.SelectedValue; trailerUE.pring_id = hf_pring_id.Value.ToString(); // p.CargarPreEntrada( //p.CargarPreEntrada(mov.ID_TRAILER, Convert.ToInt32(dropsite.SelectedValue)).ID.ToString(); trailerUE.CARGADO = rb_ingresoCargado.Checked; } UsuarioBC usuario = (UsuarioBC)this.Session["USUARIO"]; if (trailer.ID == 0) { utils.ShowMessage(this, "Debe ingresar Trailer", "warn", true); limpiarTodo(); } else { string resultado; bool ejecucion = mov.ProcesoEntrada(mov, trailerUE, trailer, usuario.ID, out resultado); if (ejecucion && resultado == "") { utils.ShowMessage(this, "Ingreso correcto", "success", true); limpiarTodo(); } else { utils.ShowMessage(this, resultado, "error", false); } } } else { utils.ShowMessage(this, "Patente de Tracto Invalida", "warn", false); } } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } }