public EntidadCliente ObtenerClienteSinFicha(string pCedCliente) { using (SqlConnection conexion = ConexionBD.ObtenerConexion()) { EntidadCliente pCliente = new EntidadCliente(); SqlCommand comando = new SqlCommand(string.Format( "Select Identificacion ,PrimerNombreCliente,SegundoNombreCliente, PrimerApellidoCliente , SegundoApellidoCliente , TipoIdentificacion, Telefono, Celular,Email, Clasificacion from Clientes where Identificacion= {0}", pCedCliente), conexion); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { pCliente.Identificacion = reader.GetString(0); pCliente.PrimerNombreCliente = reader.GetString(1); pCliente.SegundoNombreCliente = reader.GetString(2); pCliente.PrimerApellidoCliente = reader.GetString(3); pCliente.SegundoApellidoCliente = reader.GetString(4); pCliente.TipoIdentificacion = reader.GetString(5); pCliente.Telefono = reader.GetString(6); pCliente.Celular = reader.GetString(7); pCliente.Email = reader.GetString(8); pCliente.TipoCliente = reader.GetString(9); } conexion.Close(); return(pCliente); } }
/*Este método se encarga de la inserción de un proyecto, recibe como parámetro una entidad de proyecto y una entidad de cliente. Retorna un resultado de éxito en caso * de realizar una inserción correcta, o un mensaje error en caso de una inserción incorrecta*/ public String[] insertarProyecto(EntidadProyecto proyectoNuevo, EntidadCliente cliente) { String[] resultado = new String[1]; try { int idProy; //se llama al dataSet de proyectos para insertar el proyecto nuevo this.adapProyecto.InsertProyecto(proyectoNuevo.Nombre, proyectoNuevo.Objetivos, proyectoNuevo.Estado, proyectoNuevo.FechaIni, proyectoNuevo.FechaFin, proyectoNuevo.FechaAsig, proyectoNuevo.Lider); idProy = Int32.Parse(this.adapProyecto.getIdProyecto(proyectoNuevo.Nombre).ToString()); this.adapClient.InsertarCliente(idProy, cliente.Nombre, cliente.Telefono, cliente.Celular, cliente.Oficina, cliente.Correo); resultado[0] = "Exito"; } catch (SqlException e) { int n = e.Number; if (n == 2627) { resultado[0] = "Error"; } else { resultado[0] = "Error"; } } return(resultado); }
public static List <EntidadCliente> BuscarCliente(string pNumCed) { List <EntidadCliente> Lista = new List <EntidadCliente>(); using (SqlConnection conexion = ConexionBD.ObtenerConexion()) { EntidadUsuario us = new EntidadUsuario(); EntidadCliente pCliente = new EntidadCliente(); SqlCommand comando = new SqlCommand(string.Format( "Select IdentificacionCliente,FechaLlamada ,DetalleSeguimientoLlamada,Usuario, MedioContacto from TblSeguimientoCliente where IdentificacionCliente= {0}", pNumCed), conexion); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { pCliente.Identificacion = reader.GetString(0); pCliente.FechaProximaLlamada = reader.GetString(1); pCliente.DetalleSeguimiento = reader.GetString(2); us.Usuario = reader.GetString(3); pCliente.MedioContactoDelCliente = reader.GetString(4); Lista.Add(pCliente); } conexion.Close(); return(Lista); } }
public static void CrearCliente(EntidadCliente oCliente) { using (var db = new AplicacionVentasContext()) { db.Clientes.Add(oCliente); db.SaveChanges(); } }
//void conexion() //{ // try // { // conex = @"Server=db4free.net; Database=nervsystem; Uid=administrador; Pwd=e8b7e1e4; Port=3306"; // conectar = new MySqlConnection(conex); // conectar.Open(); // MessageBox.Show("La conexion ha iniciado"); // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // } //} public int AgregarCliente(EntidadCliente EC) { conectar.Open(); MySqlCommand cmd = new MySqlCommand("AgregarCliente", conectar); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new MySqlParameter("@cla", EC.Clave_Cliente)); cmd.Parameters.Add(new MySqlParameter("@nom", EC.Nombre_Cliente)); cmd.Parameters.Add(new MySqlParameter("@tel", EC.Telefono_Cliente)); int resultado = (int)cmd.ExecuteNonQuery(); conectar.Close(); return(resultado); }
public static int AgregarSeguimiento(EntidadCliente cli, EntidadUsuario us) { int retorno = 0; using (SqlConnection Conn = ConexionBD.ObtenerConexion()) { SqlCommand Comando = new SqlCommand(string.Format("Insert Into TblSeguimientoCliente (IdentificacionCliente,FechaLlamada , DetalleSeguimientoLlamada , Usuario, MedioContacto, NoLLamar) values ('{0}', '{1}','{2}','{3}', '{4}', '{5}')", cli.Identificacion, cli.FechaProximaLlamada, cli.DetalleSeguimiento, us.Usuario, cli.MedioContactoDelCliente, cli.NoLlamarCliente), Conn); retorno = Comando.ExecuteNonQuery(); Conn.Close(); } return(retorno); }
public static int AgregarNuevoCliente(EntidadCliente cli) { int retorno = 0; using (SqlConnection Conn = ConexionBD.ObtenerConexion()) { SqlCommand Comando = new SqlCommand(string.Format("Insert Into Clientes (Identificacion,PrimerNombreCliente , SegundoNombreCliente , PrimerApellidoCliente , SegundoApellidoCliente , TipoIdentificacion , Telefono ,Celular ,Email ,Clasificacion) values ({0}, '{1}','{2}','{3}','{4}','{5}', {6},{7},'{8}', '{9}')", cli.Identificacion, cli.PrimerNombreCliente, cli.SegundoNombreCliente, cli.PrimerApellidoCliente, cli.SegundoApellidoCliente, cli.TipoIdentificacion, cli.Telefono, cli.Celular, cli.Email, cli.Clasificacion), Conn); retorno = Comando.ExecuteNonQuery(); Conn.Close(); } return(retorno); }
public EntidadCliente ObtenerClienteConFicha(string pCedCliente) { using (SqlConnection conexion = ConexionBD.ObtenerConexion()) { EntidadCliente pCliente = new EntidadCliente(); SqlCommand comando = new SqlCommand(string.Format( "Select Identificacion ,PrimerNombreCliente,SegundoNombreCliente, PrimerApellidoCliente , SegundoApellidoCliente , TipoIdentificacion, Telefono, Celular,Email, Clasificacion, FechaNacimiento,Edad, Genero,EstadoCivil,Nacionalidad,DireccionResidencia,Ciudad,ActividadActual, AsesorAsignado,NombreConyugue,ApellidosConyugue,FechaNacimientoConyugue,EdadConyugue,ProfesionConyugue,NumeroPasaporte,FechaVencimientoPasaporte,VisaVigente from Clientes where Identificacion= {0}", pCedCliente), conexion); SqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { pCliente.Identificacion = reader.GetString(0); pCliente.PrimerNombreCliente = reader.GetString(1); pCliente.SegundoNombreCliente = reader.GetString(2); pCliente.PrimerApellidoCliente = reader.GetString(3); pCliente.SegundoApellidoCliente = reader.GetString(4); pCliente.TipoIdentificacion = reader.GetString(5); pCliente.Telefono = reader.GetString(6); pCliente.Celular = reader.GetString(7); pCliente.Email = reader.GetString(8); pCliente.TipoCliente = reader.GetString(9); pCliente.FechaNacimiento = reader.GetString(10); pCliente.Edad = reader.GetInt32(11); pCliente.Genero = reader.GetString(12); pCliente.EstadoCivil = reader.GetString(13); pCliente.Nacionalidad = reader.GetString(14); pCliente.DireccionResidencia = reader.GetString(15); pCliente.Ciudad = reader.GetString(16); pCliente.ActividadActual = reader.GetString(17); pCliente.AsesorAsignado = reader.GetString(18); pCliente.NombreConyugue = reader.GetString(19); pCliente.ApellidosConyugue = reader.GetString(20); pCliente.FechaNacimientoConyugue = reader.GetString(21); pCliente.EdadConyugue = reader.GetString(22); pCliente.ProfesionConyugue = reader.GetString(23); pCliente.NumeroPasaporte = reader.GetString(24); pCliente.FechaVencimientoPasaporte = reader.GetString(25); pCliente.VisaVigente = reader.GetString(26); //pCliente.NoLlamarCliente = reader.GetString(27); //pCliente.MedioContactoDelCliente = reader.GetString(28); //pCliente.DetalleSeguimiento = reader.GetString(29); //pCliente.FechaProximaLlamada = reader.GetString(30); } conexion.Close(); return(pCliente); } }
/*Este método se encarga de retornar los datos del cliente asignado a un proyecto. Recibe como parámetro el id del proyecto.*/ public EntidadCliente consultarCliente(int idProy) { EntidadCliente cliente = null; //para encpasular los datos consultados. Object[] datosConsultados = new Object[5]; //para guardar los datos obtenidos de la consulta temporalmente DataTable filaCliente = controladoraBDProyecto.consultarCliente(idProy); if (filaCliente.Rows.Count == 1) //se recorre el dataTable de clientes tomando los datos de los proyectos { // si hay un valor for (int i = 2; i < 7; i++) { datosConsultados[i - 2] = filaCliente.Rows[0][i].ToString(); } cliente = new EntidadCliente(datosConsultados); //se encapsulan los datos del cliente } return(cliente); }
public static int ModificarFichaCliente(EntidadCliente cli) { int retorno = 0; using (SqlConnection Conn = ConexionBD.ObtenerConexion()) { SqlCommand Comando = new SqlCommand(string.Format("Update Clientes set Identificacion='{0}', PrimerNombreCliente= '{1}', SegundoNombreCliente='{2}', PrimerApellidoCliente='{3}', SegundoApellidoCliente='{4}', TipoIdentificacion='{5}', Telefono='{6}',Celular='{7}',Email='{8}',Clasificacion='{9}',FechaNacimiento='{10}',Edad={11},Genero='{12}',EstadoCivil='{13}',Nacionalidad='{14}',DireccionResidencia='{15}',Ciudad='{16}',ActividadActual='{17}',TipoCliente='{18}',AsesorAsignado='{19}', NombreConyugue='{20}', ApellidosConyugue='{21}', FechaNacimientoConyugue='{22}', EdadConyugue='{23}', ProfesionConyugue='{24}',NumeroPasaporte='{25}',FechaVencimientoPasaporte='{26}', VisaVigente='{27}',NoLlamarCliente='{28}',MedioContactoDelCliente='{29}',DetalleSeguimiento='{30}',FechaProximaLlamada='{31}' where Identificacion='{0}'", cli.Identificacion, cli.PrimerNombreCliente, cli.SegundoNombreCliente, cli.PrimerApellidoCliente, cli.SegundoApellidoCliente, cli.TipoIdentificacion, cli.Telefono, cli.Celular, cli.Email, cli.Clasificacion, cli.FechaNacimiento, cli.Edad, cli.Genero, cli.EstadoCivil, cli.Nacionalidad, cli.DireccionResidencia, cli.Ciudad, cli.ActividadActual, cli.TipoCliente, cli.AsesorAsignado, cli.NombreConyugue, cli.ApellidosConyugue, cli.FechaNacimientoConyugue, cli.EdadConyugue, cli.ProfesionConyugue, cli.NumeroPasaporte, cli.FechaVencimientoPasaporte, cli.VisaVigente, cli.NoLlamarCliente, cli.MedioContactoDelCliente, cli.DetalleSeguimiento, cli.FechaProximaLlamada), Conn); retorno = Comando.ExecuteNonQuery(); Conn.Close(); } return(retorno); }
protected void BuscarClienteSinFicha_Click1(object sender, EventArgs e) { EntidadCliente cli = new EntidadCliente(); BrokerCliente bus = new BrokerCliente(); cli = bus.ObtenerClienteSinFicha(TxtIdentificacionBuscar.Text); TxtPrimerNombre.Text = cli.PrimerNombreCliente; TxtSegundoNombre.Text = cli.SegundoNombreCliente; TxtPrimerApellido.Text = cli.PrimerApellidoCliente; TxtSegundoApellido.Text = cli.SegundoApellidoCliente; TxtTipoIdentificacion.Text = cli.TipoIdentificacion; TxtTelefono.Text = cli.Telefono; TxtCelular.Text = cli.Celular; TxtEmail.Text = cli.Email; TxtClasificacion.Text = cli.TipoCliente; TxtIdentificacion.Text = cli.Identificacion; }
/* * Metodo que se activa cuando se cancelan los cambios tanto en agregar como en modificar. */ protected void btnCancelar_Click(object sender, EventArgs e) { if (modo == 1) //En agregar, limpia los campos. { limpiarCampos(); this.gridUsuariosAsignados.Visible = false; } if (modo == 2) //En modificar, todo vuelve a su estado inicial de consulta. { entidadConsultada = controladora.consultarProyecto(gridProyecto.SelectedRow.Cells[0].Text.ToString()); textNombre.Value = entidadConsultada.Nombre.ToString(); textObjetivo.Value = entidadConsultada.Objetivos.ToString(); textFechaA.Value = entidadConsultada.FechaAsig.ToString(); textFechaF.Value = entidadConsultada.FechaFin.ToString(); textFechaI.Value = entidadConsultada.FechaIni.ToString(); cmbEstado.SelectedValue = entidadConsultada.Estado.ToString(); idProy = controladora.getIdProyecto(entidadConsultada.Nombre.ToString()); clienteConsultado = controladora.consultarCliente(idProy); textRepresentante.Value = clienteConsultado.Nombre.ToString(); textTelRepresentante.Value = clienteConsultado.Telefono.ToString(); textTelSecundario.Value = clienteConsultado.Celular.ToString(); TextOficina.Value = clienteConsultado.Oficina.ToString(); textEmailRepresentante.Value = clienteConsultado.Correo.ToString(); btnModificarProyecto.Disabled = true; gridProyecto.DataBind(); this.gridUsuariosAsignados.Visible = true; llenarGridUsuarios(); llenarUsuariosAsignados(); } habilitarCampos(false); modo = 0; //Se devuelve a modo consulta luego de cancelar. botonAceptar.Disabled = true; botonCancelar.Disabled = true; this.gridProyecto.Enabled = true; btnAgregarProyecto.Disabled = false; }
/*Este método se encarga de la inserción de un proyecto, recibe como parámetro los datos que va a tener el proyecto, además de los datos del cliente. Retorna un resultado de éxito en caso * de realizar una inserción correcta, o un mensaje error en caso de una inserción incorrecta*/ public String[] insertarProyecto(String nombre, String objetivo, String estado, String fechaInic, String fechaFin, String fechaAsig, String lider, String nombreCliente, String telefono, String telefono1, String oficina, String correoCliente) { Object[] datos = new Object[7]; //Se crea un objeto con los datos del proyecto datos[0] = nombre; datos[1] = objetivo; datos[2] = estado; datos[3] = fechaInic; datos[4] = fechaFin; datos[5] = fechaAsig; datos[6] = lider; Object[] datosCliente = new Object[5]; //Se crea un objeto con los datos del cliente datosCliente[0] = nombreCliente; datosCliente[1] = telefono; datosCliente[2] = telefono1; datosCliente[3] = oficina; datosCliente[4] = correoCliente; EntidadProyecto proyecto = new EntidadProyecto(datos); //Se encapsulan los datos del proyecto EntidadCliente cliente = new EntidadCliente(datosCliente); //Se encapsulan los datos del cliente return(controladoraBDProyecto.insertarProyecto(proyecto, cliente)); }
/* * Evento que se activa al consultar un proyecto. */ protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { String estado; try { entidadConsultada = controladora.consultarProyecto(gridProyecto.SelectedRow.Cells[0].Text.ToString()); textNombre.Value = entidadConsultada.Nombre.ToString(); textObjetivo.Value = entidadConsultada.Objetivos.ToString(); textFechaA.Value = entidadConsultada.FechaAsig.ToString(); textFechaF.Value = entidadConsultada.FechaFin.ToString(); textFechaI.Value = entidadConsultada.FechaIni.ToString(); cmbEstado.SelectedValue = entidadConsultada.Estado.ToString(); estado = cmbEstado.SelectedValue; if (estado == "Finalizado") { btnEliminarProyecto.Disabled = true; } else { btnEliminarProyecto.Disabled = false; } idProy = controladora.getIdProyecto(entidadConsultada.Nombre.ToString()); //ID Estático clienteConsultado = controladora.consultarCliente(idProy); textRepresentante.Value = clienteConsultado.Nombre.ToString(); textTelRepresentante.Value = clienteConsultado.Telefono.ToString(); textTelSecundario.Value = clienteConsultado.Celular.ToString(); TextOficina.Value = clienteConsultado.Oficina.ToString(); textEmailRepresentante.Value = clienteConsultado.Correo.ToString(); btnModificarProyecto.Disabled = false; this.gridUsuariosAsignados.Visible = true; gridProyecto.DataBind(); llenarUsuariosAsignados(); llenarGridUsuarios(); } catch (Exception o) { } }
protected void Button1_Click(object sender, EventArgs e) { EntidadCliente cli = new EntidadCliente(); BrokerCliente bus = new BrokerCliente(); cli = bus.ObtenerClienteConFicha(TxtIdentificacionBuscar.Text); TxtPrimerNombre.Text = cli.PrimerNombreCliente; TxtSegundoNombre.Text = cli.SegundoNombreCliente; TxtPrimerApellido.Text = cli.PrimerApellidoCliente; TxtSegundoApellido.Text = cli.SegundoApellidoCliente; TxtTipoIdentificacion.Text = cli.TipoIdentificacion; TxtTelefono.Text = cli.Telefono; TxtCelular.Text = cli.Celular; TxtEmail.Text = cli.Email; TxtClasificacion.Text = cli.TipoCliente; TxtIdentificacion.Text = cli.Identificacion; TxtFechaNacimientoCliente.Text = cli.FechaNacimiento; RblGenero.Text = cli.Genero; RBLEstadoCivil.Text = cli.EstadoCivil; TxtDireccionResidencia.Text = cli.DireccionResidencia; DropDownList1.Text = cli.AsesorAsignado; DDLNacionalidad.Text = cli.Nacionalidad; DDLCiudadCliente.Text = cli.Ciudad; TxtEdad.Text = cli.Edad.ToString(); DDLActividadActual.Text = cli.ActividadActual; TxtNombreConyugue.Text = cli.NombreConyugue; TxtApellidoConyugue.Text = cli.ApellidosConyugue; TxtFechaNacimientoConyugue.Text = cli.FechaNacimientoConyugue; TxtEdadConyugue.Text = cli.EdadConyugue; DDLProfesionConyugue.Text = cli.ProfesionConyugue; TxtNumeroPasaporte.Text = cli.NumeroPasaporte; TxtFechaPasaporte.Text = cli.FechaVencimientoPasaporte; RBLVisaVigente.Text = cli.VisaVigente; //RBLNoLlamar.Text = cli.NoLlamarCliente; DDLMedioContacto.Text = cli.MedioContactoDelCliente; }
/* * Metodo para el registro de un nuevo usuario * Parametros: *nombreUsuario --> cadena que contiene el nombre del usuario * *zonaActual --> entero que contiene la zona actual del usuario que intenta registrarse * Verifica si el usuario actual esta registrado, por motivos de flujo de la aplicacion si no existe lo inserta */ public Boolean IngresoRegistroCliente(String nombreUsuario, int zonaActual) { // Ciclo iterador por cada cliente en la lista de clientes foreach (EntidadCliente cliente in _listaClientes) { String nombreClienteActual = cliente.GetNombreUsuario(); // Verificacion si el nombre del cliente actual es el mismo del usuario a ingresar if (nombreClienteActual.Equals(nombreUsuario)) { // Actualizacion del cliente con sesion iniciada y zona del mismo usuario _clienteActivo = cliente; _clienteActivo.SetZonaActual(zonaActual); // Retorno para finalizar el flujo del metodo, ingresando el usuario return(true); } } // Registro del usuario debido a no encontrar ninguno similar EntidadCliente nuevo = new EntidadCliente(nombreUsuario, zonaActual); _listaClientes.AddLast(nuevo); // Actualizacion del cliente con sesion iniciada _clienteActivo = nuevo; return(false); }
public int AgregarUsuarios(EntidadCliente EC) { return(objDato.AgregarCliente(EC)); }
//protected void BuscarClienteSinFicha_Click(object sender, EventArgs e) //{ // EntidadCliente cli = new EntidadCliente(); // BrokerCliente bus = new BrokerCliente(); // cli = bus.ObtenerClienteSinFicha(TxtIdentificacionBuscar.Text); // TxtPrimerNombre.Text = cli.PrimerNombreCliente; // TxtSegundoNombre.Text = cli.SegundoNombreCliente; // TxtPrimerApellido.Text = cli.PrimerApellidoCliente; // TxtSegundoApellido.Text = cli.SegundoApellidoCliente; // TxtTipoIdentificacion.Text = cli.TipoIdentificacion; // TxtTelefono.Text = cli.Telefono; // TxtCelular.Text = cli.Celular; // TxtEmail.Text = cli.Email; // TxtClasificacion.Text = cli.TipoCliente; // TxtIdentificacion.Text = cli.Identificacion; //} protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { EntidadCliente cli = new EntidadCliente(); if (TxtFechaNacimientoCliente.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Nombre de Usuario');</script>"); LbMensajeError.Text = "Debe ingresar una Fecha de Nacimiento"; return; } if (this.TxtEdad.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Password');</script>"); LbMensajeError.Text = "Debe escribir la Edad"; return; } if (this.RblGenero.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Nombre');</script>"); LbMensajeError.Text = "Debe elegir un genero"; return; } if (this.RBLEstadoCivil.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Apellidos');</script>"); LbMensajeError.Text = "Debe elegir un estado civil"; return; } if (this.DDLNacionalidad.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Correo');</script>"); LbMensajeError.Text = "Debe elegir la nacionalidad"; return; } if (this.TxtDireccionResidencia.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribr la dirección de la residencia"; return; } if (this.DDLCiudadCliente.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe elegir la ciudad"; return; } if (this.DDLActividadActual.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe elegir la actividad actual"; return; } if (this.TxtNombreConyugue.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir el nombre del conyugue"; return; } if (this.TxtApellidoConyugue.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir el apellido del conyugue"; return; } if (this.TxtFechaNacimientoConyugue.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir la fecha de nacimiento del conyugue"; return; } if (this.TxtEdadConyugue.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir la edad del conyugue"; return; } if (this.DDLProfesionConyugue.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir elegir la profesión del conyugue"; return; } if (this.TxtNumeroPasaporte.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir el número de pasaporte"; return; } if (this.TxtFechaPasaporte.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe escribir la fecha del pasaporte"; return; } if (this.RBLVisaVigente.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensajeError.Text = "Debe elegir visa vigente"; return; } //if (this.RBLNoLlamar.Text.Trim().Length == 0) //{ // //Response.Write("<script>window.alert('Ingrese Rol');</script>"); // LbMensaje.Text = "Debe elegir no llamar"; // return; //} //try //{ cli.Identificacion = TxtIdentificacion.Text.Trim(); cli.PrimerNombreCliente = TxtPrimerNombre.Text.Trim(); cli.SegundoNombreCliente = TxtSegundoNombre.Text.Trim(); cli.SegundoApellidoCliente = TxtSegundoApellido.Text.Trim(); cli.PrimerApellidoCliente = TxtPrimerApellido.Text.Trim(); cli.TipoIdentificacion = TxtTipoIdentificacion.Text.Trim(); cli.Telefono = TxtTelefono.Text.Trim(); cli.Celular = TxtCelular.Text.Trim(); cli.Email = TxtEmail.Text.Trim(); cli.Clasificacion = TxtClasificacion.Text.Trim(); cli.FechaNacimiento = TxtFechaNacimientoCliente.Text.Trim(); cli.Edad = Convert.ToInt32(TxtEdad.Text); cli.Genero = RblGenero.Text.Trim(); cli.EstadoCivil = RBLEstadoCivil.Text.Trim(); cli.Nacionalidad = DDLNacionalidad.Text.Trim(); cli.DireccionResidencia = TxtDireccionResidencia.Text.Trim(); cli.Telefono = TxtTelefono.Text.Trim(); cli.Ciudad = DDLCiudadCliente.Text.Trim(); cli.ActividadActual = DDLActividadActual.Text.Trim(); cli.AsesorAsignado = DropDownList1.Text.Trim(); cli.NombreConyugue = TxtNombreConyugue.Text.Trim(); cli.ApellidosConyugue = TxtApellidoConyugue.Text.Trim(); cli.FechaNacimientoConyugue = TxtFechaNacimientoConyugue.Text.Trim(); cli.EdadConyugue = TxtEdadConyugue.Text.Trim(); cli.ProfesionConyugue = DDLProfesionConyugue.Text.Trim(); cli.NumeroPasaporte = TxtNumeroPasaporte.Text.Trim(); cli.FechaVencimientoPasaporte = TxtFechaPasaporte.Text.Trim(); cli.VisaVigente = RBLVisaVigente.Text.Trim(); //cli.NoLlamarCliente = RBLNoLlamar.Text.Trim(); if (BrokerCliente.ModificarFichaCliente(cli) > 0) //si la funcion agregar pudo insertar { Response.Write("<script>window.alert('El Cliente fue registrado con Exito');</script>"); //LbMensaje.Text = "Usuario fue registrado"; //limpiar(); } else //si no pudo insertar { Response.Write("<script>window.alert('Cliente no fue registrado');</script>"); //LbMensaje.Text = "Usuario no fue registrado"; } }
//protected void BtnAgregarCliente_Click(object sender, EventArgs e) //{ // EntidadCliente cli = new EntidadCliente(); // if (TxtIdentificacion.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Nombre de Usuario');</script>"); // LbMensaje.Text = "Debe ingresar una identificación"; // return; // } // if (this.TxtPrimerNombre.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Password');</script>"); // LbMensaje.Text= "Debe escribir un Nombre"; // return; // } // if (this.TxtSegundoNombre.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Nombre');</script>"); // LbMensaje.Text = "Debe escribir segundo nombre"; // return; // } // if (this.TxtPrimerApellido.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Apellidos');</script>"); // LbMensaje.Text = "Debe escribir primer Apellido"; // return; // } // if (this.TxtSegundoApellido.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Correo');</script>"); // LbMensaje.Text = "Debe escribir segundo apellido"; // return; // } // if (this.DDLTipoIdentificacion.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Rol');</script>"); // LbMensaje.Text = "Debe elegir tipo de identificación"; // return; // } // if (this.TxtTelefono.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Rol');</script>"); // LbMensaje.Text = "Debe escribir número telefonico"; // return; // } // if (this.TxtCelular.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Rol');</script>"); // LbMensaje.Text = "Debe escribir el número celular"; // return; // } // if (this.TxtEmail.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Rol');</script>"); // LbMensaje.Text = "Debe escribir correo electrónico"; // return; // } // if (this.DDLTipo.Text.Trim().Length == 0) // { // //Response.Write("<script>window.alert('Ingrese Rol');</script>"); // LbMensaje.Text = "Debe escribir el tipo de cliente"; // return; // } // try // { // cli.Identificacion = TxtIdentificacion.Text.Trim(); // cli.PrimerNombreCliente = TxtPrimerNombre.Text.Trim(); // cli.SegundoNombreCliente = TxtSegundoNombre.Text.Trim(); // cli.PrimerApellidoCliente = TxtPrimerApellido.Text.Trim(); // cli.SegundoApellidoCliente = TxtSegundoApellido.Text.Trim(); // cli.TipoIdentificacion = DDLTipoIdentificacion.Text.Trim(); // cli.Telefono = TxtTelefono.Text.Trim(); // cli.Celular = TxtCelular.Text.Trim(); // cli.Email = TxtEmail.Text.Trim(); // cli.Clasificacion = DDLTipo.Text.Trim(); // if (BrokerCliente.AgregarNuevoCliente(cli) > 0 ) //si la funcion agregar pudo insertar // { // Response.Write("<script>window.alert('El Cliente fue registrado con Exito');</script>"); // //LbMensaje.Text = "Usuario fue registrado"; // limpiar(); // } // else//si no pudo insertar // { // Response.Write("<script>window.alert('Cliente no fue registrado');</script>"); // //LbMensaje.Text = "Usuario no fue registrado"; // } // } // catch (Exception ex) // { // LbMensaje.Text=("Error: " + ex.Message); // return; // } //} protected void BtnEnviar_Click(object sender, EventArgs e) { { EntidadCliente cli = new EntidadCliente(); if (TxtIdentificacion.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Nombre de Usuario');</script>"); LbMensaje.Text = "Debe ingresar una identificación"; return; } if (this.TxtPrimerNombre.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Password');</script>"); LbMensaje.Text = "Debe escribir un Nombre"; return; } if (this.TxtSegundoNombre.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Nombre');</script>"); LbMensaje.Text = "Debe escribir segundo nombre"; return; } if (this.TxtPrimerApellido.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Apellidos');</script>"); LbMensaje.Text = "Debe escribir primer Apellido"; return; } if (this.TxtSegundoApellido.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Correo');</script>"); LbMensaje.Text = "Debe escribir segundo apellido"; return; } if (this.DDlTipoIdentificacion.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensaje.Text = "Debe elegir tipo de identificación"; return; } if (this.TxtTelefono.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensaje.Text = "Debe escribir número telefonico"; return; } if (this.TxtCelular.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensaje.Text = "Debe escribir el número celular"; return; } if (this.TxtEmail.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensaje.Text = "Debe escribir correo electrónico"; return; } if (this.DDlClasificacion.Text.Trim().Length == 0) { //Response.Write("<script>window.alert('Ingrese Rol');</script>"); LbMensaje.Text = "Debe escribir el tipo de cliente"; return; } try { cli.Identificacion = TxtIdentificacion.Text.Trim(); cli.PrimerNombreCliente = TxtPrimerNombre.Text.Trim(); cli.SegundoNombreCliente = TxtSegundoNombre.Text.Trim(); cli.PrimerApellidoCliente = TxtPrimerApellido.Text.Trim(); cli.SegundoApellidoCliente = TxtSegundoApellido.Text.Trim(); cli.TipoIdentificacion = DDlTipoIdentificacion.Text.Trim(); cli.Telefono = TxtTelefono.Text.Trim(); cli.Celular = TxtCelular.Text.Trim(); cli.Email = TxtEmail.Text.Trim(); cli.Clasificacion = DDlClasificacion.Text.Trim(); if (BrokerCliente.AgregarNuevoCliente(cli) > 0) //si la funcion agregar pudo insertar { Response.Write("<script>window.alert('El Cliente fue registrado con Exito');</script>"); //LbMensaje.Text = "Usuario fue registrado"; limpiar(); } else//si no pudo insertar { Response.Write("<script>window.alert('Cliente no fue registrado');</script>"); //LbMensaje.Text = "Usuario no fue registrado"; } } catch (Exception ex) { LbMensaje.Text = ("Error: " + ex.Message); return; } } }