string mysql = "SELECT * FROM tb_User WHERE username = '" + us + "' and senha = '" + pw + "'";
using (SqlConnection myconn = new SqlConnection(CnxGeral.stringConexaoRH()))
----------------------------------------------------------------------------------------------
public partial class frmLogin : Form
{
DAL.Funcionario FuncDal = new DAL.Funcionario();
public frmLogin()
{
InitializeComponent();
}
private void btCancelar_Click(object sender, EventArgs e)
{
this.Close();
}
private void btEntra_Click(object sender, EventArgs e)
{
DAL.loginDal ldDal = new DAL.loginDal();
FuncDal.namUser = tbUser.Text;
FuncDal.UserLevel = FuncDal.getFuncLevel(FuncDal.namUser);
FuncDal.func_ID = FuncDal.getFuncId(FuncDal.namUser);
if(ldDal.podLogar(tbUser.Text,tbPw.Text))
{
MessageBox.Show("usuario" + FuncDal.func_ID);
this.Hide();
UIL.frmMain fm = new UIL.frmMain();
fm.ShowDialog();
this.Close();
}
else
{
MessageBox.Show("Usuário ou Senha Errados");
_-------------------------------------------------------------------------------------------------------
//Main form, it doesn't get username returns empty
public partial class frmMain : Form
{
DateTime Data_hora;
DAL.Funcionario FuncDal = new DAL.Funcionario();
frmLogin frmlog = new frmLogin();
public frmMain()
{
InitializeComponent();
}
private void btFecha_Click(object sender, EventArgs e)
{
this.Hide();
frmLogin frmlg = new frmLogin();
frmlg.ShowDialog();
this.Close();
}
private void funcionárioToolStripMenuItem_Click(object sender, EventArgs e)
{
frmFunc funcionarioFrm = new frmFunc();
funcionarioFrm.ShowDialog();
}
private void frmMain_Load(object sender, EventArgs e)
{
String NomeF = FuncDal.getFuncNam(FuncDal.getFuncId(FuncDal.namUser));
lbUserName.Text = "Nome do Usuário: " + NomeF;
MessageBox.Show("" + FuncDal.getFuncId(FuncDal.namUser)); //return "", but i want to get usename
}
private void timer1_Tick(object sender, EventArgs e)
{
Data_hora = DateTime.Now;
lbTime.Text = Data_hora.ToLongTimeString();
}
}
----------------------------------------------------------------------------------------
Sousa