コード例 #1
0
        protected void btnModificar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text == "")
            {
                lblMensaje.Text = "Debe ingresar nombre Usuario";
                txtNombre.Focus();
                return;
            }
            if (txtApellido.Text == "")
            {
                lblMensaje.Text = "Debe ingresar Apellido Usuario";
                txtApellido.Focus();
                return;
            }
            if (txtCorreo.Text == "")
            {
                lblMensaje.Text = "Debe ingresar Email Usuario";
                txtCorreo.Focus();
                return;
            }
            if (txtContraseña.Text == "")
            {
                lblMensaje.Text = "Debe ingresar Contraseña Usuario";
                txtContraseña.Focus();
                return;
            }

            lblMensaje.Text = CADUsuario.CADUsu.ActualizarUsuario(txtNombre.Text, txtApellido.Text, txtCorreo.Text, txtContraseña.Text, Convert.ToInt16(txtIDUsuario.Text));
            GVUsuario.DataBind();
        }
コード例 #2
0
        protected void btnNuevo_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text == "")
            {
                lblMensaje.Text = "Debe ingresar nombre Usuario";
                txtNombre.Focus();
                return;
            }
            if (txtApellido.Text == "")
            {
                lblMensaje.Text = "Debe ingresar Apellido Usuario";
                txtApellido.Focus();
                return;
            }
            if (txtCorreo.Text == "")
            {
                lblMensaje.Text = "Debe ingresar Email Usuario";
                txtCorreo.Focus();
                return;
            }
            if (txtContraseña.Text == "")
            {
                lblMensaje.Text = "Debe ingresar Contraseña Usuario";
                txtContraseña.Focus();
                return;
            }

            lblMensaje.Text = CADUsuario.CADUsu.NuevoCliente(txtNombre.Text, txtApellido.Text, txtCorreo.Text, txtContraseña.Text);
            GVUsuario.DataBind();
        }
コード例 #3
0
        public void listagridN()
        {
            Conexao Con = new Conexao();
            string  usu = textBoxUsuario.Text;

            if (!Con.Checkconection())
            {
                Con.Conectar();
            }

            if (Con.Checkconection())
            {
                GVUsuario.DataSource = null;
                DataTable        table   = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     command = new MySqlCommand("SELECT * FROM USUARIO", Con.Traz_Conexao());
                adapter.SelectCommand = command;
                adapter.Fill(table);

                GVUsuario.DataSource = table;
                GVUsuario.Update();
                GVUsuario.Refresh();

                Con.Desconectar();
            }
        }
コード例 #4
0
        public void listagridP()
        {
            Conexao Con = new Conexao();
            string  usu = textBoxUsuario.Text;

            if (!Con.Checkconection())
            {
                Con.Conectar();
            }

            if (Con.Checkconection())
            {
                GVUsuario.DataSource = null;
                DataTable        table   = new DataTable();
                MySqlDataAdapter adapter = new MySqlDataAdapter();
                MySqlCommand     command = new MySqlCommand("SELECT * FROM USUARIO WHERE USUARIO = @usuario", Con.Traz_Conexao());
                command.Parameters.Add("@usuario", MySqlDbType.VarChar).Value = (usu);
                adapter.SelectCommand = command;
                adapter.Fill(table);

                GVUsuario.DataSource = table;
                GVUsuario.Update();
                GVUsuario.Refresh();

                Con.Desconectar();
            }
        }
コード例 #5
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            lblMensaje.Text = CADUsuario.CADUsu.BorrarUsuario(Convert.ToInt16(txtIDUsuario.Text));

            txtIDUsuario.Text  = "";
            txtNombre.Text     = "";
            txtApellido.Text   = "";
            txtCorreo.Text     = "";
            txtContraseña.Text = "";

            GVUsuario.DataBind();
        }
コード例 #6
0
        private void CargarGVUsuario()
        {
            try
            {
                ObjectDataSource1.SelectParameters.Clear();

                ObjectDataSource1.SelectParameters.Add(new Parameter()
                {
                    Name = "conexion", DefaultValue = System.Configuration.ConfigurationManager.ConnectionStrings["Concurso"].ToString()
                });

                GVUsuario.DataBind();
            }
            catch
            {
                Response.Write("<script>alert('Ha ocurrido un error inesperado, si el problema persiste por favor contáctese con un administrador');</script>");
            }
        }
コード例 #7
0
 private void BindGridUsuario()
 {
     GVUsuario.DataSource = GetAllUsuario();
     GVUsuario.DataBind();
 }