-
Notifications
You must be signed in to change notification settings - Fork 1
/
frmCadastro.cs
86 lines (77 loc) · 2.55 KB
/
frmCadastro.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using OrderPizza.DAO;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OrderPizza
{
public partial class frmCadastro : Form
{
int X = 0;
int Y = 0;
public frmCadastro()
{
InitializeComponent();
}
private void btnCadFunc_Click_Click(object sender, EventArgs e)
{
string login;
string senha;
string tipo;
if (string.IsNullOrEmpty(txbLogin.Text)){
MessageBox.Show("O campo login está vazio, verifique e tente novamente!!", "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txbLogin.Focus();
return;
}
if (string.IsNullOrEmpty(txbSenha.Text)) {
MessageBox.Show("O campo senha está vazio, verifique e tente novamente!!", "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txbSenha.Focus();
}
else
{
login = txbLogin.Text;
senha = txbSenha.Text;
tipo = cbxTipoUsu.Text;
var dao = new FuncionarioDAO();
if (dao.InsertUsuario(login, senha, tipo))
{
MessageBox.Show("Usuario cadastrado com sucesso!", "Sucesso!",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
txbLogin.Text = string.Empty;
txbSenha.Text = string.Empty;
}
}
private void btnFechar_Click(object sender, EventArgs e)
{
this.Hide();
}
private void btnMinimizar_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void frmCadastro_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
X = this.Left - MousePosition.X;
Y = this.Top - MousePosition.Y;
}
private void frmCadastro_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Left) return;
this.Left = X + MousePosition.X;
this.Top = Y + MousePosition.Y;
}
}
}