📄 roomstatus.h
字号:
#pragma once
#include "LinkDataBase.h"
#include "DataGridImageColumn.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace My
{
/// <summary>
/// RoomStatus 摘要
///
/// 警告: 如果您更改该类的名称,则将需要更改
/// 与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。 否则,
/// 设计器将不能与此窗体关联的
/// 本地化资源正确交互。
/// </summary>
public __gc class RoomStatus : public System::Windows::Forms::Form
{
//--------------------成员声明------------------------
private:
LinkDataBase* MyDataBase; //数据库连接类
SqlDataAdapter* RoomAdapter;
DataTable* RoomTable;
DataSet* ds;
String* strTableName;
String* strSQL;
CurrencyManager* cmRoom;
ArrayList* RoomNumPerFloor;
int FloorNum;
bool IsCallByOther;
public:
String* strRoomID;
String* strRoomType;
String* strRoomStatus;
//-------------------成员声明结束-----------------------
public:
RoomStatus(bool _CallByOther)
{
InitializeComponent();
//初始化
this->MyDataBase = new LinkDataBase();
this->ds = new DataSet();
this->RoomAdapter = new SqlDataAdapter();
this->RoomTable = new DataTable();
this->RoomNumPerFloor = new ArrayList();
this->IsCallByOther = _CallByOther;
//查询客房信息
this->strSQL = S"Select * from 客房信息";
this->strTableName = S"客房信息";
this->MyDataBase->SelectDataBase(this->RoomAdapter,this->ds,this->strSQL,this->strTableName);
this->cmRoom = __try_cast<CurrencyManager*>(this->BindingContext->Item[this->ds->Tables->Item[S"客房信息"]]);
//填充[客房类型]的选项
String* tempSQL = S"Select distinct 类型名称,类型编号 from 客房类型";
this->MyDataBase->SelectDataBase(this->ds,tempSQL,S"客房类型");
//添加"全部"选项
DataRow* row = this->ds->Tables->Item[S"客房类型"]->NewRow();
row->Item[S"类型名称"] = S"全部类型";
row->Item[S"类型编号"] = S"All";
this->ds->Tables->Item[S"客房类型"]->Rows->Add(row);
this->cmbRoomType->DataSource = this->ds->Tables->Item[S"客房类型"];
this->cmbRoomType->DisplayMember = S"类型名称";
this->cmbRoomType->ValueMember = S"类型编号";
//填充[楼层]的选项
tempSQL = S"Select 楼层名称,楼层编号 from 楼层信息 Order By 楼层编号";
this->MyDataBase->SelectDataBase(this->ds,tempSQL,S"楼层信息");
//计算每层楼的房间数
this->FloorNum = this->ds->Tables->Item[S"楼层信息"]->Rows->Count;
String* FloorID;
String* Filter;
DataRow* rows[];
for(int i = 0;i < this->FloorNum;i++)
{
FloorID = this->ds->Tables->Item[S"楼层信息"]->Rows->Item[i]->Item[S"楼层编号"]->ToString();
Filter = String::Format(S"楼层编号 = {0}",FloorID);
rows = this->ds->Tables->Item[S"客房信息"]->Select(Filter);
this->RoomNumPerFloor->Add(__box(rows->Length));
}
//设置DataGrid
this->DataGridStateControl();
this->dgrdRoom->ReadOnly = true;
//设置控件ReadOnly属性
// this->SetModify(false);
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::ImageList * imageList1;
private: System::Windows::Forms::GroupBox * groupBox1;
private: System::Windows::Forms::Button * btnRefresh;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::Label * label2;
private: System::Windows::Forms::RadioButton * radioBlank;
private: System::Windows::Forms::RadioButton * radioRent;
private: System::Windows::Forms::RadioButton * radioSelfUse;
private: System::Windows::Forms::RadioButton * radioFixing;
private: System::Windows::Forms::RadioButton * radioAboard;
private: System::Windows::Forms::RadioButton * radioAbort;
private: System::Windows::Forms::Button * btnChangeStatus;
private: System::Windows::Forms::TextBox * tBoxRoomID;
private: System::Windows::Forms::ComboBox * cmbRoomType;
private: System::Windows::Forms::DataGrid * dgrdRoom;
private: System::ComponentModel::IContainer * components;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->components = new System::ComponentModel::Container();
System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(My::RoomStatus));
this->imageList1 = new System::Windows::Forms::ImageList(this->components);
this->groupBox1 = new System::Windows::Forms::GroupBox();
this->label1 = new System::Windows::Forms::Label();
this->cmbRoomType = new System::Windows::Forms::ComboBox();
this->tBoxRoomID = new System::Windows::Forms::TextBox();
this->radioBlank = new System::Windows::Forms::RadioButton();
this->btnRefresh = new System::Windows::Forms::Button();
this->label2 = new System::Windows::Forms::Label();
this->radioRent = new System::Windows::Forms::RadioButton();
this->radioSelfUse = new System::Windows::Forms::RadioButton();
this->radioFixing = new System::Windows::Forms::RadioButton();
this->radioAboard = new System::Windows::Forms::RadioButton();
this->radioAbort = new System::Windows::Forms::RadioButton();
this->btnChangeStatus = new System::Windows::Forms::Button();
this->dgrdRoom = new System::Windows::Forms::DataGrid();
this->groupBox1->SuspendLayout();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdRoom))->BeginInit();
this->SuspendLayout();
//
// imageList1
//
this->imageList1->ImageSize = System::Drawing::Size(32, 32);
this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer * >(resources->GetObject(S"imageList1.ImageStream")));
this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
//
// groupBox1
//
this->groupBox1->Controls->Add(this->label1);
this->groupBox1->Controls->Add(this->cmbRoomType);
this->groupBox1->Controls->Add(this->tBoxRoomID);
this->groupBox1->Controls->Add(this->radioBlank);
this->groupBox1->Controls->Add(this->btnRefresh);
this->groupBox1->Controls->Add(this->label2);
this->groupBox1->Controls->Add(this->radioRent);
this->groupBox1->Controls->Add(this->radioSelfUse);
this->groupBox1->Controls->Add(this->radioFixing);
this->groupBox1->Controls->Add(this->radioAboard);
this->groupBox1->Controls->Add(this->radioAbort);
this->groupBox1->Controls->Add(this->btnChangeStatus);
this->groupBox1->Dock = System::Windows::Forms::DockStyle::Left;
this->groupBox1->Location = System::Drawing::Point(0, 0);
this->groupBox1->Name = S"groupBox1";
this->groupBox1->Size = System::Drawing::Size(200, 382);
this->groupBox1->TabIndex = 0;
this->groupBox1->TabStop = false;
//
// label1
//
this->label1->Location = System::Drawing::Point(8, 56);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(48, 24);
this->label1->TabIndex = 4;
this->label1->Text = S"房号";
//
// cmbRoomType
//
this->cmbRoomType->Enabled = false;
this->cmbRoomType->Location = System::Drawing::Point(64, 88);
this->cmbRoomType->Name = S"cmbRoomType";
this->cmbRoomType->Size = System::Drawing::Size(104, 20);
this->cmbRoomType->TabIndex = 3;
//
// tBoxRoomID
//
this->tBoxRoomID->Location = System::Drawing::Point(64, 56);
this->tBoxRoomID->Name = S"tBoxRoomID";
this->tBoxRoomID->ReadOnly = true;
this->tBoxRoomID->Size = System::Drawing::Size(104, 21);
this->tBoxRoomID->TabIndex = 2;
this->tBoxRoomID->Text = S"";
//
// radioBlank
//
this->radioBlank->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
this->radioBlank->ImageIndex = 2;
this->radioBlank->ImageList = this->imageList1;
this->radioBlank->Location = System::Drawing::Point(64, 120);
this->radioBlank->Name = S"radioBlank";
this->radioBlank->Size = System::Drawing::Size(88, 32);
this->radioBlank->TabIndex = 1;
this->radioBlank->Text = S"空房";
//
// btnRefresh
//
this->btnRefresh->Location = System::Drawing::Point(24, 24);
this->btnRefresh->Name = S"btnRefresh";
this->btnRefresh->Size = System::Drawing::Size(144, 24);
this->btnRefresh->TabIndex = 0;
this->btnRefresh->Text = S"刷新房态信息";
this->btnRefresh->Click += new System::EventHandler(this, btnRefresh_Click);
//
// label2
//
this->label2->Location = System::Drawing::Point(8, 88);
this->label2->Name = S"label2";
this->label2->Size = System::Drawing::Size(48, 24);
this->label2->TabIndex = 4;
this->label2->Text = S"类型";
//
// radioRent
//
this->radioRent->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
this->radioRent->ImageIndex = 4;
this->radioRent->ImageList = this->imageList1;
this->radioRent->Location = System::Drawing::Point(64, 152);
this->radioRent->Name = S"radioRent";
this->radioRent->Size = System::Drawing::Size(88, 32);
this->radioRent->TabIndex = 1;
this->radioRent->Text = S"住房";
//
// radioSelfUse
//
this->radioSelfUse->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
this->radioSelfUse->ImageIndex = 5;
this->radioSelfUse->ImageList = this->imageList1;
this->radioSelfUse->Location = System::Drawing::Point(64, 184);
this->radioSelfUse->Name = S"radioSelfUse";
this->radioSelfUse->Size = System::Drawing::Size(88, 32);
this->radioSelfUse->TabIndex = 1;
this->radioSelfUse->Text = S"自用";
//
// radioFixing
//
this->radioFixing->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
this->radioFixing->ImageIndex = 3;
this->radioFixing->ImageList = this->imageList1;
this->radioFixing->Location = System::Drawing::Point(64, 216);
this->radioFixing->Name = S"radioFixing";
this->radioFixing->Size = System::Drawing::Size(88, 32);
this->radioFixing->TabIndex = 1;
this->radioFixing->Text = S"维修";
//
// radioAboard
//
this->radioAboard->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
this->radioAboard->ImageIndex = 0;
this->radioAboard->ImageList = this->imageList1;
this->radioAboard->Location = System::Drawing::Point(64, 248);
this->radioAboard->Name = S"radioAboard";
this->radioAboard->Size = System::Drawing::Size(88, 32);
this->radioAboard->TabIndex = 1;
this->radioAboard->Text = S"将到";
//
// radioAbort
//
this->radioAbort->ImageAlign = System::Drawing::ContentAlignment::MiddleRight;
this->radioAbort->ImageIndex = 1;
this->radioAbort->ImageList = this->imageList1;
this->radioAbort->Location = System::Drawing::Point(64, 280);
this->radioAbort->Name = S"radioAbort";
this->radioAbort->Size = System::Drawing::Size(88, 32);
this->radioAbort->TabIndex = 1;
this->radioAbort->Text = S"将离";
//
// btnChangeStatus
//
this->btnChangeStatus->Location = System::Drawing::Point(24, 320);
this->btnChangeStatus->Name = S"btnChangeStatus";
this->btnChangeStatus->Size = System::Drawing::Size(144, 24);
this->btnChangeStatus->TabIndex = 0;
this->btnChangeStatus->Text = S"更改房间状态";
this->btnChangeStatus->Click += new System::EventHandler(this, btnChangeStatus_Click);
//
// dgrdRoom
//
this->dgrdRoom->DataMember = S"";
this->dgrdRoom->Dock = System::Windows::Forms::DockStyle::Fill;
this->dgrdRoom->HeaderForeColor = System::Drawing::SystemColors::ControlText;
this->dgrdRoom->Location = System::Drawing::Point(200, 0);
this->dgrdRoom->Name = S"dgrdRoom";
this->dgrdRoom->Size = System::Drawing::Size(488, 382);
this->dgrdRoom->TabIndex = 1;
this->dgrdRoom->Click += new System::EventHandler(this, dgrdRoom_Click);
this->dgrdRoom->DoubleClick += new System::EventHandler(this, dgrdRoom_DoubleClick);
//
// RoomStatus
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -