?? unit1.pas
字號(hào):
begin
windowsMediaplayer1.URL :='';
StatusBar1.Panels[2].Text :=sRecords+inttostr(adoquery1.RecNo)+'/' +inttostr(Adoquery1.RecordCount);
StatusBar1.Panels[0].Text :=sTryToConnect+dbedit2.text;
//sIP:=GetIP(DBedit3.Text ); //host ip
if trim(sIP) = '' then
begin
StatusBar1.Panels[1].Text :=sCannotConect;
exit;
end;
StatusBar1.Panels[1].Text :=sStartConnect+sIP;
PlayClient1.ConnectHost(sIP,sVlanDsn);
break;
end;
end;
end;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
try
myinifile.writestring('Rewind','String',sRewind);
WindowsMediaplayer1.URL:='';
finally
WindowsMediaplayer1.Free ;
Myinifile.Free ;
end;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
if sRewind='1' then
begin
N1.Caption :=sPlayOnebyOne;
sRewind:='0';
end
else
begin
N1.Caption := '√'+sPlayOnebyOne;
sRewind:='1';
end;
end;
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: boolean);
begin
if ( Msg.message = WM_RBUTTONDOWN )
and
(
(windowfrompoint(Mouse.CursorPos)=WindowsMediaplayer1.handle)
or
(windowfrompoint(Mouse.CursorPos)=form1.WindowsMediaplayer1.handle)
)
then
begin
popupmenu1.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Handled := True;
end;
if ( Msg.message = WM_RBUTTONDOWN )
and
(
(windowfrompoint(Mouse.CursorPos)=Dbgrid1.handle)
or
(windowfrompoint(Mouse.CursorPos)=form1.dbgrid1.handle)
)
then
begin
if dbedit4.Text = '1' then
begin
popupmenu3.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
end
else
popupmenu2.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Handled := True;
end;
end;
procedure TForm1.Btn_CloseClick(Sender: TObject);
begin
CLOSE;
end;
function TForm1.GetIP(Name: string): String;
var
WSAData:TWSAData;
HostEnt:PHostEnt;
begin
StatusBar1.Panels[1].Text :=sGettingIP;
HostEnt:=nil;
WSAStartup(2,WSAData);
Application.ProcessMessages;
HostEnt:=GetHostByName(PChar(name));
//Application.ProcessMessages;
if HostEnt<> nil then
begin
with HostEnt^ do
result:=Format('%d.%d.%d.%d',[Byte(h_addr^[0]),Byte(h_addr^[1]),Byte(h_addr^[2]),Byte(h_addr^[3])]);
end;
WSACleanup;
end;
procedure TForm1.CB_AgentClick(Sender: TObject);
begin
if CB_Agent.checked then
begin
edit1.Enabled := true;
edit1.SetFocus ;
end
else
edit1.Enabled := false;
end;
procedure TForm1.CB_CallerIDClick(Sender: TObject);
begin
if CB_CallerID.checked then
begin
edit2.Enabled := true;
edit2.SetFocus ;
end
else
edit2.Enabled := false;
end;
procedure TForm1.CB_DTMFClick(Sender: TObject);
begin
if CB_DTMF.checked then
begin
edit3.Enabled := true;
edit3.SetFocus ;
end
else
edit3.Enabled := false;
end;
procedure TForm1.CB_PhoneNumClick(Sender: TObject);
begin
if CB_PhoneNum.checked then
begin
edit4.Enabled := true;
edit4.SetFocus ;
end
else
edit4.Enabled := false;
end;
procedure TForm1.CB_TimeAreaClick(Sender: TObject);
begin
if CB_TimeArea.checked then
begin
datetimepicker1.Enabled := true;
DateTimePicker1.SetFocus ;
datetimepicker2.Enabled := true;
datetimepicker2.Date := now;
datetimepicker3.Enabled := true;
datetimepicker4.Enabled := true;
datetimepicker4.Time := now;
end
else
begin
datetimepicker1.Enabled := false;
datetimepicker2.Enabled := false;
datetimepicker3.Enabled := false;
datetimepicker4.Enabled := false;
end;
end;
procedure TForm1.Btn_QueryClick(Sender: TObject);
var
sWhere:string;
sBDateTime,sEDateTime:string;
begin
if CB_Channel.Checked then
begin
if edit6.Text = '' then
begin
showmessage(sInputChannelNo);
edit6.SetFocus ;
exit;
end;
end;
if CB_RecordLength.Checked then
begin
if edit5.Text = '' then
begin
showmessage(sInputRecordLength);
edit5.SetFocus ;
exit;
end;
end;
if CB_TimeArea.Checked then
begin
sBDateTime := FormatDateTime('YYYY-MM-DD',(DateTimePicker1.Date ))+' '+FormatDateTime('HH:mm:ss',(DateTimePicker3.Time ));
sEDateTime := FormatDateTime('YYYY-MM-DD',(DateTimePicker2.Date ))+' '+FormatDateTime('HH:mm:ss',(DateTimePicker4.Time ));
if StrToDateTime(sBDateTime) > StrToDateTime(sEDateTime) then
begin
ShowMessage(sEndTimeBiggerStarttime);
DateTimePicker2.SetFocus ;
exit;
end;
end;
sWhere:=SQLStrComb(sDefaultDB);
if sWhere = '' then
begin
showmessage(sPleaseSelectQueryParm);
exit;
end;
Form2:=TForm2.Create(Application);
Form2.Caption :=sQuerying;
Form2.Label1.Caption :=sQuerying;
Form2.Show;
Form2.Update;
Application.Title := MYAPPNAME;
Adoquery2.SQL.Clear;
Adoquery2.SQL.Add('select count(*) as lcount From Record_Log'+sWhere);
Adoquery2.Active := true;
if Adoquery2.FieldByName('lcount').AsInteger >=1000 then
begin
if Messagebox(application.Handle ,Pchar(sMoreThen1k),Pchar(sInfo),MB_YESNO)=IDyes then
begin
Form2.Free;
EXIT;
end;
end;
Btn_Query.Enabled := False;
Form2.Caption :=sQuerying;
Form2.Label1.Caption :=sQuerying;
Form2.Show;
Form2.Update;
Application.Title := MYAPPNAME;
//獲取條件拼湊
sWhere := sWhere + 'order by StartTime ';
FSortField:='Starttime';
FSort := 'ASC';
SearchData(sWhere,'0');
//查詢
Form2.Hide;
Form2.Update;
Form2.Free;
Btn_Query.Enabled := True;
end;
function TForm1.SQLStrComb(DBType:string): String;
var
// sSqlStr:string;
sLine:string;//坐席名稱
sCid:string;//來(lái)電號(hào)碼
sDID:string;//去電號(hào)碼
sExtID:string;//分機(jī)號(hào)碼
sBDateTime:String; //開(kāi)始時(shí)間
sEdateTime:String; //結(jié)束時(shí)間
sTime:string;
sReturnSql:string;
sRecordTime:string;
sChannel:string;
begin
if DBType = '1' then //access
begin //access start combine the sql
end //access end of combine the sql
else if DBType='2' then //Firebird
begin ///FireBird start combine the sql
if CB_Agent.Checked then
begin
if trim(Edit1.Text) <> '' then
begin
sLine := '( UserName like ''%' + Trim(Edit1.Text)+'%'' )';
sReturnSql:=sLine;
end
end
else
begin
sLine:='';
end;
if CB_CallerID.Checked then
begin
if (Trim(Edit2.Text ) <> '') then
begin
sCID := '( CallerID like ''%' + Trim(Edit2.Text ) + '%'' )';
if sReturnSql <> '' then
sReturnSql:= sReturnSql + ' And ' + sCID
else
sReturnSql:= sCID;
end;
end
else
sCID := '';
if CB_DTMF.Checked then
begin
if Trim(Edit3.Text ) <> '' then
begin
sDID := '( DTMF like ''%' + Trim(Edit3.Text ) + '%'' )';
if sReturnSql <> '' then
sReturnSql:=sReturnSql+ ' And ' + sDID
else
sReturnSql := sDID;
end;
end
else
sDID := '';
if CB_PhoneNum.Checked then
begin
if Trim(Edit4.Text ) <> '' then
begin
sExtID := '( PhoneNumber like ''%' + Trim(Edit4.Text ) + '%'' )';
if sReturnSql <> '' then
sReturnSql:=sReturnSql+ ' And ' + sExtID
else
sReturnSql:=sExtID;
end;
end
else
sExtID := '';
if CB_TimeArea.Checked then
begin
sBDateTime := FormatDateTime('YYYY-MM-DD',(DateTimePicker1.Date ))+' '+FormatDateTime('HH:mm:ss',(DateTimePicker3.Time ));
sEDateTime := FormatDateTime('YYYY-MM-DD',(DateTimePicker2.Date ))+' '+FormatDateTime('HH:mm:ss',(DateTimePicker4.Time ));
sTime:='(StartTime Between ''' +sBDateTime + ''' and '''+sEDateTime +''')';
if sReturnSql <> '' then
sReturnSql:=sReturnSql+ ' And '+ sTime
else
sReturnSql:=sTime;
end
else
sTime := '';
if CB_RecordLength.Checked then
begin
if RBB.Checked then
sRecordTime:='(RecordLength > '+Trim(Edit5.Text) +')'
else if RBE.Checked then
sRecordTime:='(RecordLength = '+Trim(Edit5.Text) +')'
else if RBS.Checked then
sRecordTime:='(RecordLength < '+Trim(Edit5.Text) +')' ;
if sReturnSql <> '' then
sReturnSql:=sReturnSql+ ' And '+ sRecordTime
else
sReturnSql:=sRecordTime;
end
else
sRecordTime := '';
if CB_Channel.Checked then
begin
sChannel:=' Channel = ' + Trim(edit6.Text );
if sReturnSql <> '' then
sReturnSql:=sReturnSql+ ' And '+ sChannel
else
sReturnSql:=sChannel;
end
else
sChannel := '';
if (sReturnSql <> '') then
sReturnSql := ' Where ' + sReturnSql
else
sReturnSql:= '';
end ///FireBird End of combine the sql
else if DBType ='3' then //Orcalo8i
begin ///orcale8i--start combine the sql
if CB_Agent.Checked then
begin
if trim(Edit1.Text) <> '' then
begin
sLine := '( SerialNo like ''%' + Trim(Edit1.Text)+'%'' )';
sReturnSql:=sLine;
end
end
else
begin
sLine:='';
end;
if CB_CallerID.Checked then
begin
if (Trim(Edit2.Text ) <> '') then
begin
sCID := '( CallerID like ''%' + Trim(Edit2.Text ) + '%'' )';
if sReturnSql <> '' then
sReturnSql:= sReturnSql + ' And ' + sCID
else
sReturnSql:= sCID;
end;
end
else
sCID := '';
if CB_DTMF.Checked then
begin
if Trim(Edit3.Text ) <> '' then
begin
sDID := '( DTMF like ''%' + Trim(Edit3.Text ) + '%'' )';
if sReturnSql <> '' then
sReturnSql:=sReturnSql+ ' And ' + sDID
else
sReturnSql := sDID;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -