private void Accept_Click(object sender, EventArgs e) { nuser = LOGINTXT.Text; ErrorLOGIN.Text = ""; try { MySqlConnection connection = new MySqlConnection(Connection()); StringBuilder Command = new StringBuilder(); Command.Append("SELECT Empleado FROM `departaments-cca`.allowed where ID = '" + LOGINTXT.Text + "';"); MySqlCommand CMD = new MySqlCommand(Command.ToString(), connection); connection.Close(); connection.Open(); MySqlDataReader USER = CMD.ExecuteReader(); while (USER.Read()) { USERLbl.Text = USER[0].ToString(); GETUSER = USERLbl.Text; } if (USERLbl.Text != "UserName") { if (Paper == "Voucher") { Voucher TK = new Voucher(); AcceptLOGIN.Visible = false; LOGIN.Visible = false; LOGINTXT.Visible = false; LOGO.Visible = false; MiddlePanel.Controls.Add(TK); TK.Dock = DockStyle.Fill; StartTime.Interval = 1; StartTime.Start(); TK.Show(); CUPONESBtn.Image = Properties.Resources.icons8_voucher_50px_1; } else { Tiquet TK = new Tiquet(); AcceptLOGIN.Visible = false; LOGIN.Visible = false; LOGINTXT.Visible = false; LOGO.Visible = false; MiddlePanel.Controls.Add(TK); TK.Dock = DockStyle.Fill; StartTime.Interval = 1; StartTime.Start(); TK.Show(); TIQUETBtn.Image = Properties.Resources.icons8_purchase_order_50px_1; } } else { ErrorLOGIN.Text = "Usuari no trobat"; } } catch (Exception ex) { nuser = string.Empty; ErrorLOGIN.Text = "Usuari no trobat"; } }
private void TIQUETBtn_Click(object sender, EventArgs e) { CUPONESBtn.Image = Properties.Resources.icons8_voucher_50px; if (USERLbl.Text == "UserName") { Paper = "Tiquet"; AcceptLOGIN.Visible = true; LOGIN.Visible = true; LOGINTXT.Visible = true; LOGO.Visible = true; LOGINTXT.Focus(); } else { MiddlePanel.Controls.Clear(); Tiquet TK = new Tiquet(); MiddlePanel.Controls.Add(TK); TK.Dock = DockStyle.Fill; StartTime.Interval = 1; StartTime.Start(); TK.Show(); TIQUETBtn.Image = Properties.Resources.icons8_purchase_order_50px_1; } }