Example #1
0
//---------------------------------------------------------------------------
void __fastcall TForm1::MonthCalendar1Click(TObject *Sender)
{
	TMonthCalendar* tmc = ( TMonthCalendar* ) Sender;
	TDateTime tdt = tmc->Date;
	//changes date of the newly opened window to the selected date
	Form2->Label6->Caption = tdt.DateString();

	ListBox1->Clear();

	Appointment a;
	IOFile io;

	io.openFileInOut();
	io.fileClear();
	io.fileSeekG();
	a = io.fileRead(a);
	bool haveAppointments = false;

	while ( !io.eof() )
	{
		if ( a.getDate().compare( tdt.DateString().t_str() ) == 0 )
		{
			//adds the values in the listbox
			ListBox1->Items->Append( a.values().c_str() );

			haveAppointments = true;

			if ( haveAppointments == true )
			{
				Label4->Visible = true;
			}
		}
		else
		{
			haveAppointments == false;
		}
		a = io.fileRead(a);
	}
	io.closeFile();

	ListBox1->Sorted = true;

	if ( haveAppointments == false )
	{
		ListBox1->Items->Append("There are no Appointments on  " + tdt.DateString());
		Label4->Visible = false;
	}
}
Example #2
0
//---------------------------------------------------------------------------
void __fastcall TfrmSearch::BitBtn1Click(TObject *Sender)
{
//
    AnsiString sql,case1,case2;
    TDateTime dt = dt2->Date;
    dt+=1;
    sql = "SELECT * FROM TEST ";
    if(ckRadius->Checked){
        case1 = " WHERE ";
        case2 = " RADIUS='"+AnsiString(cbDevRadius->ItemIndex)+"' ";
        sql += case1+case2;
    }

    if(ckTime->Checked){
        //case1 = " WHERE ";

        if(ckRadius->Checked){
            sql +=" AND ";
        }else{
            sql +="  WHERE ";
        }
        case2 = " OPTTIME BETWEEN #"+dt1->DateTime.DateString()+\
        "# AND #" +dt.DateString()+"# ";
        sql +=case2;
    }

    query->Close();
    query->SQL->Text = sql;
    query->Open();
    

}