예제 #1
0
 protected void btn_guardar_Click(object sender, EventArgs e)
 {
     if (utils.validarRut(txt_conductorRut.Text) == false)
     {
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Rut del Conductor invalido');", true);
         txt_conductorRut.Text = "";
     }
     else
     {
         ServiciosExternosVehiculosBC se = new ServiciosExternosVehiculosBC();
         se.SEVE_ID     = Convert.ToInt32(hf_id.Value);
         se.FH_SALIDA   = Convert.ToDateTime(txt_fecha.Text + " " + txt_hora.Text);
         se.COSE_RUT    = txt_conductorRut.Text;
         se.COSE_NOMBRE = txt_conductorNombre.Text;
         se.OBSERVACION = "";
         se.USUA_ID     = usuario.ID;
         se.SEEX_ID     = 0;
         if (se.Salida())
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Salida correcta');", true);
             Limpiar();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Error');", true);
         }
     }
 }
예제 #2
0
    private ServiciosExternosVehiculosBC LlenarBC()
    {
        ServiciosExternosVehiculosBC s = new ServiciosExternosVehiculosBC();

        s.CODIGO  = this.txt_editPlaca.Text;
        s.PLACA   = this.txt_editPlaca.Text;
        s.PROV_ID = Convert.ToInt32(this.ddl_editProv.SelectedValue);
        return(s);
    }
예제 #3
0
    private void LlenarForm()
    {
        ServiciosExternosVehiculosBC s = new ServiciosExternosVehiculosBC();

        s.SEVE_ID = Convert.ToInt32(this.hf_id.Value);
        s         = s.ObtenerXId();
        this.txt_editCodigo.Text        = s.CODIGO;
        this.txt_editPlaca.Text         = s.PLACA;
        this.ddl_editProv.SelectedValue = s.PROV_ID.ToString();
    }
예제 #4
0
    protected void btn_editGrabar_Click(object sender, EventArgs e)
    {
        ServiciosExternosVehiculosBC s = new ServiciosExternosVehiculosBC();

        s = this.LlenarBC();
        TrailerBC t = new TrailerBC();

        t = t.obtenerXPlaca(s.PLACA);
        if (t.ID > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Patente corresponde a Trailer');", true);
        }
        else if (this.utils.patentevalida(s.PLACA) == true)
        {
            if (string.IsNullOrEmpty(this.hf_id.Value))
            {
                if (s.ObtenerXPlaca(s.PLACA).SEVE_ID > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Patente existente');", true);
                }
                else if (s.Crear())
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "showAlert('Vehículo agregado correctamente');", true);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalEditar');", true);
                    this.ObtenerServicios(true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Error');", true);
                }
            }
            else
            {
                s.SEVE_ID = Convert.ToInt32(this.hf_id.Value);
                if (s.ObtenerXPlaca(s.PLACA).SEVE_ID > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Patente existente');", true);
                }
                else if (s.Modificar())
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "showAlert('Vehículo modificado correctamente');", true);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalEditar');", true);
                    this.ObtenerServicios(true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Error');", true);
                }
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Patente Invalida');", true);
        }
    }
예제 #5
0
    protected void btn_Eliminar_Click(object sender, EventArgs e)
    {
        ServiciosExternosVehiculosBC s = new ServiciosExternosVehiculosBC();

        if (s.Eliminar(int.Parse(this.hf_id.Value)))
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "showAlert('Vehículo eliminado exitosamente');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "alert('Error');", true);
        }
        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalConfirmar');", true);
        this.ObtenerServicios(true);
    }
예제 #6
0
 protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EDITAR")
     {
         ServiciosExternosVehiculosBC s = new ServiciosExternosVehiculosBC();
         this.hf_id.Value = e.CommandArgument.ToString();
         this.LlenarForm();
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalEditar();", true);
     }
     else if (e.CommandName == "ELIMINAR")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         this.lbl_tituloConfirmar.Text = "Eliminar servicio externo";
         this.lbl_msjConfirmar.Text    = "Se eliminará el servicio externo seleccionado, ¿desea continuar?";
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalConfirmar();", true);
     }
 }
예제 #7
0
    protected void btn_buscar_Click(object sender, EventArgs e)
    {
        ServiciosExternosVehiculosBC sev = new ServiciosExternosVehiculosBC();
        ServiciosExternosBC          se  = new ServiciosExternosBC();
        bool existe;

        sev           = sev.ObtenerXPlaca(txt_placa.Text, out existe);
        sev.CONDUCTOR = sev.CONDUCTOR.ObtenerXId(sev.SEEX_ID);
        if (!existe)
        {
            if (new TrailerBC().obtenerXPlaca(txt_placa.Text).ID > 0)
            {
                txt_placa.Text = "";
                utils.ShowMessage2(this, "buscar", "warn_trailer");
                return;
            }
            utils.ShowMessage2(this, "buscar", "warn_vehiculoNoExiste");
            Limpiar();
            return;
        }
        if (sev.SITE_ID != Convert.ToInt32(ddl_site.SelectedValue))
        {
            utils.ShowMessage2(this, "buscar", "warn_vehiculoOtroSite");
            Limpiar();
            return;
        }
        if (!sev.SITE_IN)
        {
            utils.ShowMessage2(this, "buscar", "warn_vehiculoFueraSite");
            Limpiar();
            return;
        }
        ProveedorBC p = new ProveedorBC();

        p                        = p.ObtenerXId(sev.PROV_ID);
        hf_id.Value              = sev.SEVE_ID.ToString();
        lbl_proveedor.Text       = p.DESCRIPCION;
        lbl_placa.Text           = sev.PLACA;
        txt_conductorRut.Text    = sev.COSE_RUT;
        txt_conductorNombre.Text = sev.COSE_NOMBRE;
        lbl_servExt.Text         = se.CODIGO;
        dv_contenido.Attributes.Add("style", "display:block");
        utils.ShowMessage2(this, "buscar", "success");
    }
예제 #8
0
    private void ObtenerServicios(bool forzarBD)
    {
        if (this.ViewState["listar"] == null || forzarBD)
        {
            ServiciosExternosVehiculosBC s = new ServiciosExternosVehiculosBC();
            string    codigo = txt_buscarCodigo.Text;
            string    placa  = txt_buscarPlaca.Text;
            DataTable dt     = s.ObtenerXParametros(codigo, placa);
            this.ViewState["listar"] = dt;
        }
        DataView dw = new DataView((DataTable)this.ViewState["listar"]);

        if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "")
        {
            dw.Sort = (String)this.ViewState["sortExpresion"];
        }
        this.gv_listar.DataSource = dw.ToTable();
        this.gv_listar.DataBind();
    }
예제 #9
0
    protected void btn_buscar_Click(object sender, EventArgs e)
    {
        ServiciosExternosVehiculosBC se = new ServiciosExternosVehiculosBC();
        bool existe;

        se = se.ObtenerXPlaca(this.txt_placa.Text, out existe);
        if (existe)
        {
            if (se.SITE_IN)
            {
                txt_placa.Text = "";
                utils.ShowMessage2(this, "buscar", "warn_vehiculoIngresado");
                return;
            }
            se.CONDUCTOR                    = se.CONDUCTOR.ObtenerXId(se.SEEX_ID);
            txt_conductorRut.Text           = se.CONDUCTOR.RUT;
            txt_conductorNombre.Text        = se.CONDUCTOR.NOMBRE;
            chk_conductorExtranjero.Checked = se.CONDUCTOR.COSE_EXTRANJERO;
            ddl_prov.SelectedValue          = se.PROV_ID.ToString();
            ddl_servExt.SelectedValue       = se.SEEX_ID.ToString();
            ddl_prov.Enabled                = false;
            ddl_servExt.Enabled             = true;
        }
        else
        {
            if (new TrailerBC().obtenerXPlaca(txt_placa.Text).ID > 0)
            {
                txt_placa.Text = "";
                utils.ShowMessage2(this, "buscar", "warn_trailer");
                return;
            }
            ddl_prov.ClearSelection();
            ddl_prov.Enabled       = false;
            ddl_prov.SelectedValue = "809";
            ddl_servExt.Enabled    = true;
            utils.ShowMessage2(this, "buscar", "warn_noExiste");
        }
        btn_guardar.Enabled = true;
        ddl_servExt.Enabled = true;
    }
예제 #10
0
    protected void btn_guardar_Click(object sender, EventArgs e)
    {
        ServiciosExternosVehiculosBC se = new ServiciosExternosVehiculosBC();

        se.PLACA                     = txt_placa.Text;
        se.SITE_ID                   = Convert.ToInt32(ddl_site.SelectedValue);
        se.FH_INGRESO                = Convert.ToDateTime(string.Format("{0} {1}", txt_fecha.Text, txt_hora.Text));
        se.CONDUCTOR.NOMBRE          = txt_conductorNombre.Text;
        se.CONDUCTOR.RUT             = txt_conductorRut.Text;
        se.CONDUCTOR.COSE_EXTRANJERO = chk_conductorExtranjero.Checked;
        se.SEEX_ID                   = Convert.ToInt32(ddl_servExt.SelectedValue);
        se.PROV_ID                   = Convert.ToInt32(ddl_prov.SelectedValue);
        se.OBSERVACION               = txt_obs.Text;
        se.USUA_ID                   = usuario.ID;
        if (se.Entrada())
        {
            utils.ShowMessage2(this, "confirmar", "success");
            Limpiar();
        }
        else
        {
            utils.ShowMessage2(this, "confirmar", "error");
        }
    }
예제 #11
0
 public bool Modificar(ServiciosExternosVehiculosBC s)
 {
     return(tran.ServiciosExternosVehiculos_Modificar(s));
 }
예제 #12
0
 public bool Crear(ServiciosExternosVehiculosBC s)
 {
     return(tran.ServiciosExternosVehiculos_Crear(s));
 }
예제 #13
0
 public bool Salida(ServiciosExternosVehiculosBC se)
 {
     return(tran.ServiciosExternosVehiculos_Salida(se));
 }
예제 #14
0
 public bool Entrada(ServiciosExternosVehiculosBC se)
 {
     return(tran.ServiciosExternosVehiculos_Entrada(se));
 }