You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
6.7 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit U_SelectLinkMan;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids,u_op_seae_DsWebService,my_sys_function,
kbmMemTable, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, StdCtrls,
bsSkinCtrls,SoapHTTPClient,InvokeRegistry;
type
Tfrm_SelectLinkMan = class(TForm)
ds1: TDataSource;
MT1: TkbmMemTable;
MT1UserID: TStringField;
MT1USERNAME: TStringField;
MT1Mobile: TStringField;
MT1Companyid: TStringField;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
bsSkinPanel3: TbsSkinPanel;
edt1: TEdit;
Label1: TLabel;
dxDBGrid1Column3: TdxDBGridColumn;
MT1Email: TStringField;
SaveQry: TADOQuery;
edt2: TEdit;
Label2: TLabel;
bsSkinButton8: TbsSkinButton;
Label3: TLabel;
GetQry: TADOQuery;
SaveQry2: TADOQuery;
procedure FormShow(Sender: TObject);
procedure dxDBGrid1DblClick(Sender: TObject);
procedure edt1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure bsSkinButton8Click(Sender: TObject);
private
XML:String;
mServiceSoap_Ds:DsWebServiceSoap;
mHttpRIO_ds:THTTPRIO;
procedure SaveUserInfo;
public
procedure GetUserInfo;
procedure GetCurrUserInfo;
procedure getwebservice_ds;
end;
var
frm_SelectLinkMan: Tfrm_SelectLinkMan;
implementation
uses crm_spxcompany, u_data_share,u_main;
{$R *.dfm}
procedure Tfrm_SelectLinkMan.FormShow(Sender: TObject);
var
str:widestring;
begin
GetCurrUserInfo;
end;
procedure Tfrm_SelectLinkMan.GetUserInfo;
var _s,url,block,XML,str,PWD:string;
UserCount,_i,_j,p1,p2:integer;
begin
getwebservice_ds;
str:=edt1.Text;
PWD:=edt2.text;
XML:=mServiceSoap_Ds.SearchUser(frm_data_share.AnsiStringToWideString(str,936),frm_data_share.AnsiStringToWideString(PWD,936));
UserCount:= frm_data_share.countString('User',xml);
if (UserCount>0) then begin
MT1.Close;
//дÈëMT1
for _i:=1 to UserCount do begin
p1:=frm_data_share.GettimePotion(_i,'<User>',xml);
p2:=frm_data_share.GettimePotion(_i,'</User>',xml);
block:=Copy(XML,p1,p2-p1);
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['UserID']:=frm_data_share.GetXMLValue('UserID',block);
MT1['USERNAME']:=frm_data_share.GetXMLValue('USERNAME',block);
MT1['Mobile']:=frm_data_share.GetXMLValue('Mobile',block);
MT1['Companyid']:=frm_data_share.GetXMLValue('Companyid',block);
MT1['Email']:=frm_data_share.GetXMLValue('Email',block);
MT1.Post;
end;
end;
end;
procedure Tfrm_SelectLinkMan.dxDBGrid1DblClick(Sender: TObject);
var _t_employee:string;
begin
end;
procedure Tfrm_SelectLinkMan.edt1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=13) then begin
bsSkinButton8Click(self);
end;
end;
procedure Tfrm_SelectLinkMan.bsSkinButton8Click(Sender: TObject);
var _s,url,block,XML,str,PWD:string;
UserCount,_i,_j,p1,p2:integer;
begin
if (edt1.text='') and (edt2.text='') then begin
if MessageDlg('²»ÌîдshippingboxµÇ¼ÐÅÏ¢½øÐÐͬ²½£¬¼´»áÈ¡Ïûµ±Ç°Óû§µÄͬ²½ÐÅÏ¢£¬È·¶¨Âð',mtWarning,[mbyes,mbno],0)=mryes then
begin
//ÓÿÕֵͬ²½µ±Ç°ÐÅÏ¢
MT1.Delete;
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['UserID']:='';
MT1['USERNAME']:='';
MT1['Mobile']:='';
MT1['Companyid']:='';
MT1['Email']:='';
MT1.Post;
SaveQry2.Close;
SaveQry2.Parameters.ParamByName('UserID').Value:=MT1.fieldbyname('UserID').asstring;
SaveQry2.Parameters.ParamByName('ÐÕÃû').Value:=employee;
SaveQry2.ExecSQL;
showmessage('È¡Ïû³É¹¦');
frm_data_share.t_load_employee.close;
frm_data_share.t_load_employee.Parameters.ParamByName('ÐÕÃû').Value:=employee;
frm_data_share.t_load_employee.open;
end;
end else
if (length(trim(edt1.text))<8) or (pos('@',edt1.text)=-1) then begin
showmessage('ÇëÕýÈ·ÌîдshippingboxµÄµÇ½Óû§Ãû');
end else begin
GetUserInfo;
SaveUserInfo;
end;
end;
procedure Tfrm_SelectLinkMan.getwebservice_ds;
var URL:String;
begin
try
URL:=get_WebseviceURL;
mHttpRIO_ds:=THTTPRIO.Create(nil);
mHttpRIO_ds.WSDLLocation:=URL+'?WSDL';
mHttpRIO_ds.URL:=URL;
// mHttpRIO_ds.WSDLLocation:='http://192.168.1.5:8086/webservice/DsWebService.asmx?WSDL';
// mHttpRIO_ds.URL:='http://192.168.1.5:8086/webservice/DsWebService.asmx';
mHttpRIO_ds.Port:='DsWebServiceSoap';
mHttpRIO_ds.Service:='DsWebService';
mHttpRIO_ds.HTTPWebNode.UseUTF8InHeader:=true;
InvRegistry.RegisterInvokeOptions(TypeInfo(DsWebServiceSoap),ioDocument );//¾ÍÊÇÕâÒ»ÐÐ
mServiceSoap_Ds:=mHttpRIO_ds as DsWebServiceSoap;
except
on E:Exception do
begin
ShowMessage(e.Message);
exit;
end;
end;
end;
procedure Tfrm_SelectLinkMan.SaveUserInfo;
var _t_employee:string;
begin
//employee
if (MT1.RecordCount>0) then begin
SaveQry.Close;
SaveQry.Parameters.ParamByName('UserID').Value:=MT1.fieldbyname('UserID').asstring;
SaveQry.Parameters.ParamByName('Mobile').Value:=MT1.fieldbyname('Mobile').asstring;
SaveQry.Parameters.ParamByName('ÐÕÃû').Value:=employee;
SaveQry.ExecSQL;
showmessage('ͬ²½³É¹¦');
_t_employee:=employee;
frm_data_share.t_load_employee.close;
frm_data_share.t_load_employee.Parameters.ParamByName('ÐÕÃû').Value:=_t_employee;
frm_data_share.t_load_employee.open;
end;
end;
procedure Tfrm_SelectLinkMan.GetCurrUserInfo;
var _s,url,block,XML,str,PWD,SPXNO:string;
UserCount,_i,_j,p1,p2:integer;
begin
getwebservice_ds;
str:=edt1.Text;
PWD:=edt2.text;
getqry.close;
getqry.Parameters.ParamByName('ÐÕÃû').Value:=employee;
getqry.open;
SPXNO:=getqry.fieldbyname('¶©²ÕϵͳÐòÁкÅ').asstring;
XML:=mServiceSoap_Ds.GetCurrUserInfo(frm_data_share.AnsiStringToWideString(SPXNO,936));
UserCount:= frm_data_share.countString('User',xml);
MT1.Close;
//дÈëMT1
for _i:=1 to UserCount do begin
p1:=frm_data_share.GettimePotion(_i,'<User>',xml);
p2:=frm_data_share.GettimePotion(_i,'</User>',xml);
block:=Copy(XML,p1,p2-p1);
MT1.Open;
MT1.Edit;
MT1.Insert;
MT1['UserID']:=frm_data_share.GetXMLValue('UserID',block);
MT1['USERNAME']:=frm_data_share.GetXMLValue('USERNAME',block);
MT1['Mobile']:=frm_data_share.GetXMLValue('Mobile',block);
MT1['Companyid']:=frm_data_share.GetXMLValue('Companyid',block);
MT1['Email']:=frm_data_share.GetXMLValue('Email',block);
MT1.Post;
end;
MT1.first;
end;
end.