示例#1
0
        public ActionResult Edit(FormCollection collecion)
        {
            BeCliente objcliente = new BeCliente();

            objcliente.IdCliente       = int.Parse(collecion["IdCliente"]);
            objcliente.Nombres         = collecion["Nombres"].Trim();
            objcliente.ApellidoPaterno = collecion["ApellidoPaterno"].Trim();
            objcliente.ApellidoMaterno = collecion["ApellidoMaterno"].Trim();
            objcliente.Email           = collecion["Email"].Trim();
            objcliente.NumeroMovil     = collecion["NumeroMovil"].Trim();
            CrudClientes.Updateclientes(objcliente);


            return(RedirectToAction("Index"));
        }
示例#2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dr = MessageBox.Show("¿Esta seguro de guardar al cliente " + textBoxNom.Text + " " + textBoxApe.Text + "?", "INFO", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);

                if (dr.Equals(DialogResult.Yes))
                {
                    if (textBoxNom.Text != "" &&
                        textBoxApe.Text != "" &&
                        textBoxTel.Text != "" &&
                        textBoxCel.Text != "" &&
                        textBoxEmail.Text != "" &&
                        (radioBno.Checked != false ||
                         radioBsi.Checked != false))
                    {
                        if (!id.Equals(Guid.Empty))
                        {
                            Clientes client = new Clientes
                            {
                                idCliente = id,
                                nombre    = textBoxNom.Text,
                                apellidos = textBoxApe.Text,
                                telefono  = textBoxTel.Text,
                                celular   = textBoxCel.Text,
                                correo    = textBoxEmail.Text,
                                activo    = activo
                            };

                            CrudClientes.Modificar(client);
                            clearInterface();
                            cargarTabla();
                        }
                        else
                        {
                            if (CrudClientes.VerificarClientes(textBoxTel.Text).Equals(false))
                            {
                                Clientes newClient = new Clientes
                                {
                                    idCliente = Guid.NewGuid(),
                                    nombre    = textBoxNom.Text,
                                    apellidos = textBoxApe.Text,
                                    telefono  = textBoxTel.Text,
                                    celular   = textBoxCel.Text,
                                    correo    = textBoxEmail.Text,
                                    activo    = activo
                                };

                                CrudClientes.Alta(newClient);
                                clearInterface();
                                cargarTabla();
                            }
                            else
                            {
                                MessageBox.Show("El cliente " + textBoxNom.Text + " " + textBoxApe.Text + "ya existe si quiere modificar solo seleccionelo en las tablas de abajo", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ingrese los campos faltantes", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#3
0
 private void cargarTabla()
 {
     dgvClientes.AutoGenerateColumns = false;
     dgvClientes.DataSource          = CrudClientes.Consulta();
 }
示例#4
0
 public ActionResult Edit(int id)
 {
     return(View(CrudClientes.Editclientes(id)));
 }
示例#5
0
        //
        // GET: /Clientes/

        public ActionResult Index()


        {
            return(View(CrudClientes.Listclientes()));
        }
示例#6
0
 public ActionResult Delete(int id)
 {
     CrudClientes.DeleteClientes(id);
     return(RedirectToAction("Index"));
 }