Example #1
0
        private void btninsertar_Click(object sender, EventArgs e)
        {
            bool sucess = false;

            sucess = ClienteValidacion();

            if (sucess)
            {
                vendedormodel.vendedor  = txtnombre.Text;
                vendedormodel.Direccion = txtdireccion.Text;
                vendedormodel.Telefono  = txttelefono.Text;
                vendedormodel.Cedula    = txtcedula.Text;

                if (isedit == false)
                {
                    if (comprac.InsertarVendedor(vendedormodel))
                    {
                        //BuscarClientes bclientes = new BuscarClientes();
                        //bclientes.ListClientes();
                        this.Close();
                    }
                }
                else
                {
                    vendedormodel.VendedorId = new Guid(vendedorId);
                    try
                    {
                        if (comprac.ActualizarVendedor(vendedormodel))
                        {
                            //BuscarClientes bclientes = new BuscarClientes();
                            //bclientes.ListClientes();
                            this.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("No se pudo insertar los datos por: " + ex);
                    }
                }
            }
        }