示例#1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            string sql = "select * from tb_users " +
                         "where username ='******' and " +
                         "password = '******' ";
            SqlDataAdapter da = new SqlDataAdapter(sql, con);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("ไม่พบข้อมูล");
                return;
            }
            // พบข้อมูล
            //1. admin
            if (dt.Rows[0]["status_id"].ToString() == "admin")
            {
                //MessageBox.Show("พบข้อมูล");
                //return;
                frmAdmin frm = new frmAdmin(dt.Rows[0]["status_id"].ToString());
                frm.Show();
                this.Hide();
            }
            else if (dt.Rows[0]["status_id"].ToString() == "user")
            {
                menu frm = new menu(dt.Rows[0]["status_id"].ToString(), dt.Rows[0]["student_id"].ToString());
                frm.Show();
                this.Hide();
            }
        }
示例#2
0
        private void label1_Click(object sender, EventArgs e)
        {
            menu menu = new menu();

            menu.Show();
            this.Hide();
        }
示例#3
0
        private void gunaGradientButton1_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand("Select pass from Accounts where username = '******'", cn);

            cn.Open();
            if (cmd.ExecuteScalar() != null)
            {
                string s  = cmd.ExecuteScalar().ToString();
                string s1 = CalculateMD5Hash(gunaTextBox1.Text).ToString();
                if (s1.ToString() == s.ToString())
                {
                    SqlCommand cmd1    = new SqlCommand("Select permLevel from Accounts where username = '******'", cn);
                    int        permlvl = Convert.ToInt32(cmd1.ExecuteScalar());
                    menu       menu    = new menu();
                    menu.permleve = permlvl;
                    menu.Show();
                    menu.Text = "Menu Principal Session : [" + TxtLogin.Text.ToString() + "]";
                    this.Hide();
                }
                else
                {
                    txtWrong.Text      = "Mot de passe ou nom d'utilisateur inconnu veuillez verifier vos information";
                    txtWrong.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                txtWrong.Text      = "Mot de passe ou nom d'utilisateur inconnu veuillez verifier vos information";
                txtWrong.ForeColor = System.Drawing.Color.Red;
            }
            cn.Close();
        }
示例#4
0
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            //Abraão a criptografia n tem q ficar apenas no cadastro do login.
            //Aqui é uma consulta, é só pegar os campos e mandar pra business, n precisa de uma model.
            //A business q vai comparar as infos daqui com a model ai dps abre a tela.
            //Ex:Se a senha e o nome for tal n vai poder abrir tais telas. isso tudo fica na business.
            string nome  = txtNome.Text;
            string senha = txtSenha.Text;

            Bistro.menu tela = new menu();

            //Isso é para estar na business.
            //{
            if (nome == "adm" && senha == "1234")
            {
                tela.Show();
            }
            //}
            ObjAux.Criptografia Crip = new ObjAux.Criptografia();
            string crip_nome         = Crip.Criptografar(nome);
            string crip_senha        = Crip.Criptografar(senha);

            Database.Entity.tb_login login = new Database.Entity.tb_login();
            login.nm_senha   = crip_nome;
            login.nm_usuario = crip_senha;


            Business.BusinessLogin   bs  = new Business.BusinessLogin();
            Database.Entity.tb_login tbs = bs.Consultar(login);

            if (tbs == null)
            {
                throw new ArgumentException("Credenciais invalidas.");
            }

            Models.UsuarioLogado.Usuario = tbs;

            tela.Show();
        }
示例#5
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1_Land.Text.Trim() != "" && textBox1_Land.Text.Trim().Length < 20 && textBox2_Land.Text.Trim() != "" && textBox2_Land.Text.Trim().Length < 20)
     {
         using (SqlConnection con = new SqlConnection("Server=" + SQLUSER.Server_user + ";user="******";pwd=" + SQLUSER.pwd_user + ";database=" + SQLUSER.database_user + ""))
         {
             try
             {
                 con.Open();
                 SqlCommand    com = new SqlCommand("select * from Boollan003 where name='" + textBox1_Land.Text.Trim() + "'", con);
                 SqlDataReader dar = com.ExecuteReader();
                 if (dar.Read() == true)
                 {
                     string sqlpassword = dar.GetString(dar.GetOrdinal("password"));
                     name = dar.GetString(dar.GetOrdinal("name"));
                     if (textBox2_Land.Text.Trim() == sqlpassword)
                     {
                         //执行跳转
                         menu menu = new menu();
                         this.Hide();
                         menu.Show();
                     }
                     else
                     {
                         MessageBox.Show("您输入的密码错误", "温馨提示");
                     }
                 }
                 else
                 {
                     MessageBox.Show("用户名不存在请先注册", "温馨提示");
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show("错误:服务器连接失败或其他错误");
             }
         }
     }
     else
     {
         MessageBox.Show("抱歉抱歉你您输入的信息有误\n用户不能为空,长度不大于20位", "银古温馨提示");
     }
 }
示例#6
0
 private void bunifuThinButton21_Click(object sender, EventArgs e)
 {
     kuadi   = kua.Text;
     sifresi = sifre.Text;
     con     = new SqlConnection(veri.source);
     cmd     = new SqlCommand();
     con.Open();
     cmd.Connection  = con;
     cmd.CommandText = "SELECT * FROM hesap where kuadi='" + kuadi + "' AND sifre='" + sifresi + "'";
     dr = cmd.ExecuteReader();
     if (dr.Read())
     {
         menu yeni = new menu();
         yeni.Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show("Kullanıcı adını ve şifrenizi kontrol ediniz.");
     }
     con.Close();
 }
示例#7
0
        private void bn_login_Click(object sender, EventArgs e)
        {
            if (radioManage.Checked == true)
            {

                if (Mytool.checkmanageaccount(this.textaccount.Text.Trim(), this.textpassword.Text))
                {
                    managemenu manmenu = new managemenu(this);
                    manmenu.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("帐号或者密码错误");

                }
            }
            if (radioUser.Checked == true)
            {
                if (Mytool.checkuseraccount(this.textaccount.Text.Trim(), this.textpassword.Text))
                {
                    Mytool.currentusername = Mytool.getusername(this.textaccount.Text.Trim());
                    Mytool.currentuseraccount = this.textaccount.Text.Trim();
                    this.Hide();
                    menu menu = new menu(this);
                    menu.Show();

                }
                else
                {
                    MessageBox.Show("帐号或者密码错误");

                }

            }
        }
        private void button1_Click(object sender, EventArgs e)

        {
            arac arac = new arac();



            arac = _calısanlar.getSorgu(textBox1.Text, textBox2.Text);

            if ((arac.kullaniciadi == null) || (arac.sifre == null))
            {
                MessageBox.Show("Hatalı Giris Yaptınız!!!");
            }
            else
            {
                this.Hide();
                MessageBox.Show("Sisteme Hoşgeldiniz :" + arac.kullaniciadi);
            }


            menu menu = new menu();

            menu.Show();
        }
示例#9
0
文件: menu.cs 项目: assassinLX/FSM
    static void CreatMyStateFile()
    {
        menu win = (menu)EditorWindow.GetWindow(typeof(menu));

        win.Show();
    }