protected void Button1_Click1(object sender, EventArgs e) { ButtonRegista.Enabled = false; VerTodos.Enabled = false; try { string ESPECIFICO = "select * from dbo.buses where Clave='" + TextClave.Text + "'"; ServiceConexionB.IServicioBusClient WS = new ServiceConexionB.IServicioBusClient(); DataSet data1 = WS.GetBusEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); DropProvincia.Text = TextMostrar.Rows[0].Cells[1].Text; TextRuta.Text = TextMostrar.Rows[0].Cells[2].Text; DropInscrito.Text = TextMostrar.Rows[0].Cells[3].Text; DropAutorizado.Text = TextMostrar.Rows[0].Cells[4].Text; TextPaSentados.Text = TextMostrar.Rows[0].Cells[5].Text; TextPaPie.Text = TextMostrar.Rows[0].Cells[6].Text; ResultadoOperacion.Text = "-Bus encontrado \n -Puede editar datos en espacios luego pinche boton 'EDITAR'"; } catch (Exception r) { ResultadoOperacion.Text = "No existe ID"; }; }
protected void Button1_Click(object sender, EventArgs e) { validar(); TextClave.Text.ToUpper(); if (completado == true) { String Editar = "UPDATE dbo.product SET descripcion='" + TextDescripcion.Text + "', precio =" + precio + ", rentabilidad = " + rentabilidad + " where id='" + TextClave.Text + "'"; ServiceE.IIEditarClient WD = new ServiceE.IIEditarClient(); DataSet data = WD.EditDataProduct(Editar); string ESPECIFICO = "select * from dbo.product where id='" + TextClave.Text + "'"; ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient(); DataSet data1 = WS.GetEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Actualizado \n exitosamente"; vaciarDatos(); } else { ResultadoOperacion.Text = negativo; } }
protected void Button1_Click(object sender, EventArgs e) { Button1.Enabled = true; ButtonRegista.Enabled = true; VerTodos.Enabled = true; Editar.Enabled = true; correcto = true; validar(); TextClave.Text.ToUpper(); if (correcto == true) { String Editar = "UPDATE dbo.buses SET Clave ='" + TextClave.Text + "', Provincia ='" + provincia + "', Ruta = '" + ruta + "', Inscrito = '" + inscrito + "', Autorizado = '" + autorizado + "', Sentados = '" + pasajeroSentados.ToString() + "', Pie = '" + pasajerosPie.ToString() + "' WHERE Clave = '" + TextClave.Text + "'"; ServiceConexionB.IServicioBusClient WD = new ServiceConexionB.IServicioBusClient(); DataSet data = WD.EditDataBus(Editar); string ESPECIFICO = "select * from dbo.buses where Clave='" + TextClave.Text + "'"; ServiceConexionB.IServicioBusClient WS = new ServiceConexionB.IServicioBusClient(); DataSet data1 = WS.GetBusEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Actualizado \n exitosamente"; vaciarDatos(); } else { ResultadoOperacion.Text = "Datos erroneos"; } }
protected void VerTodos_Click(object sender, EventArgs e) { ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient(); DataSet data1 = WS.GetAll(); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Todos los \nproductos mostrados"; }
protected void ButtonRegista_Click(object sender, EventArgs e) { validar(); if (correcto == true) { Boolean terminar = true; do { try { int longitud = 7; const string alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; String token = ""; Random rnd = new Random(); for (int i = 0; i < longitud; i++) { int indice = rnd.Next(alfabeto.Length); token += alfabeto[indice]; } String LLENAR = "INSERT dbo.buses(Clave,Provincia, Ruta, Inscrito, Autorizado, Sentados, Pie)values('"; LLENAR += token + "'," + "'" + provincia + "'," + "'" + ruta + "'," + "'" + inscrito + "'," + "'" + autorizado + "'," + "'" + pasajeroSentados.ToString() + "'," + "'" + pasajerosPie.ToString() + "')"; ServiceConexionB.IServicioBusClient WD = new ServiceConexionB.IServicioBusClient(); DataSet data = WD.FillDataBus(LLENAR); string ESPECIFICO = "select * from dbo.buses where Clave='" + token + "'"; ServiceConexionB.IServicioBusClient WS = new ServiceConexionB.IServicioBusClient(); DataSet data1 = WS.GetBusEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); terminar = true; } catch (Exception h) { terminar = false; throw new Exception(h.ToString()); } } while (terminar == false); ResultadoOperacion.Text = "Agregado exitosamente"; vaciarDatos(); } else { ResultadoOperacion.Text = "Datos erroneos"; } }
protected void ButtonRegistra_Click(object sender, EventArgs e) { validar(); if (completado == true) { Boolean terminar = true; do { try { int longitud = 7; const string alfabeto = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; String token = ""; Random rnd = new Random(); for (int i = 0; i < longitud; i++) { int indice = rnd.Next(alfabeto.Length); token += alfabeto[indice]; } String LLENAR = "INSERT INTO dbo.ruta(Clave, Provincia, IniRuta, FinRuta, Rural, Km)values('"; LLENAR += token + "'," + "'" + provincia + "'," + "'" + inicioR + "'," + "'" + finR + "'," + "'" + rural + "'," + kilometros + ")"; ServiceConexionR.ServiciosRutasClient WD = new ServiceConexionR.ServiciosRutasClient(); DataSet data = WD.FillDataRuta(LLENAR); string ESPECIFICO = "select * from dbo.ruta where Clave='" + token + "'"; ServiceConexionR.ServiciosRutasClient WS = new ServiceConexionR.ServiciosRutasClient(); DataSet data1 = WS.GetRutaEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); terminar = true; } catch (Exception h) { terminar = false; throw new Exception(h.ToString()); } } while (terminar == false); ResultadoOperacion.Text = "Agregado exitosamente"; vaciarDatos(); } else { ResultadoOperacion.Text = "Datos erroneos"; } }
protected void Button1_Click(object sender, EventArgs e) { try { String ProvinciaBuscar = "SELECT * FROM dbo.ruta where Provincia='" + DropProvinicia.Text + "'"; ServiceConexionR.ServiciosRutasClient WS = new ServiceConexionR.ServiciosRutasClient(); DataSet data = WS.GetRutaEspecifico(ProvinciaBuscar); TextMostrar.DataSource = data.Tables[0]; TextMostrar.DataBind(); mensaje.Text = "Rutas encontradas en provincia: " + DropProvinicia.Text; }catch (Exception) { mensaje.Text = "Existe algun Error"; } }
protected void VerTodos_Click(object sender, EventArgs e) { Button1.Enabled = true; ButtonRegista.Enabled = true; VerTodos.Enabled = true; Editar.Enabled = true; ServiceConexionB.IServicioBusClient WS = new ServiceConexionB.IServicioBusClient(); DataSet data1 = WS.GetAllBusesData(); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Todos los \nbuses mostrados"; }
protected void Page_Load(object sender, EventArgs e) { ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient(); DataSet data1 = WS.GetAll(); int mayor = TextMostrar.Rows.Count; if (mayor >= 0) { TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Mostrando todos \n los productos"; } else { ResultadoOperacion.Text = "Base de datos \n vacia"; } }
protected void VerTodos_Click(object sender, EventArgs e) { ServiceConexionR.ServiciosRutasClient WD = new ServiceConexionR.ServiciosRutasClient(); DataSet data = WD.GetAllRuta(); int mayor = TextMostrar.Rows.Count; if (mayor >= 0) { TextMostrar.DataSource = data.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Mostrando todos \n los buses"; } else { ResultadoOperacion.Text = "Base de datos \n vacia"; } }
protected void Button1_Click(object sender, EventArgs e) { try { string instruccionLlenar = "select * from dbo.product"; SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Data Source=PROGRA-14\\MSSQLSERVER01;Initial Catalog=PRODUCTOS;Integrated Security=True"; SqlDataAdapter llamadoLenar = new SqlDataAdapter(instruccionLlenar, conn); DataSet datasetLLamado = new DataSet(); llamadoLenar.Fill(datasetLLamado); TextMostrar.DataSource = datasetLLamado.Tables[0]; TextMostrar.DataBind(); mensaje.Text = "Productos encontradas "; } catch (Exception) { mensaje.Text = "Existe algun Error"; } }
protected void Button1_Click1(object sender, EventArgs e) { VerTodos.Enabled = false; try { string ESPECIFICO = "select * from dbo.product where id='" + TextClave.Text + "'"; ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient(); DataSet data1 = WS.GetEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); TextDescripcion.Text = TextMostrar.Rows[0].Cells[1].Text; TextPrecio.Text = TextMostrar.Rows[0].Cells[2].Text; DropProvincia.Text = TextMostrar.Rows[0].Cells[3].Text; ResultadoOperacion.Text += "-Producto encontrado \n -Puede editar datos en espacios luego pinche boton 'EDITAR'"; } catch (Exception r) { ResultadoOperacion.Text = "No existe ID"; }; }
protected void ButtonRegistra_Click1(object sender, EventArgs e) { validar(); if (completado == true) { Boolean terminar = true; do { try { String LLENAR = "INSERT INTO dbo.product(descripcion,precio, rentabilidad)values('" + descripcion + "'," + precio + "," + rentabilidad + ")"; ServiceA.IAgregarClient WD = new ServiceA.IAgregarClient(); DataSet data = WD.FillDataProduct(LLENAR); string ESPECIFICO = "select * from dbo.product where descripcion='" + descripcion + "' and precio=" + precio + "and rentabilidad=" + rentabilidad; ServiceB.IBuscarClient WS = new ServiceB.IBuscarClient(); DataSet data1 = WS.GetEspecifico(ESPECIFICO); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); terminar = true; } catch (Exception h) { terminar = false; throw new Exception(h.ToString()); } } while (terminar == false); ResultadoOperacion.Text = "Agregado exitosamente"; vaciarDatos(); } else { ResultadoOperacion.Text = "Datos erroneos"; ResultadoOperacion.Text += negativo; } }
protected void ButtonElimina_Click(object sender, EventArgs e) { try { string ELIMINAR = "DELETE FROM dbo.ruta WHERE Clave='" + TextClave.Text + "'"; ServiceConexionR.ServiciosRutasClient WD = new ServiceConexionR.ServiciosRutasClient(); DataSet data = WD.EraseDataRuta(ELIMINAR); ServiceConexionR.ServiciosRutasClient WS = new ServiceConexionR.ServiciosRutasClient(); DataSet data1 = WS.GetAllRuta(); TextMostrar.DataSource = data1.Tables[0]; TextMostrar.DataBind(); ResultadoOperacion.Text = "Eliminacion ruta completa"; vaciarDatos(); } catch (Exception d) { ResultadoOperacion.Text += "No existe esa ruta"; } }