📄 enrolform.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HotelManagerBLL;
using HotelManagerModels;
namespace HotelManager
{
public partial class EnrolForm : Form
{
UserInfoBLL bll = new UserInfoBLL();
public EnrolForm()
{
InitializeComponent();
}
//***********添加用户之前先判断
private void btnEnrol_Click(object sender, EventArgs e)
{
if (txtName.Text == "" || txtPassword.Text == "" || txtEmail.Text == "" || txtDepartment.Text == "")
{
MessageBox.Show("请尚有信息未填写!");
return;
}
else
{
try
{
//封装用户信息
UserInfo u = new UserInfo();
u.Name = txtName.Text.ToString();
u.Password = txtPassword.Text.ToString();
u.Department = txtDepartment.Text.ToString();
u.Email = txtEmail.Text.ToString();
if (rdoM.Checked == true)
{
u.Gender = 0;
}
else
{
u.Gender = 1;
}
if (cboType.SelectedIndex == 0)
{
u.Type = 1;
}
else
{
u.Type = 2;
}
//添加到数据库
bll.InsertUserInfo(u);
MessageBox.Show("恭喜你!注册成功!");
txtDepartment.Text = "";
txtEmail.Text = "";
txtName.Text = "";
txtPassword.Text = "";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -