예제 #1
0
        public void RecargarAuto()
        {
            Buscadores bus = new Buscadores();
            string     a   = txtpatente.Value;

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                vehiculo objvehiculo = bus.buscarvehiculo(a);
                if (objvehiculo != null)
                {
                    txtpatente.Disabled = true;
                    cliente objcliente = bus.ocliente(objvehiculo);
                    modelo  objmodelo  = bus.buscarmodelo(objvehiculo);
                    txtaño.Value    = objvehiculo.annio;
                    txtmodelo.Value = objmodelo.nombre;
                    txtmarca.Value  = bus.buscarmarca(objmodelo).nombre.ToString();
                    string[] separadas;
                    if (objcliente.dni != null)
                    {
                        separadas         = objcliente.nombre.Split(' ');
                        txtdni.Value      = objcliente.dni;
                        txtapellido.Value = separadas[0];
                        txtnombre.Value   = separadas[1];
                        txttelefono.Value = objcliente.telefono;
                        txtemail.Value    = objcliente.email;
                    }
                }
            }
        }
예제 #2
0
        private void CargarOrden()
        {
            Buscadores bus       = new Buscadores();
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                orden oorden = new orden
                {
                    id_vehiculo = ovehiculo.id_vehiculo,
                };
                DBF.orden.Add(oorden);
                DBF.SaveChanges();
                ordenestado oOrdenEstado = new ordenestado
                {
                    id_orden = oorden.id_orden,
                    estado   = 0,
                    fecha    = System.DateTime.Now
                };
                DBF.ordenestado.Add(oOrdenEstado);
                DBF.SaveChanges();
                foreach (servicio l in Lservi)
                {
                    ordenservicio ooServicio = new ordenservicio
                    {
                        id_orden    = oorden.id_orden,
                        id_servicio = l.id_servicios
                    };

                    DBF.ordenservicio.Add(ooServicio);
                    DBF.SaveChanges();
                }
                OrdenActual = oorden;
            }
        }
예제 #3
0
        protected void CargaryAvanzar(object sender, EventArgs e)
        {
            Buscadores bus       = new Buscadores();
            cliente    ocliente  = bus.oclientedni(txtdni.Value);
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);

            if (ovehiculo == null)
            {
                GuardarVehiculo();
            }
            ovehiculo = bus.buscarvehiculo(txtpatente.Value);
            cliente oclientes = bus.ocliente(ovehiculo);

            if ((ovehiculo.id_cliente == null) || (ocliente == null) || (ocliente.dni != oclientes.dni))
            {
                GuardarCambiodecliente();
            }
            EstadoOriginal();
            VerGrid();
            btnServicios.Visible = true;
        }
예제 #4
0
        protected void BuscarCliente(object sender, EventArgs e)
        {
            Buscadores bus       = new Buscadores();
            cliente    ocliente  = bus.oclientedni(txtdni.Value);
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
            cliente    oclientes = new cliente();

            if (ovehiculo != null)
            {
                oclientes = bus.ocliente(ovehiculo);
            }
            else
            {
                oclientes.id = 0;
            }
            if ((ocliente == null) || (ocliente.dni != oclientes.dni))
            {
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    if (ocliente != null)
                    {
                        string[] separadas;
                        separadas            = ocliente.nombre.Split(' ');
                        txtdni.Value         = ocliente.dni;
                        txtapellido.Value    = separadas[0];
                        txtnombre.Value      = separadas[1];
                        txttelefono.Value    = ocliente.telefono;
                        txtemail.Value       = ocliente.email;
                        txtapellido.Disabled = true;
                        txtnombre.Disabled   = true;
                        txttelefono.Disabled = true;
                        txtemail.Disabled    = true;
                        btnGuardar.Visible   = true;
                    }
                    else
                    {
                        txtapellido.Disabled = false;
                        txtnombre.Disabled   = false;
                        txttelefono.Disabled = false;
                        txtemail.Disabled    = false;
                        txtapellido.Value    = "";
                        txtnombre.Value      = "";
                        txttelefono.Value    = "";
                        txtemail.Value       = "";
                        txtpatente.Disabled  = true;
                        btnGuardar.Visible   = true;
                    }
                }
            }
        }
