roomst.cpp

来自「机器须安装SQL Server2000 程序安装完之后」· C++ 代码 · 共 110 行

CPP
110
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "RoomSt.h"
#include "Main.h"
#include "DataMoudle.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TRoomStForm *RoomStForm;
//---------------------------------------------------------------------------
__fastcall TRoomStForm::TRoomStForm(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TRoomStForm::RadioButton3Click(TObject *Sender)
{
        DateTimePicker1->Visible=false;
        DateTimePicker2->Visible=false;
  

     


}
//---------------------------------------------------------------------------
void __fastcall TRoomStForm::RadioButton1Click(TObject *Sender)
{
     DateTimePicker1->Visible=false;
        DateTimePicker2->Visible=false;
      ComboBox1->Visible=true;
    
}
//---------------------------------------------------------------------------
void __fastcall TRoomStForm::RadioButton2Click(TObject *Sender)
{


          if(RadioButton2->Checked==true)
    {
        DateTimePicker1->Visible=true;
        DateTimePicker2->Visible=true;
    }





}
//---------------------------------------------------------------------------
void __fastcall TRoomStForm::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    MainForm->RoomSt=0;
    Action=caFree;
}
//---------------------------------------------------------------------------

void __fastcall TRoomStForm::BitBtn1Click(TObject *Sender)
{


         if(RadioButton1->Checked==true)
            {
                ADOQuery1->Active=false;
                ADOQuery1->SQL->CommaText="";
                ADOQuery1->SQL->CommaText="select roomNo as 房间号 from room where roomno not in (select roomno from roomorder where roomorder.orderNo in(select orderno from orders where orders.booked=1 or used=1)) and roomlevelcode ="+QuotedStr(ComboBox1->ItemIndex+1);
                ADOQuery1->Active=true;
            }



        if(RadioButton2->Checked==true)
            {
            ADOQuery1->Active=false;
            ADOQuery1->SQL->CommaText="";
            ADOQuery1->SQL->CommaText="select roomNo as 房间号 from room where roomno  in (select roomno from roomorder where roomorder.orderNo in(select orderno from orders where orders.booked=1 or used=0 and orders.startTime >"+QuotedStr(DateTimePicker1->Date.DateString())+"and orders.EndTime < "+QuotedStr(DateTimePicker2->Date.DateString())+")) and roomlevelcode ="+QuotedStr(ComboBox1->ItemIndex+1);
            ADOQuery1->Active=true;
            ComboBox1->Visible=true;
            }




}
//---------------------------------------------------------------------------

void __fastcall TRoomStForm::FormShow(TObject *Sender)
{
    ADOQuery1->Active=false;
    ADOQuery1->SQL->CommaText="";
    ADOQuery1->SQL->CommaText="select TypeName from roomType";
     ADOQuery1->Active=true;

         while(!ADOQuery1->Eof)
        {         //动态的把所证件类别添加在ComboBox组件里。

                ComboBox1->Items->Add(ADOQuery1->FieldByName("TypeName")->AsString);
                ADOQuery1->Next();
        }
     ADOQuery1->Active=false;
}
//---------------------------------------------------------------------------



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?