예제 #1
0
        private void dgvClientes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Hizo doble clic para modificar cliente ");
            ClsEcliente E    = new ClsEcliente();
            ClsNcliente N    = new ClsNcliente();
            DataTable   data = N.MtdBusquedaCliente(dgvClientes.CurrentRow.Cells[0].Value.ToString());

            E.Dni       = data.Rows[0][0].ToString();
            E.Nombres   = data.Rows[0][1].ToString();
            E.Apellidos = data.Rows[0][2].ToString();
            E.Correo    = data.Rows[0][3].ToString();
            E.Telefono  = data.Rows[0][4].ToString();
            //para estado
            if (data.Rows[0][5].ToString() == "1")
            {
                E.Estado = "Activo";
            }
            else if (data.Rows[0][5].ToString() == "0")
            {
                E.Estado = "Inactivo";
            }
            frmRegistroCliente f = new frmRegistroCliente(E.Dni, E.Nombres, E.Apellidos, E.Correo, E.Telefono, E.Estado);

            f.ShowDialog();
            dgvClientes.DataSource = N.MtdListarClientes();
        }
예제 #2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (validarCampos())
     {
         ClsEcliente E = ClsEcliente.crear(txtDni.Text, txtNombres.Text, txtApellidos.Text, txtCorreo.Text, txtTelefono.Text, lblEstado.Text);
         ClsNcliente N = new ClsNcliente();
         if (N.agregarCliente(E))
         {
             if (MessageBox.Show("Cliente registrado correctamente, ¿Desea continuar en el formulario de registro de cliente?", "JeaNET - Informa", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Guardo nuevo cliente satisfactoriamente " + btnGuardar.Name);
                 MtdLimpiar();
                 btnModificar.Enabled = false;
             }
             else
             {
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("No se pudo registrar el cliente, intente de nuevo o comuniquese con soporte", "JeaNET - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "no pudo guadar nuevo cliente satisfactoriamente " + btnGuardar.Name);
         }
     }
 }
 private void btnModificar_Click(object sender, EventArgs e)
 {
     if (MtdValidarCampos() == 0)
     {
         ClsEcliente E = new ClsEcliente();
         ClsNcliente N = new ClsNcliente();
         E.Dni       = txtDni.Text;
         E.Nombres   = txtNombres.Text;
         E.Apellidos = txtApellidos.Text;
         E.Correo    = txtCorreo.Text;
         E.Telefono  = txtTelefono.Text;
         E.Estado    = lblEstado.Text;
         //E.IdDispositivo = "";
         if (N.MtdModificarCliente(E))
         {
             if (MessageBox.Show("Cliente modificado correctamente, ¿Desea continuar en el formulario de registro de cliente?", "JeaNET - Informa", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
             {
                 frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Modificó cliente satisfactoriamente " + btnModificar.Name);
                 btnGuardar.Enabled   = true;
                 btnModificar.Enabled = false;
                 txtDni.Enabled       = true;
                 MtdLimpiar();
             }
             else
             {
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("No se pudo modificar el cliente, intente de nuevo o comuniquese con soporte.", "JeaNET - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Error al intentar modificar cliente " + btnModificar.Name);
         }
     }
 }
예제 #4
0
        public void testModificarCliente()
        {
            ClsNcliente objN   = new ClsNcliente();
            ClsEcliente objE   = ClsEcliente.crear("50505050", "Jose", "Pepe", "*****@*****.**", "123456789", "1");
            bool        result = objN.modificarCliente(objE);

            Assert.IsFalse(result);
        }
예제 #5
0
        public void testAgregarCliente()
        {
            ClsNcliente objN   = new ClsNcliente();
            ClsEcliente objE   = ClsEcliente.crear("30303030", "Pedrito", "Perez", "*****@*****.**", "202020209", "0");
            bool        result = objN.agregarCliente(objE);

            Assert.IsFalse(result);
        }
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     usuario = temp;
     foreach (ClsEcliente item in usuario)
     {
         cliente = ClsEcliente.crear(item.DniCliente, item.Nombres, item.Apellidos, item.Correo, item.Telefono, item.Estado);
     }
     MessageBox.Show("Datos Guardados correctamente", "JeaNet - Informa", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
예제 #7
0
 private void llenarCamposCliente(ClsEcliente E)
 {
     txtDni.Text        = E.DniCliente;
     txtNombres.Text    = E.Nombres;
     txtApellidos.Text  = E.Apellidos;
     txtCorreo.Text     = E.Correo;
     txtTelefono.Text   = E.Telefono;
     cmbEstado.Text     = E.Estado;
     txtDni.Enabled     = false;
     btnGuardar.Enabled = false;
 }
예제 #8
0
        public ArrayList busquedaCliente(string codigoCliente)
        {
            ArrayList clientes = new ArrayList();

            foreach (var item in datos.busquedaCliente(codigoCliente))
            {
                ClsEcliente cliente = ClsEcliente.crear(item.DniCliente, item.Nombres, item.Apellidos, item.Correo, item.Telefono, item.Estado);
                clientes.Add(cliente);
            }
            return(clientes);
        }
예제 #9
0
        public ArrayList filtrarClientes(string filtro)
        {
            ArrayList clientes = new ArrayList();

            foreach (var item in datos.filtrarCliente(filtro))
            {
                ClsEcliente cliente = ClsEcliente.crearFiltro(item.DniCliente, item.Nombres, item.Apellidos, item.Estado);
                clientes.Add(cliente);
            }
            return(clientes);
        }
예제 #10
0
        public ArrayList listarClientes()
        {
            ArrayList clientes = new ArrayList();

            foreach (var item in datos.listarCliente())
            {
                ClsEcliente cliente = ClsEcliente.crear(item.DniCliente, item.Nombres, item.Apellidos, item.Correo, item.Telefono, item.Estado);
                clientes.Add(cliente);
            }
            return(clientes);
        }
예제 #11
0
        private void dgvClientes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            frmLoginAdmin.MtdAuditoria(frmAdministrador.data.Rows[0][0].ToString(), "Hizo doble clic para modificar cliente ");
            ClsNcliente N = new ClsNcliente();
            ClsEcliente E = null;

            foreach (ClsEcliente item in N.busquedaCliente(dgvClientes.CurrentRow.Cells[0].Value.ToString()))
            {
                string estado = (item.Estado.Equals("1")) ? "Activo" : "Inactivo";
                E = ClsEcliente.crear(item.DniCliente, item.Nombres, item.Apellidos, item.Correo, item.Telefono, estado);
            }
            frmRegistroCliente f = new frmRegistroCliente(E);

            f.ShowDialog();
            dgvClientes.DataSource = N.listarClientes();
        }
예제 #12
0
        internal bool MtdGuardarCliente(ClsEcliente e)
        {
            try
            {
                ClsConexionSQL objConexion = new ClsConexionSQL();
                SqlCommand     command     = new SqlCommand();
                SqlDataAdapter adapter     = new SqlDataAdapter();
                command.Connection  = objConexion.Conectar();
                command.CommandText = "USP_I_AgregarCliente";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.Add(new SqlParameter("d", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("nom", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("ape", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("cor", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("tel", SqlDbType.VarChar));
                command.Parameters.Add(new SqlParameter("est", SqlDbType.VarChar));
                //command.Parameters.Add(new SqlParameter("idd", SqlDbType.VarChar));
                command.Parameters["d"].Value   = e.Dni;
                command.Parameters["nom"].Value = e.Nombres;
                command.Parameters["ape"].Value = e.Apellidos;
                command.Parameters["cor"].Value = e.Correo;
                command.Parameters["tel"].Value = e.Telefono;
                command.Parameters["est"].Value = e.Estado;
                //command.Parameters["idd"].Value = e.IdDispositivo;
                command.ExecuteNonQuery();
                command.Connection = objConexion.Desconectar();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
        }
예제 #13
0
 public frmRegistroCliente(ClsEcliente E)
 {
     InitializeComponent();
     llenarCamposCliente(E);
 }
예제 #14
0
        public bool agregarCliente(ClsEcliente cliente)
        {
            tbClientes tbl = tbClientes.crear(cliente.DniCliente, cliente.Nombres, cliente.Apellidos, cliente.Correo, cliente.Telefono, cliente.Estado);

            return(datos.agregarCliente(tbl));
        }