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) { TrailerUltSalidaBC tu = new TrailerUltSalidaBC(); tu.ID = Convert.ToInt32(hf_idTrailer.Value); tu.PATENTE_TRACTO = txt_patenteTracto.Text; tu.CHOFER_RUT = utils.formatearRut(txt_conductorRut.Text); tu.CHOFER_NOMBRE = txt_conductorNombre.Text; if (ddl_tipoDestino.SelectedValue == "DLPR") { tu.LOCA_ID = Convert.ToInt32(ddl_destino.SelectedValue); } else { tu.DEST_ID = Convert.ToInt32(ddl_destino.SelectedValue); } string resultado; 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(hf_idTran.Value); c.COND_EXTRANJERO = chk_conductorExtranjero.Checked; hf_idCond.Value = c.AgregarIdentity().ToString(); } tu.COND_ID = Convert.ToInt32(hf_idCond.Value); tu.CHOFER_RUT = txt_conductorRut.Text; tu.ESTADO_YMS = estado_yms.Value; tu.OBSERVACION = locales_YMS.Value.ToString(); bool ejecucion = tu.ProcesoSalida(tu, LlenarTableLocales(), usuario.ID, txt_nroViaje.Text, lbl_trailerGPS.Text, out resultado); if (ejecucion && resultado == "") { btn_limpiar_Click(null, null); utils.ShowMessage2(this, "confirmar", "success"); } else { utils.ShowMessage(this, resultado, "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 { if (this.hf_idTrailer.Value == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe ingresar Trailer');", true); limpiarTodo(); } else { ConductorBC c = new ConductorBC(); 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(); } PreEntradaBC p = new PreEntradaBC(); p.SITE_ID = Convert.ToInt32(dropsite.SelectedValue); p.TRAI_ID = Convert.ToInt32(hf_idTrailer.Value); p.FECHA = DateTime.Parse(txt_ingresoFecha.Text + " " + txt_ingresoHora.Text); p.ESTADO = 1; p.DOC_INGRESO = ""; p.RUT_CHOFER = utils.formatearRut(txt_conductorRut.Text); p.NOMBRE_CHOFER = txt_conductorNombre.Text; p.RUT_ACOMP = txt_acomRut.Text; p.COND_ID = Convert.ToInt32(hf_idCond.Value); if (rb_ingresoVacio.Checked) { p.SELLO_INGRESO = txt_idSello.Text; p.CARGADO = false; } if (utils.patentevalida(this.txt_placaTracto.Text) == true) { TrailerBC trailer_tracto = new TrailerBC(); trailer_tracto = trailer_tracto.obtenerXPlaca(this.txt_placaTracto.Text); if (trailer_tracto.ID > 0 && trailer_tracto.ID != p.TRAI_ID) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Tracto corresponde a trailer');", true); } else { if (rb_ingresoCargado.Checked) { p.PROV_ID = Convert.ToInt32(ddl_proveedor.SelectedValue); p.TIIC_ID = Convert.ToInt32(ddl_tipo_carga.SelectedValue); p.MOIC_ID = Convert.ToInt32(ddl_motivo.SelectedValue); p.SELLO_CARGA = txt_idSello.Text; p.PATENTE_TRACTO = txt_placaTracto.Text; p.CARGADO = true; } int id; string error; if (p.Crear(p, out id, out error)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ingreso correcto.');", true); limpiarTodo(); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", error), true); } } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + "patente de Tracto Invalida" + "');", 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); } }
protected void btn_confirmar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txt_placaTracto.Text) && txt_placaTracto.Text.ToUpper() != txt_placaTrailer.Text.ToUpper()) { TrailerBC t = new TrailerBC(); t = t.obtenerXPlaca(this.txt_placaTracto.Text); if (t.ID > 0) { utils.ShowMessage2(this, "tracto", "warn_placaTrailer"); return; } } try { PreEntradaBC p = new PreEntradaBC(); ConductorBC c = new ConductorBC().ObtenerXRut(txt_conductorRut.Text); if (c.ID == 0) { c.RUT = txt_conductorRut.Text; c.NOMBRE = txt_conductorNombre.Text; c.TRAN_ID = Convert.ToInt32(ddl_transportista.SelectedValue); c.COND_EXTRANJERO = chk_conductorExtranjero.Checked; c.ID = c.AgregarIdentity(); } p.COND_ID = c.ID; p.RUT_CHOFER = c.RUT; p.NOMBRE_CHOFER = c.NOMBRE; p.SITE_ID = Convert.ToInt32(dropsite.SelectedValue); p.TRAI_ID = Convert.ToInt32(hf_idTrailer.Value); p.FECHA = DateTime.Parse(txt_ingresoFecha.Text + " " + txt_ingresoHora.Text); p.ESTADO = 1; p.DOC_INGRESO = txt_buscarDoc.Text; p.Observacion = txt_obs.Text; p.RUT_ACOMP = txt_acomRut.Text; p.extranjero = chk_vehiculoImportado.Checked; p.SELLO_INGRESO = txt_selloReferencia.Text; p.PRING_FONO = txt_ingresoFono.Text; if (rb_ingresoVacio.Checked) { p.CARGADO = false; } if (rb_ingresoCargado.Checked) { p.PROV_ID = Convert.ToInt32(ddl_proveedor.SelectedValue); p.TIIC_ID = Convert.ToInt32(ddl_tipo_carga.SelectedValue); p.MOIC_ID = Convert.ToInt32(ddl_motivo.SelectedValue); p.SELLO_CARGA = txt_idSello.Text; p.PATENTE_TRACTO = txt_placaTracto.Text; p.CARGADO = true; } DataTable table = (DataTable)(ViewState["listar"]); DataTable citas = table.Clone(); foreach (DataRow drtableOld in table.Rows) { citas.ImportRow(drtableOld); } p.citas = citas; string error = ""; int id; if (p.Crear(p, out id, out error) && error == "") { hf_id.Value = id.ToString(); utils.ShowMessage2(this, "confirmar", "success"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "generarPDF", "generaPDF();", true); CreaDataTable(); } else { utils.ShowMessage(this, error, "error", false); } } catch (Exception ex) { utils.ShowMessage(this, ex.Message, "error", false); } }
protected void btn_confirmar_Click(object sender, EventArgs e) { DataTable table = (DataTable)this.ViewState["table"]; try { if (this.hf_idTrailer.Value == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe ingresar Trailer');", true); this.limpiarTodo(); } else { PreEntradaBC p = new PreEntradaBC(); if (this.hf_idCond.Value == "") { ConductorBC c = new ConductorBC(); c.RUT = txt_conductorRut.Text; c.NOMBRE = this.txt_conductorNombre.Text; c.TRAN_ID = Convert.ToInt32(this.ddl_transportista.SelectedValue); c.COND_EXTRANJERO = chk_conductorExtranjero.Checked; hf_idCond.Value = c.AgregarIdentity().ToString(); } else { p.COND_ID = Convert.ToInt32(this.hf_idCond.Value); } p.SITE_ID = Convert.ToInt32(this.dropsite.SelectedValue); p.TRAI_ID = Convert.ToInt32(this.hf_idTrailer.Value); p.FECHA = DateTime.Parse(string.Format("{0} {1}", this.txt_ingresoFecha.Text, this.txt_ingresoHora.Text)); p.ESTADO = 1; p.DOC_INGRESO = this.txt_buscarDoc.Text; p.RUT_CHOFER = utils.formatearRut(this.txt_conductorRut.Text); p.Observacion = this.txt_obs.Text; p.NOMBRE_CHOFER = this.txt_conductorNombre.Text; p.RUT_ACOMP = this.txt_acomRut.Text; if (this.rb_ingresoVacio.Checked) { p.SELLO_INGRESO = this.txt_idSello.Text; p.CARGADO = false; } if (this.rb_ingresoCargado.Checked) { p.PROV_ID = Convert.ToInt32(this.ddl_proveedor.SelectedValue); p.TIIC_ID = Convert.ToInt32(this.ddl_tipo_carga.SelectedValue); p.MOIC_ID = Convert.ToInt32(this.ddl_motivo.SelectedValue); p.SELLO_CARGA = this.txt_idSello.Text; p.PATENTE_TRACTO = this.txt_placaTracto.Text; p.CARGADO = true; } DataTable citas = table.Clone(); foreach (DataRow drtableOld in table.Rows) { citas.ImportRow(drtableOld); } citas.Columns.RemoveAt(5); citas.Columns.RemoveAt(3); citas.Columns.RemoveAt(1); citas.Columns[0].ColumnName = "tipo_carga"; citas.Columns[1].ColumnName = "motivo_carga"; citas.Columns[2].ColumnName = "numero_cita"; p.citas = citas; string error = ""; int id; TrailerBC trailer_tracto = new TrailerBC(); if (this.txt_placaTracto.Text != "") { trailer_tracto = trailer_tracto.obtenerXPlaca(this.txt_placaTracto.Text); } if (utils.patentevalida(this.txt_placaTracto.Text) == false) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('patente de Tracto Invalida');"), true); } else if (trailer_tracto.ID > 0 && trailer_tracto.ID != p.TRAI_ID) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('Tracto corresponde a trailer');"), true); } else if (p.Crear(p, out id, out error) && error == "") { if (id != 0) { this.hf_id.Value = id.ToString(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Preingreso correcto.');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "generarPDF", "generaPDF();", true); this.CreaDataTable(); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", error), true); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", error), true); } } } catch (Exception) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error! No se pudo ingresar los datos.');", true); } }