示例#1
0
        //-------------------------------------------------\\
        #region Valida USUÁRIO
        public string ValidaUsuario(ModUsuario md)
        {
            string Validar = "Select * FROM TB_Usuario WHERE Login='******' and Senha='" + md.Senha + "'";

            if (conexao.Con != null)
            {
                cmd = new SqlCommand(Validar, conexao.Con);
                SqlDataReader DA = null;
                conexao.Conectar();
                DA = cmd.ExecuteReader();

                if (DA.Read())
                {
                    Dal.Default.Nivel = DA.GetValue(1).ToString();
                    return(Dal.Default.User = DA.GetValue(4).ToString());
                }
                else
                {
                    return("Usuário não cadastrado");
                }
            }
            else
            {
                throw new Exception("Impossível se conectar");
            }
        }
示例#2
0
 public string IncluirUsuaio(ModUsuario md, int tam, int senha, string senha1, string senha2)
 {
     if (tam == 0)
     {
         return("O campo login deve ser preenchido !");
     }
     else
     {
         if (senha == 0)
         {
             return("O campo senha deve ser preenchido !");
         }
         else
         {
             if (senha1 != senha2)
             {
                 return("As Senhas não coincidem !");
             }
             else
             {
                 DALUsuario user = new DALUsuario(conexao);
                 return(user.Incluir(md));
             }
         }
     }
 }
 public PerfilPresidente(ModUsuario m)
 {
     InitializeComponent();
     p             = m as ModPresidente;
     nometxt.Text  = p.Nome;
     fonetxt.Text  = p.Fone;
     emailtxt.Text = p.Email;
     nasctxt.Text  = p.Nascimento.ToString();
 }
示例#4
0
        public void InsertUsuario(ModUsuario x)
        {
            p = new PerUsuario();
            List <ModUsuario> cs = p.Open();

            //int id = 1;
            //if (cs.Count > 0) id = cs.Max(c => c.Id) + 1;
            //x.IdPartida = id;
            cs.Add(x);
            p.Save(cs);
        }
 public PerfilJogador(ModUsuario m)
 {
     InitializeComponent();
     j             = m as ModJogador;
     nomejog.Text  = j.Nome;
     emailjog.Text = j.Email;
     fonejog.Text  = j.Fone;
     nascjog.Text  = j.Nascimento.ToString();
     //apeljog.Text = j.Apelido;
     numcjog.Text = j.NumCamisa.ToString();
     posjog.Text  = j.Posicao;
 }
示例#6
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            Formularios frm = new Formularios();
            Thread      th;


            pBoxLoading.Visible = true;
            ModUsuario md = new ModUsuario();

            md.Login = tBoxLogin.Text;
            md.Senha = tBoxSenha.Text;

            DALConexao cn  = new DALConexao(DAL.DALDadosConexao.ConStr);
            BLLUsuario bll = new BLLUsuario(cn);

            try
            {
                string msg, desc;
                if (!bll.ValidarUsuaio(md).Contains("não"))
                {
                    Properties.Settings.Default.user = md.Login;
                    Properties.Settings.Default.Save();
                    MessageBox.Show(md.Login + " conectado com sucesso !", "Bem Vindo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Application.ExitThread();

                    th = new Thread(TelaMain);

                    th.SetApartmentState(ApartmentState.STA);
                    th.Start();
                    msg  = md.Login;
                    desc = "LOGADO COM SUCESSO";
                    frm.NovoLogLogin(msg, desc);
                    Application.ExitThread();
                }
                else
                {
                    MessageBox.Show("Falha ao conectar. Verifique seu Login e Senha !", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tBoxLogin.Focus();
                    msg  = md.Login;
                    desc = "LOGIN FALHOU";
                    frm.NovoLogLogin(msg, desc);
                    pBoxLoading.Visible = false;
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                frm.NovoLogErro(ex.Message, ex.InnerException.ToString());
                pBoxLoading.Visible = false;
            }
        }
示例#7
0
        public ModUsuario VerificarSenha(string usuario, string senha)
        {
            p = new PerUsuario();
            v = p.Open();
            ModUsuario r = null;

            for (int i = 0; i < v.Count; i++)
            {
                if (usuario == v[i].Email && senha == v[i].Senha)
                {
                    r = v[i];
                    break;
                }
            }
            return(r);
        }
示例#8
0
        private void btnInserir_Click(object sender, EventArgs e)
        {
            tsCadStatus.Image = null;
            tsCadStatus.Text  = "";
            tempo.Start();
            tsCadProgress.Value = 0;

            string     mensagem = "";
            ModUsuario mod      = new ModUsuario();

            mod.Login = tBoxLogin.Text;
            mod.Senha = tBoxSenha.Text;
            if (rButtonAtivo.Checked == true)
            {
                mod.Status = true;
            }
            else
            {
                mod.Status = false;
            }
            mod.Tipo = cBoxTipo.Text;
            mod.Data = DateTime.Today.ToShortDateString();

            DALConexao cn = new DALConexao(DALDadosConexao.ConStr);
            BLLUsuario u  = new BLLUsuario(cn);

            mensagem = u.IncluirUsuaio(mod, tBoxLogin.TextLength, tBoxSenha.TextLength, tBoxSenha.Text, tBoxCSenha.Text);

            if (mensagem.Contains("sucesso"))
            {
                tsCadStatus.Text  = mensagem;
                tsCadStatus.Image = Properties.Resources.Sucesso;
            }
            else
            {
                tsCadStatus.Text  = mensagem;
                tsCadStatus.Image = Properties.Resources.Aviso;
            }
        }
示例#9
0
        //-------------------------------------------------\\
        #region Incluir
        public string Incluir(ModUsuario md)
        {
            string Validar = "Select * FROM TB_Usuario WHERE Login = '******'";

            cmd = new SqlCommand(Validar, conexao.Con);
            SqlDataReader DA = null;

            conexao.Conectar();
            DA = cmd.ExecuteReader();

            if (DA.Read())
            {
                return("Usuário já cadastrado !");
            }
            else
            {
                conexao.Desconectar();


                string inserir = "INSERT INTO TB_Usuario(Login," +
                                 "Senha," +
                                 "Tipo, " +
                                 "Status," +
                                 "Data_Cadastro)" +
                                 "VALUES(@Use, @Sen, @Tip, @Stat, @Data)";

                cmd = new SqlCommand(inserir, conexao.Con);
                cmd.Parameters.AddWithValue("@Use", md.Login);
                cmd.Parameters.AddWithValue("@Sen", md.Senha);
                cmd.Parameters.AddWithValue("@Tip", md.Tipo);
                cmd.Parameters.AddWithValue("@Stat", md.Status);
                cmd.Parameters.AddWithValue("@Data", md.Data);
                conexao.Conectar();
                cmd.ExecuteNonQuery();
                conexao.Desconectar();
                return("Cadastrado com sucesso !");
            }
        }
 public MenuPresidente(ModUsuario m)
 {
     InitializeComponent();
     p = m as ModPresidente;
 }
示例#11
0
        private void btnInserir_Click(object sender, EventArgs e)
        {
            string     mensagem = "";
            ModUsuario mod      = new ModUsuario();

            mod.Login = tBoxLogin.Text;
            mod.Senha = tBoxSenha.Text;
            if (rButtonAtivo.Checked == true)
            {
                mod.Status = true;
            }
            else
            {
                mod.Status = false;
            }
            mod.Tipo = cBoxTipo.Text;
            mod.Data = lblData.Text;

            DALConexao cn = new DALConexao(DALDadosConexao.ConStr);
            BLLUsuario u  = new BLLUsuario(cn);

            if (tBoxCSenha.Text == tBoxSenha.Text)
            {
                //mensagem = u.IncluirUsuaio(mod, tBoxLogin.TextLength, tBoxSenha.TextLength);

                if (mensagem.Contains("sucesso"))
                {
                    MessageBox.Show(mensagem, "sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tBoxLogin.Clear();
                    tBoxSenha.Clear();
                    tBoxCSenha.Clear();
                    cBoxTipo.SelectedIndex = 0;
                }
                else
                {
                    MessageBox.Show(mensagem, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("As senhas não são iguais", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tBoxCSenha.Focus();
            }



            /*
             *  string mensagem = "";
             *
             *  ModUsuario mod = new ModUsuario();
             *
             *  mod.Login = tBoxLogin.Text;
             *  mod.Senha = tBoxSenha.Text;
             *  if (rButtonAtivo.Checked == true)
             *      mod.Status = true;
             *  else
             *      mod.Status = false;
             *  mod.Tipo = cBoxTipo.Text;
             *  mod.Data = lblData.Text;
             *
             *  DALConexao cn = new DALConexao(DALDadosConexao.ConStr);
             *  BLLUsuario user = new BLLUsuario(cn);
             *  mensagem = user.IncluirUsuaio(mod);
             *
             *  Erro.Clear();
             *  MessageBox.Show(mensagem);
             */
        }
示例#12
0
 public MenuJogador(ModUsuario m)
 {
     InitializeComponent();
     j = m as ModJogador;
 }
示例#13
0
        public string ValidarUsuaio(ModUsuario md)
        {
            DALUsuario user = new DALUsuario(conexao);

            return(user.ValidaUsuario(md));
        }