Esempio n. 1
0
 protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "FOTO")
     {
         hf_id.Value = e.CommandArgument.ToString();
         utils.AbrirModal(this, "modalFoto");
     }
     if (e.CommandName == "EDITAR")
     {
         hf_id.Value = e.CommandArgument.ToString();
         ConductorBC c = new ConductorBC();
         c = c.ObtenerXId(Convert.ToInt32(hf_id.Value));
         txt_editRut.Text           = c.RUT;
         txt_editNombre.Text        = c.NOMBRE;
         ddl_editTran.SelectedValue = c.TRAN_ID.ToString();
         chk_editExtranjero.Checked = c.COND_EXTRANJERO;
         txt_editRut.Enabled        = false;
         chk_editExtranjero.Enabled = false;
         utils.AbrirModal(this, "modalEdit");
     }
     if (e.CommandName == "ELIM")
     {
         hf_id.Value                      = e.CommandArgument.ToString();
         hf_confirmar.Value               = "ELIM";
         lbl_tituloConfirmar.Text         = "Eliminar Conductor";
         lbl_mensajeConfirmar.Text        = "Se eliminará el conductor seleccionado, ¿desea continuar?";
         pnl_confirmarObservacion.Visible = false;
         utils.AbrirModal(this, "modalConf");
     }
     if (e.CommandName == "ACTIVAR")
     {
         hf_id.Value                      = e.CommandArgument.ToString();
         hf_confirmar.Value               = "ACTIVAR";
         lbl_tituloConfirmar.Text         = "Activar/Desactivar Conductor";
         lbl_mensajeConfirmar.Text        = "Se activará/desactivará el conductor seleccionado, ¿desea continuar?";
         pnl_confirmarObservacion.Visible = false;
         utils.AbrirModal(this, "modalConf");
     }
     if (e.CommandName == "BLOQUEAR")
     {
         hf_id.Value = e.CommandArgument.ToString();
         ConductorBC c = new ConductorBC().ObtenerXId(Convert.ToInt32(hf_id.Value));
         if (c.BLOQUEADO)
         {
             lbl_tituloConfirmar.Text         = "Desbloquear Conductor";
             lbl_mensajeConfirmar.Text        = "Se desbloqueará el conductor seleccionado.";
             txt_confirmarMotivo.Text         = "";
             pnl_confirmarObservacion.Visible = false;
         }
         else
         {
             lbl_tituloConfirmar.Text         = "Bloquear Conductor";
             lbl_mensajeConfirmar.Text        = "Ingrese motivo de bloqueo:";
             txt_confirmarMotivo.Text         = "";
             pnl_confirmarObservacion.Visible = true;
         }
         hf_confirmar.Value = "BLOQUEAR";
         utils.AbrirModal(this, "modalConf");
     }
 }
Esempio n. 2
0
    protected void btn_upload_Click(object sender, EventArgs e)
    {
        if (FileUpLoad1.HasFile)
        {
            string fileName = FileUpLoad1.FileName;
            string Ruta1;

            Ruta1 = Server.MapPath(ConfigurationManager.AppSettings["conductores_yms"]);
            if (!System.IO.Directory.Exists(Ruta1))
            {
                System.IO.Directory.CreateDirectory(Ruta1);
            }
            if (Path.GetExtension(FileUpLoad1.FileName) == ".png" || Path.GetExtension(FileUpLoad1.FileName) == ".jpg")
            {
                ConductorBC c = new ConductorBC();
                c = c.ObtenerXId(Convert.ToInt32(hf_id.Value));
                string sName = "COND_" + c.RUT + Path.GetExtension(FileUpLoad1.FileName);

                try
                {
                    FileUpLoad1.SaveAs(Ruta1 + sName);
                    c.IMAGEN = sName;
                    if (c.AgregarFoto())
                    {
                        utils.ShowMessage2(this, "subirFoto", "success");
                        ObtenerConductores(true);
                    }
                    else
                    {
                        utils.ShowMessage2(this, "subirFoto", "error");
                    }
                }
                catch (Exception ex)
                {
                    utils.ShowMessage(this, ex.Message, "error", false);
                }
            }
            else
            {
                utils.ShowMessage2(this, "subirFoto", "warn_archivoInvalido");
            }
        }
    }
Esempio n. 3
0
    protected void btnBuscarTrailer_Click(object sender, EventArgs e)
    {
        TrailerBC trailer = new TrailerBC();

        ddl_playa.Enabled    = false;
        ddl_zona.Enabled     = false;
        ddl_posicion.Enabled = false;

        trailer = trailer.obtenerXDoc(this.txt_buscarDoc.Text, dropsite.SelectedValue);
        if (trailer.ID == 0) //Trailer nuevo, no existe
        {
            limpiarTodo();
            utils.ShowMessage2(this, "cita", "warn_noExiste");
            return;
        }
        ddl_zona.Enabled                = true;
        hf_idTrailer.Value              = trailer.ID.ToString();
        hf_pring_id.Value               = trailer.PRING_ID.ToString();
        txt_buscarPatente.Text          = trailer.PLACA;
        ddl_transportista.SelectedValue = trailer.TRAN_ID.ToString();
        rb_propio.Checked               = !trailer.EXTERNO;
        rb_externo.Checked              = trailer.EXTERNO;
        txt_traExtPat.Enabled           = false;
        ddl_transportista.Enabled       = false;
        utils.ShowMessage2(this, "cita", "success");
        txt_traExtPat.Enabled           = rb_ingresoCargado.Checked;
        txt_idSello.Enabled             = rb_ingresoCargado.Checked;
        txt_conductorRut.Enabled        = true;
        chk_conductorExtranjero.Enabled = true;
        txt_conductorNombre.Enabled     = true;
        txt_acomRut.Enabled             = true;
        PreEntradaBC p = new PreEntradaBC();

        p = p.CargarPreEntrada(trailer.ID, int.Parse(dropsite.SelectedValue), txt_buscarDoc.Text);

        if (p.ID != 0)
        {
            int hours = (p.FECHA_HORA - DateTime.Now).Hours;
            if (p.COND_ID != 0)
            {
                ConductorBC c = new ConductorBC();
                c = c.ObtenerXId(p.COND_ID);
                hf_idCond.Value = c.ID.ToString();
                if (p.extranjero == false)
                {
                    txt_conductorRut.Text = utils.formatearRut(c.RUT);
                }
                else
                {
                    txt_conductorRut.Text = c.RUT;
                }

                txt_conductorNombre.Text = c.NOMBRE;
            }
            hf_pring_id.Value  = p.ID.ToString();
            txt_traExtPat.Text = p.PATENTE_TRACTO;
            txt_acomRut.Text   = p.RUT_ACOMP;

            ddl_proveedor.SelectedValue = p.PROV_ID.ToString();
            hf_idTrailer.Value          = p.TRAI_ID.ToString();
            DateTime fechaHora = DateTime.Parse(txt_ingresoFecha.Text + " " + txt_ingresoHora.Text);
            if (fechaHora > p.FECHA_HORA.AddHours(2) || fechaHora < p.FECHA_HORA.AddHours(-2))
            {
                utils.ShowMessage2(this, "cita", "warn_fhDiferente");
            }

            if (!string.IsNullOrEmpty(p.SELLO_INGRESO))
            {
                txt_idSello.Text = p.SELLO_INGRESO;
            }
            if (!string.IsNullOrEmpty(p.SELLO_CARGA))
            {
                txt_idSello.Text = p.SELLO_CARGA;
            }
            rb_ingresoCargado.Checked = p.CARGADO;
            rb_ingresoVacio.Checked   = !p.CARGADO;
            txt_obs.Text = p.Observacion;
            chk_ingresoCargado_CheckedChanged(null, null);
            ddl_tipo_carga.SelectedValue = p.TIIC_ID.ToString();
            tipo_carga_SelectedIndexChanged(null, null);
            ddl_motivo.SelectedValue = p.MOIC_ID.ToString();
        }
        else
        {
            utils.ShowMessage2(this, "cita", "warn_expirado");
            limpiarTodo();
        }
        rb_posAuto.Checked   = false;
        rb_posManual.Checked = false;
        ddl_zona.Enabled     = false;
        if (txt_conductorRut.Text != "")
        {
            txt_conductorRut_TextChanged(null, null);
        }
    }
Esempio n. 4
0
    protected void btnBuscarTrailer_Click(object sender, EventArgs e)
    {
        TrailerBC trailer = new TrailerBC();

        this.ddl_playa.Enabled    = false;
        this.ddl_zona.Enabled     = false;
        this.ddl_posicion.Enabled = false;

        if (!string.IsNullOrEmpty(this.txt_buscarDoc.Text))
        {
            trailer = trailer.obtenerXDoc(this.txt_buscarDoc.Text, this.dropsite.SelectedValue);
            if (trailer.ID == 0) //Trailer nuevo, no existe
            {
                this.limpiarTodo();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('No se ha encontrado el número de documento.');", true);
            }
            else //Trailer existente, trae datos
            {
                this.ddl_zona.Enabled                = true;
                this.hf_idTrailer.Value              = trailer.ID.ToString();
                this.txt_buscarPatente.Text          = trailer.PLACA;
                this.ddl_transportista.SelectedValue = trailer.TRAN_ID.ToString();
                if (trailer.EXTERNO)
                {
                    this.rb_propio.Checked  = false;
                    this.rb_externo.Checked = true;
                }
                else
                {
                    this.rb_propio.Checked  = true;
                    this.rb_externo.Checked = false;
                }
                this.txt_traExtPat.Enabled     = false;
                this.ddl_transportista.Enabled = false;
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Se cargaron los datos del trailer seleccionado.');", true);

                if (this.rb_ingresoCargado.Checked)
                {
                    this.txt_traExtPat.Enabled = true;
                    this.ddl_proveedor.Enabled = true;
                    this.txt_idSello.Enabled   = true;
                }
                else
                {
                    this.txt_traExtPat.Enabled = false;
                    this.ddl_proveedor.Enabled = false;
                    this.txt_idSello.Enabled   = false;
                }
                this.txt_conductorRut.Enabled    = true;
                chk_conductorExtranjero.Enabled  = true;
                this.txt_conductorNombre.Enabled = true;
                this.txt_acomRut.Enabled         = true;
                PreEntradaBC p = new PreEntradaBC();
                p = p.CargarPreEntrada(trailer.ID, Convert.ToInt32(this.dropsite.SelectedValue), this.txt_buscarDoc.Text);
                if (p.ID != 0)
                {
                    if (p.COND_ID != 0)
                    {
                        ConductorBC c = new ConductorBC();
                        c = c.ObtenerXId(p.COND_ID);
                        this.hf_idCond.Value          = c.ID.ToString();
                        this.txt_conductorRut.Text    = utils.formatearRut(c.RUT);
                        this.txt_conductorNombre.Text = c.NOMBRE;
                    }
                    this.txt_traExtPat.Text          = p.PATENTE_TRACTO;
                    this.txt_acomRut.Text            = p.RUT_ACOMP;
                    this.ddl_proveedor.SelectedValue = p.PROV_ID.ToString();
                    this.hf_idTrailer.Value          = p.TRAI_ID.ToString();
                    if (!string.IsNullOrEmpty(p.SELLO_INGRESO))
                    {
                        this.txt_idSello.Text = p.SELLO_INGRESO;
                    }
                    if (!string.IsNullOrEmpty(p.SELLO_CARGA))
                    {
                        this.txt_idSello.Text = p.SELLO_CARGA;
                    }
                    if (p.CARGADO)
                    {
                        this.rb_ingresoCargado.Checked = true;
                        this.rb_ingresoVacio.Checked   = false;
                    }
                    else
                    {
                        this.rb_ingresoCargado.Checked = false;
                        this.rb_ingresoVacio.Checked   = true;
                    }
                    this.chk_ingresoCargado_CheckedChanged(null, null);
                    this.ddl_tipo_carga.SelectedValue = p.TIIC_ID.ToString();
                    this.tipo_carga_SelectedIndexChanged(null, null);
                    this.ddl_motivo.SelectedValue = p.MOIC_ID.ToString();
                }
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe ingresar un numero de documento');", true);
            this.ddl_zona.Enabled   = false;
            this.hf_idTrailer.Value = "";
        }
    }