void voltar() { frmDashboardAdm adm = new frmDashboardAdm(idUser); this.Hide(); adm.ShowDialog(); this.Close(); }
private void frmAtualizarUser_Load(object sender, EventArgs e) { util.Msg("Página em desenvolvimento.", MessageBoxIcon.Stop); frmDashboardAdm adm = new frmDashboardAdm(idUser); this.Hide(); adm.ShowDialog(); this.Close(); }
private void btnDashboardAdm_Click(object sender, EventArgs e) { if (adm) { frmDashboardAdm adm = new frmDashboardAdm(idUser); this.Hide(); adm.ShowDialog(); this.Close(); } }
void voltar() { switch (formOption) { case 0: //login frmLogin login = new frmLogin(); this.Hide(); login.ShowDialog(); this.Close(); break; case 1: //admin dashboard if (!backToDash) { frmConsultaEmprestimo consultaEmprestimo = new frmConsultaEmprestimo(userId, formOption); this.Hide(); consultaEmprestimo.ShowDialog(); this.Close(); } else { frmDashboardAdm adm = new frmDashboardAdm(userId); this.Hide(); adm.ShowDialog(); this.Close(); } break; case 2: //user dashboard frmDashboard dash = new frmDashboard(userId); this.Hide(); dash.ShowDialog(); this.Close(); break; case 3: //inicio frmInicio inicio = new frmInicio(); this.Hide(); inicio.ShowDialog(); this.Close(); break; default: formOption = 3; voltar(); break; } }
void voltar() { switch (formOption) { case 0: //login frmLogin login = new frmLogin(); this.Hide(); login.ShowDialog(); this.Close(); break; case 1: //admin dashboard frmDashboardAdm adm = new frmDashboardAdm(userId); this.Hide(); adm.ShowDialog(); this.Close(); break; case 2: //user dashboard frmDashboard dash = new frmDashboard(userId); this.Hide(); dash.ShowDialog(); this.Close(); break; case 3: //inicio frmInicio inicio = new frmInicio(); this.Hide(); inicio.ShowDialog(); this.Close(); break; case 4: //selUser frmSelecionaUser selUser = new frmSelecionaUser(userId, formUser); this.Hide(); selUser.ShowDialog(); this.Close(); break; default: formOption = 3; voltar(); break; } }
void subLogin() { try { if (valCampos()) { string user = txtUser.Text; string senha = txtSenha.Text; senha = util.Md5(senha); con = new Connection("localhost", "5432", "postgres", "postgres", "admin"); string sql = "SELECT * FROM public.user WHERE ra='" + user + "' OR login='******'"; NpgsqlDataReader dr = con.Select(sql); if (dr.HasRows) { dr.Read(); string senhaBanco = dr.GetString(4); if (senha == senhaBanco) { if (!dr.GetBoolean(12)) { if (dr.GetBoolean(11)) { if (util.ConfirmaMsg("Deseja ir ao Painel de Administração?")) { frmDashboardAdm adm = new frmDashboardAdm(dr.GetInt64(0)); this.Hide(); adm.ShowDialog(); this.Close(); } else { frmDashboard pan = new frmDashboard(dr.GetInt64(0)); this.Hide(); pan.ShowDialog(); this.Close(); } } else { frmDashboard pan = new frmDashboard(dr.GetInt64(0)); this.Hide(); pan.ShowDialog(); this.Close(); } } else { util.Msg("Este usuário está bloqueado!\n\nSe isso parece errado, contate um administrador!", MessageBoxIcon.Error); } } else { util.Msg("Senha incorreta!\n\nSe esqueceu sua senha, contate um administrador para alterá-la!", MessageBoxIcon.Error); txtSenha.Text = ""; txtSenha.Focus(); } } else { util.Msg("Usuário inexistente!", MessageBoxIcon.Error); txtUser.Text = ""; txtSenha.Text = ""; txtUser.Focus(); } con.Close(); } else { util.Msg("Alguns campos não foram preenchidos!", MessageBoxIcon.Error); } } catch (Exception ex) { util.Msg("Algo deu errado!\n\nMais detalhes:" + ex.Message, MessageBoxIcon.Error); } }
void cmbReload(char opt) { if (opt == '*') { cmbReload('e'); cmbReload('a'); cmbReload('g'); } else if (opt == 'e') { try { con = new Connection("localhost", "5432", "postgres", "postgres", "admin"); string sql = "SELECT * FROM public.editora WHERE excluido = FALSE"; NpgsqlDataReader dr = con.Select(sql); if (dr.HasRows) { cmbEditora.Items.Clear(); idEditoras.Clear(); while (dr.Read()) { string editora = dr.GetString(1); cmbEditora.Items.Add(editora); idEditoras.Add(dr.GetInt64(0)); } } } catch (Exception ex) { if (util.ConfirmaMsg("Não foi possível recuperar as editoras!\n\nMais detalhes: " + ex.Message + "\n\nDeseja tentar novamente?")) { cmbReload('e'); } else { frmDashboardAdm adm = new frmDashboardAdm(idUser); this.Hide(); adm.ShowDialog(); this.Close(); } } } else if (opt == 'a') { try { con = new Connection("localhost", "5432", "postgres", "postgres", "admin"); string sql = "SELECT * FROM public.autor WHERE excluido = FALSE"; NpgsqlDataReader dr = con.Select(sql); if (dr.HasRows) { cmbAutor.Items.Clear(); idAutores.Clear(); while (dr.Read()) { long id_livro = dr.GetInt64(0); if (!idSelecionados.Contains(id_livro)) { string autor = dr.GetString(1); cmbAutor.Items.Add(autor); idAutores.Add(id_livro); } } } } catch (Exception ex) { if (util.ConfirmaMsg("Não foi possível recuperar os autores!\n\nMais detalhes: " + ex.Message + "\n\nDeseja tentar novamente?")) { cmbReload('a'); } else { frmDashboardAdm adm = new frmDashboardAdm(idUser); this.Hide(); adm.ShowDialog(); this.Close(); } } } else { try { con = new Connection("localhost", "5432", "postgres", "postgres", "admin"); string sql = "SELECT * FROM public.genero WHERE excluido = FALSE"; NpgsqlDataReader dr = con.Select(sql); if (dr.HasRows) { cmbGenero.Items.Clear(); idGeneros.Clear(); while (dr.Read()) { string genero = dr.GetString(1); string sigla = dr.GetString(2); cmbGenero.Items.Add(genero + " (" + sigla + ")"); idGeneros.Add(dr.GetInt64(0)); } } } catch (Exception ex) { if (util.ConfirmaMsg("Não foi possível recuperar os autores!\n\nMais detalhes: " + ex.Message + "\n\nDeseja tentar novamente?")) { cmbReload('a'); } else { frmDashboardAdm adm = new frmDashboardAdm(idUser); this.Hide(); adm.ShowDialog(); this.Close(); } } } }