Beispiel #1
0
    protected void btn_grabar_Click(object sender, EventArgs e)
    {
        ServiciosExternosConductorBC c = new ServiciosExternosConductorBC();

        c.RUT    = this.txt_editRut.Text;
        c.NOMBRE = this.txt_editNombre.Text;
        if (string.IsNullOrEmpty(this.hf_id.Value))
        {
            if (c.Agregar(c))
            {
                utils.ShowMessage2(this, "crear", "success");
                utils.CerrarModal(this, "modalEdit");
            }
            else
            {
                utils.ShowMessage2(this, "crear", "error");
            }
        }
        else
        {
            c.ID = Convert.ToInt32(this.hf_id.Value);
            if (c.Modificar(c))
            {
                utils.ShowMessage2(this, "modificar", "success");
                utils.CerrarModal(this, "modalEdit");
            }
            else
            {
                utils.ShowMessage2(this, "modificar", "success");
            }
        }
        this.ObtenerConductores(true);
    }
Beispiel #2
0
    protected void txt_rutCond_TextChanged(object sender, EventArgs e)
    {
        if (!chk_conductorExtranjero.Checked && !utils.validarRut(txt_conductorRut.Text))
        {
            txt_conductorRut.Text    = "";
            txt_conductorNombre.Text = "";
            utils.ShowMessage2(this, "conductor", "warn_rutNovalido");
            return;
        }
        ServiciosExternosConductorBC c = new ServiciosExternosConductorBC();

        c = c.ObtenerXRut(utils.formatearRut(txt_conductorRut.Text));

        if (c.ID == 0)
        {
            utils.ShowMessage2(this, "conductor", "warn_conductorNoexiste");
            return;
        }
        if (c.BLOQUEADO)
        {
            txt_conductorRut.Text    = "";
            txt_conductorNombre.Text = "";
            utils.ShowMessage2(this, "conductor", "warn_conductorBloqueado");
            return;
        }
        txt_conductorNombre.Text = c.NOMBRE;
        utils.ShowMessage2(this, "conductor", "success");
    }
Beispiel #3
0
    public ServiciosExternosConductorBC(string rut)
    {
        this.RUT = rut;
        ServiciosExternosConductorBC c = ObtenerXRut();

        this.ID        = c.ID;
        this.NOMBRE    = c.NOMBRE;
        this.IMAGEN    = c.IMAGEN;
        this.BLOQUEADO = c.BLOQUEADO;
        this.ACTIVO    = c.ACTIVO;
    }
Beispiel #4
0
    public ServiciosExternosConductorBC(int id)
    {
        this.ID = id;
        ServiciosExternosConductorBC c = ObtenerXId();

        this.RUT       = c.RUT;
        this.NOMBRE    = c.NOMBRE;
        this.IMAGEN    = c.IMAGEN;
        this.BLOQUEADO = c.BLOQUEADO;
        this.ACTIVO    = c.ACTIVO;
    }
Beispiel #5
0
    protected void btn_Conf_Click(object sender, EventArgs e)
    {
        ServiciosExternosConductorBC c = new ServiciosExternosConductorBC();

        c.ID = Convert.ToInt32(this.hf_id.Value);
        if (c.Eliminar())
        {
            utils.ShowMessage2(this, "eliminar", "success");
        }
        else
        {
            utils.ShowMessage2(this, "eliminar", "error");
        }
        this.ObtenerConductores(true);
        utils.CerrarModal(this, "modalConf");
    }
Beispiel #6
0
    private void ObtenerConductores(bool forzarBD)
    {
        if (this.ViewState["lista"] == null || forzarBD)
        {
            ServiciosExternosConductorBC c = new ServiciosExternosConductorBC();
            string rut    = txt_buscarRut.Text;
            string nombre = txt_buscarNombre.Text;
            this.ViewState["lista"] = c.ObtenerXParametros(rut, nombre);
        }
        DataView dw = new DataView((DataTable)this.ViewState["lista"]);

        if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "")
        {
            dw.Sort = (String)this.ViewState["sortExpresion"];
        }
        this.gv_listar.DataSource = dw;
        this.gv_listar.DataBind();
    }
Beispiel #7
0
 protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EDITAR")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         ServiciosExternosConductorBC c = new ServiciosExternosConductorBC();
         c = c.ObtenerXId(Convert.ToInt32(this.hf_id.Value));
         this.txt_editRut.Text    = c.RUT;
         this.txt_editRut.Enabled = false;
         this.txt_editNombre.Text = c.NOMBRE;
         utils.AbrirModal(this, "modalEdit");
     }
     if (e.CommandName == "ELIM")
     {
         this.hf_id.Value               = e.CommandArgument.ToString();
         this.hf_confirmar.Value        = "ELIM";
         this.lbl_tituloConfirmar.Text  = "Eliminar Conductor";
         this.lbl_mensajeConfirmar.Text = "Se eliminará el conductor seleccionado, ¿desea continuar?";
         utils.AbrirModal(this, "modalConf");
     }
 }
Beispiel #8
0
 protected void txt_editRut_TextChanged(object sender, EventArgs e)
 {
     if (this.validarRut(txt_editRut.Text))
     {
         ServiciosExternosConductorBC c = new ServiciosExternosConductorBC();
         c = c.ObtenerXRut(this.txt_editRut.Text);
         if (c.ID != 0)
         {
             this.hf_id.Value         = c.ID.ToString();
             this.txt_editNombre.Text = c.NOMBRE;
             this.txt_editRut.Enabled = false;
             utils.ShowMessage2(this, "crear", "warn_rutEncontrado");
         }
         this.txt_editNombre.Focus();
     }
     else
     {
         utils.ShowMessage2(this, "crear", "warn_rutNoValido");
         this.txt_editRut.Text = "";
         this.txt_editRut.Focus();
     }
 }
Beispiel #9
0
 public bool Modificar(ServiciosExternosConductorBC c)
 {
     return(tran.ServiciosExternosConductor_Modificar(c));
 }
Beispiel #10
0
 public bool Agregar(ServiciosExternosConductorBC c)
 {
     return(tran.ServiciosExternosConductor_Agregar(c));
 }