📄 roominfoui.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using ConnectDBLibrary;
using SetupOperDBLibrary;
using ShowInfoLibrary;
namespace UI
{
/// <summary>
/// RoomInfoUI 的摘要说明。
/// </summary>
public class RoomInfoUI : System.Windows.Forms.Form
{
//----房间设置----------------------
bool isLookAll_RoomInfo=true;//为0时查看所有
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ListView listView2;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.ColumnHeader columnHeader9;
private System.Windows.Forms.ColumnHeader columnHeader10;
private System.Windows.Forms.ColumnHeader columnHeader11;
private System.Windows.Forms.ColumnHeader columnHeader12;
private System.Windows.Forms.RadioButton radioButton2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public RoomInfoUI()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.listView2 = new System.Windows.Forms.ListView();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.columnHeader11 = new System.Windows.Forms.ColumnHeader();
this.columnHeader12 = new System.Windows.Forms.ColumnHeader();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.SuspendLayout();
//
// radioButton1
//
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(24, 160);
this.radioButton1.Name = "radioButton1";
this.radioButton1.TabIndex = 6;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "显示全部";
this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader4,
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader5,
this.columnHeader6});
this.listView1.FullRowSelect = true;
this.listView1.GridLines = true;
this.listView1.Location = new System.Drawing.Point(8, 8);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(472, 152);
this.listView1.TabIndex = 4;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// columnHeader4
//
this.columnHeader4.Text = "类型编号";
//
// columnHeader1
//
this.columnHeader1.Text = "房间类型";
this.columnHeader1.Width = 83;
//
// columnHeader2
//
this.columnHeader2.Text = "单价/天";
this.columnHeader2.Width = 66;
//
// columnHeader3
//
this.columnHeader3.Text = "单价/小时";
this.columnHeader3.Width = 71;
//
// columnHeader5
//
this.columnHeader5.Text = "床位数量";
//
// columnHeader6
//
this.columnHeader6.Text = "可否钟点计费(0/1)";
this.columnHeader6.Width = 127;
//
// listView2
//
this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader7,
this.columnHeader8,
this.columnHeader9,
this.columnHeader10,
this.columnHeader11,
this.columnHeader12});
this.listView2.FullRowSelect = true;
this.listView2.GridLines = true;
this.listView2.Location = new System.Drawing.Point(8, 184);
this.listView2.Name = "listView2";
this.listView2.Size = new System.Drawing.Size(472, 184);
this.listView2.TabIndex = 3;
this.listView2.View = System.Windows.Forms.View.Details;
//
// columnHeader7
//
this.columnHeader7.Text = "房间编号";
this.columnHeader7.Width = 70;
//
// columnHeader8
//
this.columnHeader8.Text = "房间类型";
this.columnHeader8.Width = 78;
//
// columnHeader9
//
this.columnHeader9.Text = "房间状态";
this.columnHeader9.Width = 71;
//
// columnHeader10
//
this.columnHeader10.Text = "所在区域";
this.columnHeader10.Width = 81;
//
// columnHeader11
//
this.columnHeader11.Text = "房间电话";
this.columnHeader11.Width = 90;
//
// columnHeader12
//
this.columnHeader12.Text = "门锁码";
this.columnHeader12.Width = 78;
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(144, 160);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(184, 24);
this.radioButton2.TabIndex = 5;
this.radioButton2.Text = "按选择的房间类型显示";
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// RoomInfoUI
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(488, 381);
this.Controls.Add(this.radioButton1);
this.Controls.Add(this.listView1);
this.Controls.Add(this.listView2);
this.Controls.Add(this.radioButton2);
this.Name = "RoomInfoUI";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "客房中心";
this.Load += new System.EventHandler(this.RoomInfoUI_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 查询房间类型
/// </summary>
public void ShowRoomtype()
{
try
{
TypeRoomData roomfata=new TypeRoomData();
SelectTypeRoom alltyperoom=new SelectTypeRoom();
alltyperoom.SelectAllTypeRoom(roomfata);
this.listView1.Items.Clear();
foreach(DataRow row in roomfata.TypeRoom.Rows)
{
ListViewItem item=new ListViewItem(row["Tid"].ToString());
item.SubItems.Add(row["TType"].ToString());
item.SubItems.Add(row["PriceByday"].ToString());
item.SubItems.Add(row["priceByhour"].ToString());
item.SubItems.Add(row["SetNum"].ToString());
item.SubItems.Add(row["IsTimeRoom"].ToString());
this.listView1.Items.Add(item);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
/// <summary>
/// 查询房间信息
/// </summary>
private void ShowRoominfo()
{
try
{
string Rtid="0";;
if(!this.isLookAll_RoomInfo)
{
if(this.listView1.SelectedItems.Count>0)
{
Rtid=this.listView1.SelectedItems[0].Text;
}
else
{
return;
}
}
RoomInfo_configData data=new RoomInfo_configData();
ShowSelectRoominfo_Config showRoom=new ShowSelectRoominfo_Config();
showRoom.SelectRoominfo_Config(data,Rtid);
this.listView2.Items.Clear();
foreach(DataRow row in data.RoomInfo_config_view.Rows)
{
ListViewItem item=new ListViewItem(row["rid"].ToString());
item.SubItems.Add(row["ttype"].ToString());
item.SubItems.Add(row["statetype"].ToString());
item.SubItems.Add(row["ingroup"].ToString());
item.SubItems.Add(row["roomtel"].ToString());
item.SubItems.Add(row["locknum"].ToString());
this.listView2.Items.Add(item);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
/// <summary>
/// 是否选择按房间类型查看房间信息
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
{
if(this.radioButton1.Checked)
{
this.isLookAll_RoomInfo=true;
ShowRoominfo();//显示房间信息
}
else
{
this.isLookAll_RoomInfo=false;
}
}
private void RoomInfoUI_Load(object sender, System.EventArgs e)
{
ShowRoomtype();//显示房间类别
ShowRoominfo();//显示房间信息
}
private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(this.isLookAll_RoomInfo)
{
return;
}
ShowRoominfo();//显示房间信息
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -