Example #1
0
        private void btnEditarUsuario_Click(object sender, EventArgs e)
        {
            EditarUsuario editarUsuario = new EditarUsuario();

            this.Hide();
            editarUsuario.Show();
        }
        private void BtnEditar_Click(object sender, EventArgs e)
        {
            var linha = dgVisualizar.CurrentRow.DataBoundItem;

            var menu = new EditarUsuario((Usuario)linha);

            menu.FormClosed += (x, y) =>
            {
                this.Show();
                this.AlimentarDg();
            };
            menu.Show();
            this.Hide();
        }
        public void CompararRespuesta(Form f, string ask, string resp)
        {
            string dbAnswer;
            try
            {
                sql = new SqlConnection(CadCon.Servidor());
                sql.Open();
                String queryRep = "Select *From Usuarios where PwdRecover='" + ask + "'";
                cmd = new SqlCommand(queryRep, sql);

                int row = cmd.ExecuteNonQuery();

                if (row == 0)
                {
                    MessageBox.Show("Problemas al cargar la informaciĆ³n", "Ups...");
                }
                else
                {
                    dt = new DataTable();
                    sda = new SqlDataAdapter(cmd);
                    sda.Fill(dt);

                    /************************************************ */
                    dbAnswer=dt.Rows[0][4].ToString();
                    if(resp.Equals(dbAnswer)){
                        EditarUsuario ed = new EditarUsuario();
                        ed.Show();
                        f.Hide();
                    }
                    else {
                        MessageBox.Show("La informaciĆ³n proporcionada es incorrecta...\n"
                            +"Tu respuesta no coincide con la respuesta almacenada\n"
                            +"en la base de datos",
                            "Lo sentimos...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    /************************************************** */
                }
                sql.Close();
                cmd.Dispose();
            }
            catch (SqlException se) { MessageBox.Show(se.Message); }
        }
Example #4
0
        private void editarUsuƔrioToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EditarUsuario tela = new EditarUsuario();

            tela.Show();
        }