예제 #5
0
        protected void Unnamed_ServerClick1(object sender, EventArgs e)
        {
            Buscadores bus = new Buscadores();
            string     a   = txtpatente.Value;

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                vehiculo objvehiculo = bus.buscarvehiculo(a);
                if (objvehiculo != null)
                {
                    ordenestado ordenestado = new ordenestado();
                    orden       orden       = bus.buscarordenporvehiculo(objvehiculo.id_vehiculo);
                    if (orden != null)
                    {
                        ordenestado = bus.buscarvestadoorden(orden.id_orden);
                    }
                    if ((orden == null) || (ordenestado.estado == null) || (ordenestado.estado == 4))
                    {
                        NoAuto.Visible = false;
                        RecargarAuto();
                        VerGrid();
                        A1.Visible           = true;
                        btnServicios.Visible = true;
                    }
                    else
                    {
                        Label3.Text    = "EL VEHICULO YA POSEE UNA ORDEN ACTIVA";
                        NoAuto.Visible = true;
                    }
                }
                else
                {
                    NoAuto.Visible = true;
                    Label3.Text    = "PONER ENTRE DE 6 Y 7 CARACTERES";
                    int b = txtpatente.Value.Length;
                    if (b >= 6 && b <= 7)
                    {
                        NoAuto.Visible            = false;
                        Dmodelo.Visible           = true;
                        modelito.Visible          = true;
                        txtmodelo.Visible         = false;
                        txtmarca.Visible          = false;
                        btnAgregarcliente.Visible = true;
                        txtaño.Disabled           = false;
                        btnGuardar.Visible        = Visible;
                    }
                }
            }
        }
예제 #6
0
 protected void Avanzar(object sender, EventArgs e)
 {
     if ((txtpatente.Value != "") && (txtdni.Value != "") && (StockError.Visible == false))
     {
         Buscadores bus       = new Buscadores();
         cliente    ocliente  = bus.oclientedni(txtdni.Value);
         vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
         cliente    oclientes = bus.ocliente(ovehiculo);
         if ((ovehiculo != null) && (ovehiculo.id_cliente != null) && (ocliente != null) && (ovehiculo.id_cliente == ocliente.id))
         {
             Server.Transfer("DetalleTaller.aspx");
         }
         else
         {
         }
     }
 }
예제 #7
0
        public void VerGrid()
        {
            List <servicio> Lservicios;

            using (aplicadaBDEntities DBF = new aplicadaBDEntities())
            {
                IQueryable <servicio> lista = (from q in DBF.servicio select q);
                Lservicios = lista.ToList();
                Buscadores bus         = new Buscadores();
                string     a           = txtpatente.Value;
                vehiculo   objvehiculo = bus.buscarvehiculo(a);
                modelo     objmodelo   = bus.buscarmodelo(objvehiculo);
                Lservicios           = Lservicios.FindAll(ser => ser.id_modelo == objmodelo.id_modelo);
                GridView1.DataSource = Lservicios;
                GridView1.DataBind();
            }
        }
예제 #8
0
        private void GuardarCambiodecliente()
        {
            Buscadores bus       = new Buscadores();
            vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
            cliente    ocliente  = bus.ocliente(ovehiculo);
            cliente    oclientes = bus.oclientedni(txtdni.Value);

            btnGuardar.Visible = false;
            if ((ocliente != null) && (oclientes != null))
            {
                ocliente = bus.oclientedni(txtdni.Value);
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    vehiculo oVehiculo = (from q in DBF.vehiculo where q.id_vehiculo == ovehiculo.id_vehiculo select q).First();
                    oVehiculo.id_cliente = ocliente.id;
                    DBF.SaveChanges();
                }
            }
            else
            {
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    cliente ncliente = new cliente
                    {
                        dni      = txtdni.Value,
                        nombre   = txtapellido.Value + " " + txtnombre.Value,
                        telefono = txttelefono.Value,
                        email    = txtemail.Value,
                    };
                    DBF.cliente.Add(ncliente);
                    DBF.SaveChanges();
                }
                ocliente = bus.oclientedni(txtdni.Value);
                using (aplicadaBDEntities DBF = new aplicadaBDEntities())
                {
                    vehiculo oVehiculo = (from q in DBF.vehiculo where q.id_vehiculo == ovehiculo.id_vehiculo select q).First();
                    oVehiculo.id_cliente = ocliente.id;
                    DBF.SaveChanges();
                }
            }
        }
예제 #9
0
 protected void Avanzar(object sender, EventArgs e)
 {
     if ((txtpatente.Value != "") && (txtdni.Value != "") && (StockError.Visible = true))
     {
         Buscadores bus       = new Buscadores();
         cliente    ocliente  = bus.oclientedni(txtdni.Value);
         vehiculo   ovehiculo = bus.buscarvehiculo(txtpatente.Value);
         cliente    oclientes = bus.ocliente(ovehiculo);
         if ((ovehiculo != null) && (ovehiculo.id_cliente != null) && (ocliente != null) && (ovehiculo.id_cliente == ocliente.id) && (Lservi.Count <= 5) && (Lservi.Count >= 1))
         {
             CargarOrden();
             Server.Transfer("DetalleTaller.aspx");
         }
         else
         {
             Server.Transfer("NuevoDetalle.aspx");
         }
     }
     else
     {
         Server.Transfer("NuevoDetalle.aspx");
     }
 }