📄 frmmodifiroomtype.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Hotel.Operation;
using Hotel.Entity;
namespace Hotel.UI
{
public partial class frmModifiRoomType : Form
{
RoomTypeAccess objRoomTypeAccess = null;
RoomType roomTypeEntity = null;
public frmModifiRoomType()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
//修改
objRoomTypeAccess = new RoomTypeAccess();
roomTypeEntity=new RoomType();
if (txtDayPrice.Text.Trim().Equals("") || txtHalfPrice.Text.Trim().Equals("") ||
txtHourPrice.Text.Trim().Equals("") || txtMoney.Text.Trim().Equals("") || cboDedCount.Text.Trim().Equals(""))
{
MessageBox.Show("请填写完整!","提示");
return;
}
roomTypeEntity.TypeNum=frmSystemSet.RType;
try
{
roomTypeEntity.PriceDay = float.Parse(txtDayPrice.Text.Trim().ToString());
roomTypeEntity.HalfDay = float.Parse(txtHalfPrice.Text.Trim().ToString());
roomTypeEntity.PriceHour = float.Parse(txtHourPrice.Text.Trim().ToString());
roomTypeEntity.Deposit = float.Parse(txtMoney.Text.Trim().ToString());
roomTypeEntity.BedCount = int.Parse(cboDedCount.Text.Trim().ToString());
}
catch(Exception ex)
{
MessageBox.Show(ex.Message,"提示");
return;
}
int k= objRoomTypeAccess.ModifiRoomPrice(roomTypeEntity);
if (k != 0)
{
MessageBox.Show("修改成功!", "提示");
this.Close();
}
else
{
MessageBox.Show("修改失败!","提示");
}
}
private void frmModifiRoomType_Load(object sender, EventArgs e)
{
//添加信息到界面
objRoomTypeAccess = new RoomTypeAccess();
roomTypeEntity = new RoomType();
txtRoomType.Text = objRoomTypeAccess.GetRoomTypeName(frmSystemSet.RType);
roomTypeEntity= objRoomTypeAccess.GetTypeInfo(frmSystemSet.RType);
txtDayPrice.Text = roomTypeEntity.PriceDay.ToString();
txtHalfPrice.Text = roomTypeEntity.HalfDay.ToString();
txtHourPrice.Text = roomTypeEntity.PriceHour.ToString();
txtMoney.Text = roomTypeEntity.Deposit.ToString();
cboDedCount.Text = roomTypeEntity.BedCount.ToString();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -