📄 roomsearchfrom.cs
字号:
this.btnBookIn.ForeColor = System.Drawing.SystemColors.Desktop;
this.btnBookIn.Image = ((System.Drawing.Image)(resources.GetObject("btnBookIn.Image")));
this.btnBookIn.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnBookIn.Location = new System.Drawing.Point(16, 216);
this.btnBookIn.Name = "btnBookIn";
this.btnBookIn.Size = new System.Drawing.Size(56, 24);
this.btnBookIn.TabIndex = 21;
this.btnBookIn.Text = "入住";
this.btnBookIn.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnBookIn.Click += new System.EventHandler(this.btnBookIn_Click);
//
// btnSearch
//
this.btnSearch.BackColor = System.Drawing.SystemColors.Window;
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.ForeColor = System.Drawing.SystemColors.Desktop;
this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSearch.Location = new System.Drawing.Point(16, 48);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(56, 24);
this.btnSearch.TabIndex = 20;
this.btnSearch.Text = "查找";
this.btnSearch.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.Image")));
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.Location = new System.Drawing.Point(16, 16);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(56, 23);
this.btnCancel.TabIndex = 16;
this.btnCancel.Text = "清空";
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Image = ((System.Drawing.Image)(resources.GetObject("btnExit.Image")));
this.btnExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExit.Location = new System.Drawing.Point(16, 368);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(56, 23);
this.btnExit.TabIndex = 15;
this.btnExit.Text = "退出";
this.btnExit.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// listView1
//
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3,
this.columnHeader4,
this.columnHeader5,
this.columnHeader6});
this.listView1.ForeColor = System.Drawing.SystemColors.Desktop;
this.listView1.FullRowSelect = true;
this.listView1.GridLines = true;
this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listView1.Location = new System.Drawing.Point(24, 136);
this.listView1.MultiSelect = false;
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(416, 296);
this.listView1.TabIndex = 23;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Text = "房间号";
//
// columnHeader2
//
this.columnHeader2.Text = "房间类型";
//
// columnHeader3
//
this.columnHeader3.Text = "房间楼层";
//
// columnHeader4
//
this.columnHeader4.Text = "额定人数";
//
// columnHeader5
//
this.columnHeader5.Text = "实际人数";
//
// columnHeader6
//
this.columnHeader6.Text = "备注";
this.columnHeader6.Width = 100;
//
// RoomSearchFrom
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(568, 438);
this.Controls.Add(this.listView1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.groupBox1);
this.Name = "RoomSearchFrom";
this.Text = "房间查询";
this.Load += new System.EventHandler(this.RoomSearchFrom_Load);
this.groupBox1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.txtRoomID.Text="";
this.cmbRoomType.Text="";
this.cmbRoomPosition.Text="";
this.cmbPeopleNum.Text="";
this.cmbFactPeopleNum.Text="";
this.txtRemark.Text="";
}
private void RoomSearchFrom_Load(object sender, System.EventArgs e)
{
this.bindlistview();
}
private void bindlistview()
{
RoomSearch Rsch=new RoomSearch(this.listView1);
RoomSearch.bindlistview(Rsch);
if(this.listView1.Items.Count>0)
{
int i=0;
this.ChangeTextValue(i);
}
}
private void ChangeTextValue(int i)
{
if(i>this.listView1.Items.Count)
{
i=0;
}
if(this.listView1.Items.Count>0)
{
this.txtRoomID.Text=this.listView1.Items[i].SubItems[0].Text.ToString();
this.cmbRoomType.Text=this.listView1.Items[i].SubItems[1].Text.ToString();
this.cmbRoomPosition.Text=this.listView1.Items[i].SubItems[2].Text.ToString();
this.cmbPeopleNum.Text=this.listView1.Items[i].SubItems[3].Text.ToString();
this.cmbFactPeopleNum.Text=this.listView1.Items[i].SubItems[4].Text.ToString();
this.txtRemark.Text=this.listView1.Items[i].SubItems[5].Text.ToString();
}
else
{
MessageBox.Show("没有记录");
}
}
private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
{
foreach(int i in this.listView1.SelectedIndices)
{
this.ChangeTextValue(i);
break;
}
}
private void btnEmptyRoom_Click(object sender, System.EventArgs e)
{
RoomSearch Rsch=new RoomSearch(this.listView1);
RoomSearch.findEmpty(Rsch);
if(this.listView1.Items.Count>0)
{
int i=0;
this.ChangeTextValue(i);
}
else
{
MessageBox.Show("没有空房间");
}
}
private void btnNotFull_Click(object sender, System.EventArgs e)
{
RoomSearch Rsch=new RoomSearch(this.listView1);
RoomSearch.findNotFull(Rsch);
if(this.listView1.Items.Count>0)
{
int i=0;
this.ChangeTextValue(i);
}
else
{
MessageBox.Show("没有未满房间");
}
}
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void btnBookIn_Click(object sender, System.EventArgs e)
{
int i;
for(i=0;i<this.listView1.Items.Count;i++)
{
if(this.listView1.Items[i].Selected==true)
{
break;
}
}
if(Convert.ToInt32(this.listView1.Items[i].SubItems[4].Text)<Convert.ToInt32(this.listView1.Items[i].SubItems[3].Text))
{
ClientBookIn Cbi=new ClientBookIn(this.listView1.Items[i].SubItems[0].Text.ToString());
Cbi.ShowDialog();
this.bindlistview();
}
else
{
MessageBox.Show("房间已经住满,不能再住");
}
}
private void btnSearch_Click(object sender, System.EventArgs e)
{
bool result=true;
string sql="select * from Room where ";
if(this.txtRoomID.Text!="")
{
sql+="RoomID='"+this.txtRoomID.Text+"'";
}
else
{
if(this.cmbRoomType.Text!="")
{
sql+="RTname='"+this.cmbRoomType.Text+"'";
result=false;
}
if(this.cmbRoomPosition.Text!="")
{
if(result)
{
sql+="Rposition='"+this.cmbRoomPosition.Text+"'";
}
else
{
sql+=" and Rposition='"+this.cmbRoomPosition.Text+"'";
}
result=false;
}
if(this.cmbPeopleNum.Text!="")
{
if(result)
{
sql+="PeopleNum="+this.cmbPeopleNum.Text.ToString();
}
else
{
sql+=" and PeopleNum="+this.cmbPeopleNum.Text.ToString();
}
result=false;
}
if(this.cmbFactPeopleNum.Text!="")
{
if(result)
{
sql+="FactPeopleNum="+this.cmbFactPeopleNum.Text.ToString();
}
else
{
sql+=" and FactPeopleNum="+this.cmbFactPeopleNum.Text.ToString();
}
result=false;
}
if(this.txtRemark.Text!="")
{
if(result)
{
sql+="Remark='"+this.txtRemark.Text+"'";
}
else
{
sql+=" and Remark='"+this.txtRemark.Text+"'";
}
result=false;
}
}
// MessageBox.Show(sql);
this.search(sql);
}
private void search(string sql)
{
RoomSearch Rsch=new RoomSearch(this.listView1);
RoomSearch.Search(Rsch,sql);
if(this.listView1.Items.Count>0)
{
int i=0;
this.ChangeTextValue(i);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -