public List <string> Agregar(Entidades.ClienteEntidad cli) { List <String> Resultado = new List <string>(); String Estado = Convert.ToString(cliDAO.Agregar(cli)); String Mensaje = cliDAO.Mensaje; Resultado.Add(Estado); Resultado.Add(Mensaje); return(Resultado); }
private void btnConfirmar_Click(object sender, EventArgs e) { //CREA DATOS DEL CAJERO EN EL QUE ESTAS PARADO CajeroDAO cajeroDao = new CajeroDAO(); Cajero cajero = new Cajero(1, 175000, 100, 0, 200); cajeroDao.Agregar(cajero); //CREA TIPOS DE CUENTA //int idTipoCuenta, string nombretipo, double limiteDinero, int limiteCantidadExtracciones TipoCuentaDAO datosTipoCuentaDao = new TipoCuentaDAO(); TipoCuenta tipoCuenta = new TipoCuenta(1, "CtaCrt", 8000, 8, 3000);//CREA TIPO DE CUENTA datosTipoCuentaDao.Agregar(tipoCuenta); tipoCuenta = new TipoCuenta(2, "Caja Ahorro", 3000, 5, 3000); datosTipoCuentaDao.Agregar(tipoCuenta); //CREA DATOS TARJETA PARA CLIENTE //int idTarjeta, int numeroTarjeta, Persona propietario, string desde, string hasta, string password //string nombre, string apellido, string dni, DateTime fechaNacimiento, string direccion, string telefono, string celular, string mail PersonaDAO datosPersonaDao = new PersonaDAO(); Persona propietario = new Persona(1, "cristian", "dabrowski", "41840057", new DateTime(1993, 6, 10), "plumas verdes 69", "494-0180", "155-257752", "cristian@mail"); datosPersonaDao.Agregar(propietario); TarjetaDAO datosTarjetaDao = new TarjetaDAO(); Tarjeta tarjetaCliente1 = new Tarjeta(1, 10001, propietario, new DateTime(), new DateTime().AddMonths(8), "abc123"); datosTarjetaDao.Agregar(tarjetaCliente1); //CREA DATOS DE CLIENTES Y SUS CUENTAS //int idCliente, string situacionImpositiva, List<Cuenta> cuentasCliente, List<Tarjeta> tarjetasCliente, string nombre, string apellido, string dni, DateTime fechaNacimiento, string direccion, string telefono, string celular, string mail CuentaDAO datosCuentaDao = new CuentaDAO(); Cuenta cuenta = new Cuenta(1, 100001, datosTipoCuentaDao.DameXId(1), 10000, 0, 0); datosCuentaDao.Agregar(cuenta); cuenta = new Cuenta(2, 100002, datosTipoCuentaDao.DameXId(2), 180000, 0, 0); datosCuentaDao.Agregar(cuenta); ClienteDAO datosClienteDao = new ClienteDAO(); List <Cuenta> listaCuentasCliente = new List <Cuenta>(datosCuentaDao.DameAll()); List <Tarjeta> listaTarjetasCliente = new List <Tarjeta>(datosTarjetaDao.DameAll()); Cliente cliente = new Cliente(1, "Estudiante", listaCuentasCliente, listaTarjetasCliente, "cristian", "dabrowski", "41840057", new DateTime(1993, 6, 10), "plumas verdes 69", "494-0180", "155-257752", "cristian@mail");//CLIENTE 1 datosClienteDao.Agregar(cliente); //Cliente cliente2 = new Cliente( 2, "Jefe", listaCuentasCliente, listaTarjetasCliente, "guido", "motumbo", "34552014", new DateTime(09-05-89), "rivadavia 3421", "473-9862", "155-801960", "guido@mail");//CLIENTE 2 Menu menu = new Menu(cliente, cajero); menu.ShowDialog(); Close(); }
public void ValidarTexbox() { if (txt_amaterno_cliente.Text == "" | txt_apaterno_cliente.Text == "" | txt_direcc_cliente.Text == "" | txt_email_cliente.Text == "" | txt_nom_cliente.Text == "" | txt_tele_cliente.Text == "") { MessageBox.Show("Debe completar todos los campos"); } else { if (Cliente_mod == false) { if (clienteDAO.Agregar(RecuperarInformacion()) == 1) { MessageBox.Show("Se ha Agregado el Cliente"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Ha sucedido un error"); } } else { if (clienteDAO.Modificar(RecuperarInformacion()) == 1) { MessageBox.Show("Se ha modificado el Cliente"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Ha sucedido un error"); } } Limpiar(); } }
private void BtnGuardar_Click(object sender, EventArgs e) { try { if (TxtCodigo.Text == "" || TxtCodigoDatos.Text == "") { MessageBox.Show("Los campos estan vacios", "llene los campos", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (NuevoRegistro == true) { Cliente oCliente = new Cliente(); oCliente.Codigo = TxtCodigo.Text.Trim(); oCliente.DatosIdDatos = int.Parse(TxtIdDatos.Text.Trim()); if (oClienteDAO.Agregar(oCliente) == false) { MessageBox.Show("El nuevo registro no pudo ser grabado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBox.Show("El nuevo registro fue grabado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtCodigo.Text = ""; TxtCodigoDatos.ReadOnly = false; BtnEliminar.Enabled = false; BtnGuardar.Enabled = false; TxtCodigo.Focus(); return; } } else { Cliente oCliente = oClienteDAO.Buscar(TxtCodigo.Text.Trim()); if (oClienteDAO.Modificar(oCliente) == false) { MessageBox.Show("El Registro no fue Modificado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBox.Show("Registro Modificado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Error); //TxtCodigo.Text = ""; TxtCodigoDatos.Text = ""; BtnEliminar.Enabled = false; BtnGuardar.Enabled = false; TxtCodigo.Focus(); return; } } } } catch (Exception ex) { MessageBox.Show("Hola exepcion", ex.Message); throw; } }