Beispiel #1
0
        private void btnVENTAS_Click(object sender, EventArgs e)
        {
            using (BDAPOLOFEEntities db = new BDAPOLOFEEntities())
            {
                try
                {
                    string username = this.txtusuer.Text.Trim();
                    string password = this.txtclave.Text.Trim();
                    int    empresa  = Convert.ToInt32(this.cmb_empresa.SelectedValue);

                    var validacion = (from c in db.APOPERADOR
                                      where (c.CODIGO == username && c.CLAVE == password && c.EMPRESA == empresa)
                                      select c);

                    int resultado = validacion.Count();

                    if (resultado == 1)
                    {
                        FormMenu f = new FormMenu(Convert.ToInt32(this.cmb_empresa.SelectedValue), this.cmb_empresa.SelectedText);
                        f.WindowState = FormWindowState.Maximized;
                        f.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Datos Incorrectos", "Sistema Apolo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Sistema Apolo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Login log = new Login();

            log.Usuario  = txtUser.Text;
            log.Password = txtPass.Text;

            clsLogin clsl = new clsLogin();
            int      variabledeevaluacion = clsl.acceso(log);

            if (variabledeevaluacion == 1)
            {
                MessageBox.Show("WELCOM");
                FormMenu frm = new FormMenu();
                //para mostrar el usuario en una etiqueta
                frm.usuarioEstado = txtUser.Text;
                frm.Show();
                this.Hide();
            }

            else
            {
                MessageBox.Show("FALSE");
            }
        }
Beispiel #3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            FormMenu fm = new FormMenu();

            fm.Show();
            this.Hide();
        }
Beispiel #4
0
 private void btnDangNhap_Click(object sender, EventArgs e)
 {
     if (txtTaiKhoan.Text == "" || txtMatKhau.Text == "")
     {
         MessageBox.Show("Nhập tài khoản mật khẩu", "Thông báo");
     }
     else
     {
         UserDTO u = new UserDTO();
         u.TaiKhoan = txtTaiKhoan.Text;
         u.MatKhau  = txtMatKhau.Text;
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             if (dt.Rows[i]["TaiKhoan"].ToString() == u.TaiKhoan && dt.Rows[i]["MatKhau"].ToString() == u.MatKhau)
             {
                 FormMenu frm = new FormMenu();
                 frm.TaiKhoan    = u.TaiKhoan;
                 frm.MatKhau     = u.MatKhau;
                 frm.FormClosed += new FormClosedEventHandler(frm_FormClose);
                 frm.Show();
                 this.Hide();
                 return;
                 //closeForm();
             }
         }
         MessageBox.Show("Sai tài khoản mật khẩu", "Thông báo");
         txtMatKhau.Text  = "";
         txtTaiKhoan.Text = "";
     }
 }
        private void btnVolver_Click(object sender, EventArgs e)
        {
            this.Hide();
            FormMenu mainMenu = new FormMenu();

            mainMenu.Show();
            this.Dispose();
        }
Beispiel #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            Top10    top10 = new Top10();
            FormMenu menu  = new FormMenu();

            top10.Dispose();
            menu.Show();
        }
Beispiel #7
0
        public void LoginEstudante(string email, string senha)
        {
            try
            {
                string sqlLeitura = @"select * from estudante
                                      where email = @email and senha = @senha";

                MySqlCommand cmdMysql = new MySqlCommand(sqlLeitura, connection);

                cmdMysql.Parameters.AddWithValue("@email", email);
                cmdMysql.Parameters.AddWithValue("@senha", senha);

                connection.Open();

                MySqlDataReader data = cmdMysql.ExecuteReader();

                if (data.Read())
                {
                    string nivelAcesso = data.GetString("nivel_acesso");
                    id = int.Parse(data.GetString("id_estudante"));
                    if (nivelAcesso.Equals("Estudante"))
                    {
                        FormMenu menu = new FormMenu();
                        menu.MenuEmpresas.Enabled     = false;
                        menu.MenuEmpresas.Visible     = false;
                        menu.btnMaisIndicados.Visible = false;
                        CandidaturaDAO candidatura = new CandidaturaDAO();
                        menu.dgvMinhasVagas.DataSource = candidatura.RecuperarMinhasVagas(id);
                        VagaestagioDAO vaga = new VagaestagioDAO();
                        menu.dgvVagasOuEstudantes.DataSource = vaga.ReadVaga();
                        menu.cbVaga.DataSource    = vaga.ReadVaga();
                        menu.cbVaga.DisplayMember = "ID";
                        EstudantesDAO estudante = new EstudantesDAO();
                        menu.cbId.DataSource    = estudante.ReadEstudantes2(id);
                        menu.cbId.DisplayMember = "ID";
                        menu.cbId.Enabled       = false;
                        menu.Show();
                        connection.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Email ou senha incorretos!");
                    connection.Close();
                }
            }
            catch (Exception erroLogin)
            {
                MessageBox.Show("Erro ao logar, tente novamente! " + erroLogin);
                connection.Close();
            }
        }
 private void buttonEnter_Click(object sender, EventArgs e)
 {
     if (textBoxLogin.Text == "" && textBoxPassword.Text == "")
     {
         MessageBox.Show("Введите данные!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         bool key = false;
         foreach (Users user in Program.RBS_Project.Users)
         {
             if (textBoxLogin.Text == user.Login && textBoxPassword.Text == user.Password)
             {
                 key            = true;
                 users.login    = user.Login;
                 users.password = user.Password;
                 users.type     = user.Type;
                 if (user.Id_Staff != null)
                 {
                     users.name = user.StaffSet.LastName + " " + user.StaffSet.FirstName.Remove(1) + "." + user.StaffSet.MiddleName.Remove(1) + ".";
                 }
                 else
                 {
                     users.name = "admin";
                 }
             }
         }
         if (!key)
         {
             MessageBox.Show("Проверьте данные", "Пользователь не найден", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             FormMenu menu = new FormMenu(this);
             menu.Show();
             this.Hide();
         }
     }
 }
        private void BtnGiris_Click(object sender, EventArgs e)
        {
            string userName = txtKullaniciAdi.Text.ToLower().Trim();
            string userPass = txtSifre.Text.Trim();

            if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(userPass) && !userName.Equals("kullanıcı adı"))
            {
                var giris = HelperBorsaKullanici.checkUserLogin(userName, userPass);

                if (giris.Item1)
                {
                    if (giris.Item3)
                    {
                        MessageBox.Show("Bu kullanıcı pasif duruma geçmiştir.\n" +
                                        "Lütfen adminle iletişime geçiniz", "Kullanıcı Pasif Durumda", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        FormMenu fm = new FormMenu(giris.Item2);
                        fm.Show();
                        timerSayac.Start();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı!!! Lütfen tekrar deneyiniz...",
                                    "Giriş Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Kullanıcı Adı veya Şifre boş bırakılamaz!!!",
                                "Giriş Hata", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string usr = txtUsername.Text;
            string psw = txtPassword.Text;

            con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=I:/JasaEkspedisi/DB/DB_JasaEkspedisi.accdb;Persist Security Info = False;");
            cmd = new OleDbCommand();
            con.Open();
            cmd.Connection  = con;
            cmd.CommandText = "SELECT * FROM Login where username_login='******' AND password_login='******'";
            dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                FormMenu fm = new FormMenu();
                fm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Username or password is incorrect");
            }

            con.Close();
        }
Beispiel #11
0
        public void LoginEmpresa(string email, string senha)
        {
            try
            {
                string sqlLeitura = @"select * from empresa
                                      where email_recrut = @email and senha = @senha";

                MySqlCommand cmdMysql = new MySqlCommand(sqlLeitura, connection);

                cmdMysql.Parameters.AddWithValue("@email", email);
                cmdMysql.Parameters.AddWithValue("@senha", senha);

                connection.Open();

                MySqlDataReader data = cmdMysql.ExecuteReader();

                if (data.Read())
                {
                    string nivelAcesso = data.GetString("nivel_acesso");
                    int    id          = int.Parse(data.GetString("id_unidd_empresa"));
                    if (nivelAcesso.Equals("Empresa"))
                    {
                        FormMenu menu = new FormMenu();
                        menu.MenuEstudantes.Enabled     = false;
                        menu.MenuEstudantes.Visible     = false;
                        menu.labelIdVaga.Visible        = true;
                        menu.labelEscalaDominio.Visible = false;
                        menu.labelRequisito1.Visible    = false;
                        menu.labelRequisito2.Visible    = false;
                        menu.labelRequisito3.Visible    = false;
                        menu.txtDomReq1.Visible         = false;
                        menu.txtDomReq2.Visible         = false;
                        menu.txtDomReq3.Visible         = false;
                        menu.btnCandidatar.Visible      = false;
                        EmpresaDAO empresaDao = new EmpresaDAO();
                        menu.cbId.DataSource    = empresaDao.ReadEmpresas2(id);
                        menu.cbId.DisplayMember = "ID";
                        menu.cbId.Enabled       = false;
                        EstudantesDAO estudantes = new EstudantesDAO();
                        menu.dgvVagasOuEstudantes.DataSource = estudantes.ReadEstudantes();
                        menu.cbVaga.DataSource    = estudantes.ReadEstudantes();
                        menu.cbVaga.DisplayMember = "ID";
                        VagaestagioDAO vagas = new VagaestagioDAO();
                        menu.dgvMinhasVagas.DataSource = vagas.ReadVaga2(id);
                        menu.cbVaga.DataSource         = vagas.ReadVaga2(id);
                        menu.cbVaga.DisplayMember      = "ID";
                        menu.Show();
                        connection.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Email ou senha incorretos!");
                    connection.Close();
                }
            }
            catch (Exception erroLogin)
            {
                MessageBox.Show("Erro ao logar, tente novamente! " + erroLogin);
                connection.Close();
            }
        }
        private void KullaniciKaydet()
        {
            bool durumKullanici = KullaniciAdiKontrol(txtKullaniciAdi.Text);
            bool durumVeri      = string.IsNullOrEmpty(txtKullaniciAdi.Text) ||
                                  string.IsNullOrEmpty(txtSifre.Text) ||
                                  string.IsNullOrEmpty(txtSifreTekrar.Text) ||
                                  string.IsNullOrEmpty(txtAd.Text) ||
                                  string.IsNullOrEmpty(txtSoyad.Text) ||
                                  string.IsNullOrEmpty(txtTcKimlikNo.Text) ||
                                  cmbTip.SelectedIndex == -1;


            if (durumVeri)
            {
                MessageBox.Show("Lütfen tüm bilgileri doldurun!", "Kayıt Hatası", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (durumKullanici)
                {
                    bool durumTCKimlik = TcKimlikNoKontrol(txtTcKimlikNo.Text);
                    if (durumTCKimlik)
                    {
                        BorsaKullanici b = new BorsaKullanici()
                        {
                            Tur          = cmbTip.SelectedIndex + 1,
                            KullaniciAdi = txtKullaniciAdi.Text,
                            Sifre        = txtSifre.Text,
                            TcKimlikNo   = txtTcKimlikNo.Text,
                            Adi          = txtAd.Text.Trim().ToLower(),
                            Soyadi       = txtSoyad.Text.Trim().ToUpper(),
                            DogumTarihi  = dtpDogumTarihi.Value,
                            Telefon      = mTxtTelefon.Text,
                            Email        = txtMail.Text,
                            Adres        = txtAdres.Text,
                            isDeleted    = false,
                            KayitTarihi  = DateTime.Now
                        };

                        var durumKayit = HelperBorsaKullanici.CUD(b, EntityState.Added);
                        if (durumKayit.Item1)
                        {
                            if (admin)
                            {
                                MessageBox.Show("Kullanıcı Kaydı Başarılı.");
                            }
                            else
                            {
                                MessageBox.Show("Kullanıcı Kaydı Başarılı. Ana Menuye Yönlendiriliyorsunuz...",
                                                "Kayıt Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                int      giris = HelperBorsaKullanici.getIDfromUser(txtKullaniciAdi.Text);
                                FormMenu fm    = new FormMenu(giris);
                                fm.Show();
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Kayıt sırasında bir hata oluştu.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Lütfen geçerli bir TC Kimlik No giriniz.", "Kimlik No Hatası", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }