Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (dgv2.SelectedRows.Count == 0)
            {
                MessageBox.Show("DEBE SELECCIONAR UNA LISTA", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(name.Text) || string.IsNullOrEmpty(lastName.Text) || string.IsNullOrEmpty(email.Text))
            {
                MessageBox.Show("NOMBRE, APELLIDO, EMAIL SON REQUERIDOS", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            var procesador = new Procesador();

            if (!procesador.EmailValido(email.Text))
            {
                MessageBox.Show("EMAIL NO VALIDO", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            DataGridViewRow row = dgv2.CurrentRow;

            idLista = Convert.ToInt32(row.Cells["ID"].Value);
            _       = CreateAddContactAsync(name.Text, lastName.Text, email.Text, phone.Text, idLista);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("TODOS LOS CAMPOS SON NESESARIOS", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (!procesador.EmailValido(textBox2.Text))
            {
                MessageBox.Show("EMAIL NO VALIDO", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            _ = CreateNewRemitenteAsync(textBox1.Text, textBox2.Text);
        }
        public async Task UpdateContact()
        {
            if (string.IsNullOrEmpty(email))
            {
                MessageBox.Show("SELECCIONE UN CONTACTO", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if (string.IsNullOrEmpty(nuevoemail.Text))
            {
                MessageBox.Show("DEBE INGRESAR NUEVO EMAIL", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else if (email == nuevoemail.Text)
            {
                MessageBox.Show("PARA ACTUALIZAR CONTACTO LOS EMAILS DEBEN SER DIFERENTES, DE LO CONTRARIO ELIMINE EL CONTACTO Y LUEGO CREAR NUEVO CONTACTO", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var    procesador = new Procesador();
            string nuevoEmail = string.Empty;

            if (!procesador.EmailValido(nuevoemail.Text.ToLower()))
            {
                MessageBox.Show("EMAIL NO VALIDO", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            nuevoEmail = nuevoemail.Text.ToLower();
            dataContact.attributes.NOMBRE  = txtNombre.Text;
            dataContact.attributes.SURNAME = txtApellido.Text;
            dataContact.attributes.SMS     = txtTelefono.Text;
            bool result = await procesador.UpdateContactAsync(email, dataContact, nuevoEmail);

            if (!result)
            {
                MessageBox.Show("CONTACTO ACTUALIZADO CORRECTAMENTE", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("ACTUALIZACION FALLIDA", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }