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; } } } }
protected void BtnBuscarO(object sender, EventArgs e) { Buscadores bus = new Buscadores(); lblmodelo.Text = "La patente ingresada no se encuentra para Cobrar"; lblpatente.Text = "-"; lblprecio.Text = "-"; GridView1.DataSource = null; GridView1.DataBind(); if (txtorden.Value != "") { txtpatente.Visible = false; btnbuscarpatente.Visible = false; foreach (orden oOrden in LOrden) { if (int.Parse(txtorden.Value) == oOrden.id_orden) { Ordenn = oOrden; lblpatente.Text = "PATENTE: " + oOrden.vehiculo.patente; modelo omodelo = bus.buscarmodelo(oOrden.vehiculo); lblmodelo.Text = "MODELO: " + omodelo.nombre; CargarGrid(oOrden); } } } }
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; } }
private void CargarGrid(orden oOrden) { StockError.Visible = false; StockWarning.Visible = false; Buscadores bus = new Buscadores(); List <ordenservicio> Lidservidcios = new List <ordenservicio>(); Lidservidcios = bus.buscarlistaid(oOrden.id_orden); List <servicio> Lservicios = ObtenerServicios(Lidservidcios); List <serviciostock> Lserstock = Lserviciostock(Lservicios); List <stock> Nstock = Lstockuso(Lserstock); foreach (stock ostock in Nstock) { Lstock.Add(ostock); if (int.Parse(ostock.cantidad) <= int.Parse(ostock.minimo)) { StockError.Visible = true; Label1.Text = "¡ATENCION! EL STOCK ES MENOR AL MINIMO: " + ostock.detalle; } if ((int.Parse(ostock.cantidad) >= int.Parse(ostock.minimo)) && (int.Parse(ostock.cantidad) <= (int.Parse(ostock.minimo) + 5)) && (StockError.Visible == false)) { StockWarning.Visible = true; Label2.Text = "¡ATENCION! EL STOCK ESTA CERCANO AL MINIMO: " + ostock.detalle; } } GridView2.DataSource = Lservicios; GridView2.DataBind(); }
public List <serviciostock> Lserviciostock(String id) { Buscadores bus = new Buscadores(); List <serviciostock> Lserviciostocks = bus.Lstockservi(); List <serviciostock> NLserviciostock = new List <serviciostock>(); NLserviciostock = Lserviciostocks.FindAll(s => s.id_servicio == int.Parse(id)); return(NLserviciostock); }
protected void BtnBuscar(object sender, EventArgs e) { Buscadores bus = new Buscadores(); if (txtidorden.Value != "") { orden oOrden = bus.buscarorden(int.Parse(txtidorden.Value)); ordenestado Oordenestado = new ordenestado(); if (oOrden != null) { Oordenestado = bus.buscarvestadoorden(oOrden.id_orden); } if (oOrden != null) { if ((Oordenestado == null) || (Oordenestado.estado == null) || (Oordenestado.estado == 0) || (Oordenestado.estado == 4)) { //Validar orden estado 2 o superior aca? si? NoAuto.Visible = false; vehiculo Ovehiculo = bus.buscarvehiculoid(int.Parse(oOrden.id_vehiculo.ToString())); cliente oCliente = bus.ocliente(Ovehiculo); modelo omodelo = bus.buscarmodelo(Ovehiculo); Ovehiculo.modelo = omodelo; marca omarca = bus.buscarmarca(Ovehiculo.modelo); Ovehiculo.modelo.marca = omarca; Ovehiculo.cliente = oCliente; oOrden.vehiculo = Ovehiculo; txtpatente.Value = oOrden.vehiculo.patente; txtmodelo.Value = oOrden.vehiculo.modelo.nombre; txtmarca.Value = oOrden.vehiculo.modelo.marca.nombre; txtaño.Value = oOrden.vehiculo.annio; string[] separadas; if (Ovehiculo.cliente.dni != null) { separadas = Ovehiculo.cliente.nombre.Split(' '); txtdni.Value = Ovehiculo.cliente.dni; txtapellido.Value = separadas[0]; txtnombre.Value = separadas[1]; txttelefono.Value = Ovehiculo.cliente.telefono; txtemail.Value = Ovehiculo.cliente.email; } OrdenActual = oOrden; CargarGrid(oOrden); } else { Label3.Text = "EL VEHICULO YA POSEE UNA ORDEN ACTIVA"; NoAuto.Visible = true; } } else { Label3.Text = "ORDEN NO EXISTENTE"; NoAuto.Visible = true; } } }
protected void CargarServicios(object sender, EventArgs e) { StockError.Visible = false; StockWarning.Visible = false; List <servicio> Lse = new List <servicio>(); DataTable dt = new DataTable(); Buscadores bus = new Buscadores(); dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Detalle"), new DataColumn("Precio") }); foreach (GridViewRow row in GridView1.Rows) { if (row.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.CheckBox chkRow = (row.Cells[3].FindControl("chkRow") as System.Web.UI.WebControls.CheckBox); if (chkRow.Checked) { string detalle = row.Cells[1].Text; string precio = row.Cells[2].Text; string id = row.Cells[0].Text; int id_servicio = int.Parse(id); List <serviciostock> Lserstock = Lserviciostock(id_servicio.ToString()); List <stock> Nstock = Lstockuso(Lserstock); servicio oservicio = bus.buscarservicio(id_servicio); Lse.Add(oservicio); dt.Rows.Add(detalle, precio); foreach (stock ostock in Nstock) { Lstock.Add(ostock); if (int.Parse(ostock.cantidad) <= int.Parse(ostock.minimo)) { StockError.Visible = true; Label1.Text = "¡ATENCION! EL STOCK ES MENOR AL MINIMO: " + ostock.detalle; } if ((int.Parse(ostock.cantidad) >= int.Parse(ostock.minimo)) && (int.Parse(ostock.cantidad) <= (int.Parse(ostock.minimo) + 5)) && (StockError.Visible == false)) { StockWarning.Visible = true; //Aca alerta queda poco stock Queda restar Label2.Text = "¡ATENCION! EL STOCK ESTA CERCANO AL MINIMO: " + ostock.detalle; } } } } } if (Lse.Count <= 5) { Lservi = Lse; GridView2.DataSource = dt; GridView2.DataBind(); } }
private List <servicio> ObtenerServicios(List <ordenservicio> Lidservidcios) { List <servicio> Lservicio = new List <servicio>(); Buscadores bus = new Buscadores(); foreach (ordenservicio idservicios in Lidservidcios) { servicio oservicio = bus.buscarservicio(idservicios.id_servicio); Lservicio.Add(oservicio); } return(Lservicio); }
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; } } } }
protected void btnLogin_ServerClick(object sender, EventArgs e) { Buscadores bus = new Buscadores(); empleado oempleado = bus.buscarempleado(txtemail.Value); if (oempleado != null) { if (oempleado.contraseña == txtcontraseña.Value) { LogEmpleado = oempleado; Server.Transfer("Login.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (LogEmpleado.id_tipo != 3) { Server.Transfer("Default.aspx"); } Buscadores bus = new Buscadores(); List <ordenestado> Lordenestado = bus.buscarListOrdenEstado(3); List <orden> Lorden = bus.buscarordeestado(Lordenestado); List <vehiculo> LVehiculo = bus.buscarordevehiculo(Lorden); LOrden = Lorden; }
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; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (LogEmpleado.id_tipo != 1) { Server.Transfer("Default.aspx"); } Buscadores bus = new Buscadores(); ordenempleado OrdenEmpleado = bus.buscarempleadoorden(LogEmpleado.id_empleado); if (OrdenEmpleado == null) { lblpatente.Text = "No tienes ningun vehiculo asignado. "; lblmodelo.Text = "-"; btnaceptar.Visible = false; btnfinalizar.Visible = false; } else { int a = int.Parse(OrdenEmpleado.id_orden.ToString()); orden Orden = bus.buscarorden(a); OrdenActual = Orden; vehiculo ovehiculo = bus.buscarvehiculoid(int.Parse(Orden.id_vehiculo.ToString())); modelo omodelo = bus.buscarmodelo(ovehiculo); ordenestado oestado = bus.buscarvestadoorden(Orden.id_orden); List <ordenservicio> Lidservidcios = new List <ordenservicio>(); Lidservidcios = bus.buscarlistaid(Orden.id_orden); CheckBoton(oestado); List <servicio> Lservicios = ObtenerServicios(Lidservidcios); if ((oestado.estado == 1) || (oestado.estado == 2)) { GridView1.DataSource = Lservicios; GridView1.DataBind(); lblpatente.Text = "PATENTE: " + ovehiculo.patente.ToString(); lblmodelo.Text = "MODELO: " + omodelo.nombre.ToString(); } else { lblpatente.Text = "No tienes ningun vehiculo asignado. "; lblmodelo.Text = "-"; btnaceptar.Visible = false; btnfinalizar.Visible = false; } } } }
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 { } } }
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(); } }
private void CargarGrid(orden oOrden) { int a = 0; Buscadores bus = new Buscadores(); List <ordenservicio> Lidservidcios = new List <ordenservicio>(); Lidservidcios = bus.buscarlistaid(oOrden.id_orden); List <servicio> Lservicios = ObtenerServicios(Lidservidcios); foreach (servicio x in Lservicios) { a = a + int.Parse(x.precio); } lblprecio.Text = "PRECIO TOTAL: " + a; GridView1.DataSource = Lservicios; GridView1.DataBind(); }
public List <serviciostock> Lserviciostock(List <servicio> Lservicios) { Buscadores bus = new Buscadores(); List <serviciostock> Lserviciostocks = bus.Lstockservi(); List <serviciostock> NLserviciostock = new List <serviciostock>(); foreach (servicio x in Lservicios) { foreach (serviciostock t in Lserviciostocks) { if (x.id_servicios == t.id_servicio) { NLserviciostock.Add(t); } } } return(NLserviciostock); }
public List <stock> Lstockuso(List <serviciostock> Lstockservi) { Buscadores bus = new Buscadores(); List <stock> Lstock = bus.Lstock(); List <stock> stockactivo = new List <stock>(); foreach (stock Stock in Lstock) { foreach (serviciostock Servistock in Lstockservi) { if (Stock.id_stock == Servistock.id_stock) { stockactivo.Add(Stock); } } } return(stockactivo); }
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(); } } }
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; }
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"); } }