Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Bantesco.net

260 views

Published on

BANTESCO

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Bantesco.net

  1. 1. BANTESCO.NETBiblioteca de clase.using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Data;namespace WepTesco{publicclassCliente{publicint Cuenta;publicstring Nombre;publicstring Appaterno;publicstring Apmaterno;publicstring Ife;publicstring Rfc;publicstring Genero;publicstring Calle;publicstring Interior;publicstring Colonia;publicstring Ciudad;publicstring Telefono;publicstring CodigoPostal;public Cliente(){}public Cliente(int idcuenta1, string nombre1, string apellidopaterno1,string apellidomaterno1, string calle1,string interior1, string ife1,string rfc1, string genero1, string ciudad1, string colonia1, stringtelefono1, string cp1){Cuenta = idcuenta1;Nombre = nombre1;Appaterno = apellidopaterno1;Apmaterno= apellidomaterno1;Calle = calle1;Interior = interior1;Ife = ife1;Rfc = rfc1;Genero = genero1;Ciudad = ciudad1;Colonia = colonia1;Telefono = telefono1;CodigoPostal = cp1;}publicDataSet Consulta_Personal(string cadenaconexion){DataSet ds = newDataSet();SqlConnection conexion = newSqlConnection(cadenaconexion);
  2. 2. string consultaSQL = "exec pa_ConsultarCliente";SqlCommand comando = newSqlCommand(consultaSQL, conexion);SqlDataAdapter da = newSqlDataAdapter(comando);conexion.Open();da.Fill(ds);conexion.Close();return ds;}publicint RegistrarClientes(string cadenaconexion){SqlConnection conexion = newSqlConnection(cadenaconexion);string consultaSQL = "exec pa_RegistrarCliente " + this.Nombre + "," +this.Appaterno + "," + this.Apmaterno + "," + this.Ife + "," +this.Genero + "," + this.Calle + "," + this.Interior + "," +this.Colonia + "," + this.Ciudad + "," + this.CodigoPostal + "," +this.Telefono + "," + this.Rfc + "";SqlCommand comando = newSqlCommand(consultaSQL, conexion);conexion.Open();int res = comando.ExecuteNonQuery();conexion.Close();return res;}publicint ModificarClientes(string cadenaconexion){SqlConnection conexion = newSqlConnection(cadenaconexion);string consultaSQL = "exec pa_ModificarCliente "+this.Cuenta+","+this.Nombre + "," + this.Appaterno + "," + this.Apmaterno + "," +this.Ife + "," + this.Genero + "," + this.Calle + "," +this.Interior + "," + this.Colonia + "," + this.Ciudad + "," +this.CodigoPostal + "," + this.Telefono + "," + this.Rfc + "";SqlCommand comando = newSqlCommand(consultaSQL, conexion);conexion.Open();int res = comando.ExecuteNonQuery();conexion.Close();return res;}publicint EliminarClientes(string cadenaconexion, int Cuenta){SqlConnection conexion = newSqlConnection(cadenaconexion);string ConsultaSQL = "EXEC pa_EliminarCliente " + Cuenta.ToString();SqlCommand comando = newSqlCommand(ConsultaSQL, conexion);conexion.Open();int res = comando.ExecuteNonQuery();return res;}}}
  3. 3. Form consultar clientes.using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using WepTesco;using System.Web.Configuration;namespace BancoWeb{publicpartialclassConsultaClientes : System.Web.UI.Page{protectedvoid Page_Load(object sender, EventArgs e){}protectedvoid btnConsultar_Click(object sender, EventArgs e){Cliente mipersonal = newCliente();DataSet ds = newDataSet();string cadenaconexion =WebConfigurationManager.ConnectionStrings["cadcon"].ConnectionString;ds = mipersonal.Consulta_Personal(cadenaconexion);clientes.DataSource = ds;clientes.DataBind();}protectedvoid clientes_SelectedIndexChanged(object sender, EventArgs e){int fila = clientes.SelectedIndex;string Cuenta = clientes.Rows[fila].Cells[1].Text;Session.Add("Cuenta", Cuenta);}protectedvoid btnEliminar_Click(object sender, EventArgs e){Cliente mipersona = newCliente();string cadenaconexion =WebConfigurationManager.ConnectionStrings["cadcon"].ConnectionString;int Cuenta = Convert.ToInt32(Session["Cuenta"].ToString());mipersona.EliminarClientes(cadenaconexion, Cuenta);}}}Form modifcar,eliminar,registrar clientes.
  4. 4. using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using WepTesco;using System.Web.Configuration;namespace BancoWeb{publicpartialclassRegistrarCliente : System.Web.UI.Page{protectedvoid Page_Load(object sender, EventArgs e){carga_datos();}protectedvoid TextBox1_TextChanged(object sender, EventArgs e){}protectedvoid TextBox2_TextChanged(object sender, EventArgs e){}protectedvoid btnRegistrar_Click(object sender, EventArgs e){string nombre = txtnombre.Text;string paterno = txtapp.Text;string materno = txtapm.Text;string Calle = txtcal.Text;string Interior = txtint.Text;string Ife = txtife.Text;string Rfc = txtrfc.Text;string Genero = txtgen.Text;string Ciudad = txtciu.Text;string Colonia = txtcol.Text;string Telefono = txttel.Text;string CodigoPostal = txtcp.Text;string cadenaconexion =WebConfigurationManager.ConnectionStrings["cadcon"].ConnectionString;Cliente mipersonal = newCliente(0, nombre, paterno, materno,Calle,Interior, Ife, Rfc, Genero, Ciudad, Colonia,Telefono,CodigoPostal);int res = mipersonal.RegistrarClientes(cadenaconexion);}
  5. 5. protectedvoid Button1_Click(object sender, EventArgs e){int cuentaentero=0;string id = txtid.Text;string nombre = txtnombre.Text;string paterno = txtapp.Text;string materno = txtapm.Text;string Calle = txtcal.Text;string Interior = txtint.Text;string Ife = txtife.Text;string Rfc = txtrfc.Text;string Genero = txtgen.Text;string Ciudad = txtciu.Text;string Colonia = txtcol.Text;string Telefono = txttel.Text;string CodigoPostal = txtcp.Text;cuentaentero=int.Parse(id);string cadenaconexion =WebConfigurationManager.ConnectionStrings["cadcon"].ConnectionString;Cliente mipersonal = newCliente(cuentaentero, nombre, paterno, materno,Calle,Interior, Ife, Rfc, Genero, Ciudad, Colonia,Telefono,CodigoPostal);int mod = mipersonal.ModificarClientes(cadenaconexion);}publicvoid carga_datos(){Cliente mipersonal = newCliente();DataSet ds = newDataSet();string cadenaconexion =WebConfigurationManager.ConnectionStrings["cadcon"].ConnectionString;ds = mipersonal.Consulta_Personal(cadenaconexion);listaid.DataSource = ds.Tables[0];listaid.DataTextField = "Cuenta";listaid.DataBind();}protectedvoid btnModifica_Click(object sender, EventArgs e){int id = Convert.ToInt32(listaid.Text);string nombre = txtnombre.Text;string paterno = txtapp.Text;string materno = txtapm.Text;string Calle = txtcal.Text;string Interior = txtint.Text;string Ife = txtife.Text;string Rfc = txtrfc.Text;string Genero = txtgen.Text;
  6. 6. string Ciudad = txtciu.Text;string Colonia = txtcol.Text;string Telefono = txttel.Text;string CodigoPostal = txtcp.Text;string cadenaconexion =WebConfigurationManager.ConnectionStrings["cadcon"].ConnectionString;Cliente mipersonal = newCliente(id,nombre, paterno, materno, Calle,Interior, Ife, Rfc, Genero, Ciudad, Colonia, Telefono, CodigoPostal);int res = mipersonal.ModificarClientes(cadenaconexion);}}}
  7. 7. Vista form consulta clientes.
  8. 8. VISTA FORM ADMINISTRAR CLIENTES.

×