当前位置:首页 > 《HHL酒店管理系统》课程设计报告书V1.0 - 图文
6.系统实现
以下是本系统主要的八大功能的实现,包括了开房登记、换房、续房、结账退房、营业查询、住宿记录、房间类型管理、房间信息管理。
6.1开房登记功能的实现
代码如下:
SqlConnection cnn = myCon.getCon();
string sql = \ +
Convert.ToDateTime(txttime.Text.ToString())+ \ +
Convert.ToDateTime(dateTimePicker1.Text.ToString()) + \ + cmbID.SelectedItem.ToString() + \; cnn.Open();
SqlCommand cmd = new SqlCommand(sql, cnn); cmd.ExecuteNonQuery();
//正则表达式
string chardid = @\;
string phone = @\;
if (txtname.Text == \) {
MessageBox.Show(\姓名不能为空\); }
else if (cmbsex.Text == \) {
MessageBox.Show(\性别不能为空\); }
else if (cmbtype.Text == \) {
MessageBox.Show(\类型不能为空\); }
else if (cmbID.Text == \) {
MessageBox.Show(\房号不能为空\); }
else if (txtpr.Text == \) {
MessageBox.Show(\押金不能为空\); }
else if (txtroompr.Text == \) {
- 17 -
MessageBox.Show(\房费不能为空\); }
else if (txtphone.Text == \) {
MessageBox.Show(\电话号码不能为空\); }
else if (txtcardid.Text == \) {
MessageBox.Show(\身份证不能为空\); }
else if (!Regex.IsMatch(txtphone.Text, phone)) {
MessageBox.Show(\电话号码只能是为数字,并且第一位为,第二位为,5,8\); }
else if (!Regex.IsMatch(txtcardid.Text, chardid)) {
MessageBox.Show(\身份证只能是或位,为的最后一位是【X|x】\); }
else {
CustomerInf sti = new CustomerInf();
sti.Name = txtname.Text.Trim().ToString(); sti.Sex = cmbsex.SelectedItem.ToString();
sti.Id = Convert.ToInt32(cmbID.SelectedItem.ToString()); sti.Amoney = Convert.ToInt32(txtpr.Text); sti.Moeny = Convert.ToInt32(txtroompr.Text); sti.Phone = txtphone.Text.Trim().ToString(); sti.Cardid = txtcardid.Text.Trim().ToString(); sti.DaoqTime = dateTimePicker1.Text.ToString(); sti.Notes = txtinf.Text.Trim().ToString();
bool v = BLL.CustomerBLL.BllSelectNullRoom(sti); bool insertroom =
BLL.CustomerBLL.BllinsertRoom(Convert.ToInt32(txtroompr.Text), Convert.ToInt32(cmbID.SelectedItem.ToString()));
if (v) {
- 18 -
MessageBox.Show(\添加成功。。。\); }
ds = BLL.CustomerBLL.BllSelect();
dataGridView1.DataSource = ds.Tables[0];
} 运行结果: 先输入客户信息
- 19 -
点击“确定登记”按钮后
- 20 -
共分享92篇相关文档