Jump to content

toufik

Members
  • Content Count

    20
  • Joined

  • Last visited

Everything posted by toufik

  1. hi every one can some one help me with problem I'm using Delphi REST with server and client but when i tried to show data on the client side its show only one row for some reason, what did i do wrong ? PS : I'm using Delphi roi and restdataware the video down show what I'm deal with ; any help will be very appreciated ^^ thank you on the client side i'm using this code procedure listv; var jsonObj : TJsonObject; json, sucesso, erro,id_store ,nom_store, phone_saler: string; begin // FrmLogin.FloatAnimation2.Stop; // FrmLogin.FloatAnimation3.Stop; if FrmLogin.listvreq.Response.JSONValue = nil then begin // FrmLogin.ExibirCampos; ShowMessage('خطأ في إنشاء الحساب (JSON غير صالح)'); exit; end; try json := FrmLogin.listvreq.Response.JSONValue.ToString; jsonObj := TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(json), 0) as TJSONObject; sucesso := jsonObj.GetValue('sucesso').Value; erro := jsonObj.GetValue('erro').Value; id_store := jsonObj.GetValue('id_store').Value; nom_store := jsonObj.GetValue('nom_store').Value; if sucesso <> 'S' then begin // FrmLogin.ExibirCampos; ShowMessage(erro); exit; end else // showmessage('تم احضار بيانات: ' + id_store+nom_store); // FrmLogin.ExibirCampos;/// // FrmLogin.ListView1.Items.Clear(); finally jsonObj.DisposeOf; end; end; procedure listverr(Sender: TObject); begin if Assigned(Sender) and (Sender is Exception) then begin // FrmLogin.ExibirCampos; showmessage(Exception(Sender).Message); end; end; procedure TFrmLogin.StartLogin2; begin TThread.CreateAnonymousThread( procedure var Success: Boolean; begin try RequestLogin.Execute; Success := RequestLogin.Response.Status.Success; except Success := False; end; TThread.Queue(nil, procedure begin AfterLogin2(Success); end ); end ).Start; end; procedure TFrmLogin.AfterLogin2(Success: Boolean); begin if Success then begin listvreq.Params.Clear; listvreq.AddParameter('type_store',ComboBox1.Selected.Text); /// **** listvreq.ExecuteAsync(listv, true, true, listverr); end else begin showmessage (' عفوا ...! لايمكن الاتصال بالخادم حاليا يرجى المحاولة لاحقا') end; on server side : procedure Tdm.DWEventsEventslistvReplyEvent(var Params: TDWParams; var Result: string); var type_store, erro : string; usuario : TUsuario; json : TJsonObject; begin try sleep(4000); type_store := Params.ItemsString['type_store'].AsString; json := TJsonObject.Create; usuario := TUsuario.Create(dm.conn); usuario.type_store := type_store; if NOT usuario.listv(erro) then begin //{"sucesso": "N", "erro":"Usuلrio nمo informado", "codusuario":"0"} json.AddPair('sucesso', 'N'); json.AddPair('erro', erro); json.AddPair('id_store', ''); json.AddPair('nom_store', ''); end else begin json.AddPair('sucesso', 'S'); json.AddPair('erro', ''); json.AddPair('id_store', usuario.id_store.ToString); json.AddPair('nom_store', usuario.nom_store); end; Result := json.ToString; finally json.DisposeOf; usuario.DisposeOf; end; and in class i add called unit usuario function TUsuario.listv(out erro: string): Boolean; var qry : TFDQuery; begin try qry := TFDQuery.Create(nil); qry.Connection := FConn; with qry do begin Active := false; SQL.Clear; SQL.Add('SELECT * from saler WHERE type_store = :any '); ParamByName('any').Value := type_store; Active := true; if RecordCount > 0 then begin id_store := FieldByName('id_store').AsInteger; nom_store := FieldByName('nom_store').AsString; erro := ''; Result := true; end else begin // id_store := 0; erro := 'تعذر جلب بيانات المعلنين'; Result := false; end; DisposeOf; end; except on ex:exception do begin erro := 'خطأ في التحقق من صحة تسجيل الدخول: ' + ex.Message; Result := false; end; end; bandicam_2021-05-01_17-50-29-913.mp4
  2. thanks for taking time to reply i found that i did not add an array , tjsonarray , that fix it for me
  3. hello every one can some one help convert Thorse procedure unit to Tdwserverevent thank you in advance the code on Thorse are: unit uServico; interface uses Horse, System.SysUtils, DataSet.Serialize; procedure Servico(App: THorse); procedure Get(Req: THorseRequest; Res: THorseResponse; Next: TProc); implementation uses dmPrincipal; procedure Get(Req: THorseRequest; Res: THorseResponse; Next: TProc); begin try try DataModule1 := TDataModule1.Create(nil); DataModule1.FDQuery1.Close; if req.Params.Count > 0 then begin DataModule1.FDQuery1.FetchOptions.RecsSkip:= strtointdef(req.Params.Items['pagina'],1) * strtointdef(req.Params.Items['max'],1); DataModule1.FDQuery1.FetchOptions.RecsMax:= strtointdef(req.Params.Items['max'],1); end; DataModule1.FDQuery1.Open(); Res.Send(DataModule1.FDQuery1.ToJSONArray.ToJSON); finally Res.Status(200); FreeAndNil(DataModule1); end; except on e: exception do begin Res.Send(e.Message); Res.Status(400); end; end; end; procedure Servico(App: THorse); begin App.Get('/saler/:pagina/:max', Get); end;
  4. hello,I'm nob , and i did tried today NetCom7 and i would like to saywhat an amazing project very fast , believe me i know because we have very low connection speed where i live ,any way ,i would like to ask you if any one can give us more demos or example about for example chat communication between two selected clientslets say client one , select client two to chat with , how do you implement that .thank you all and have a Delphi daylink:https://github.com/DelphiBuilder/NetCom7
  5. hello every one I want to play videos one by one , when one finished the second one start and that on ,like slidshow but with videos not pictures , using tMediaPlayer ,how can I approach that ? or is there a way to detect when start and end of a video ?thank you
  6. toufik

    play all videos in one folder delphi?

    thank you very much
  7. toufik

    loop a table field

    hello every on , i'm using this code to loop a sqllite database field called 'photos' and not doing the job for me im using a timer for that named tmr1 where is the problem please thank you ps : this loop stop when one of fields value is empty tmr1.Enabled := False; if not FDTableTask.IsEmpty and not FDTableTask.FieldByName('photos').IsNull and FileExists(FDTableTask.FieldByName('photos').asString) then begin FDTableTask.next; // ImageEnView2.PrepareTransition; // ImageEnView2.RunTransition( TIETransitionType( 1 + random( ord( High( TIETransitionType )) - 2 )), 550); // tmr1.Enabled := true; while FDTableTask.EOF do begin FDTableTask.First; end; end; tmr1.Enabled := true;
  8. hello every one ..............how to store a video location to database and restore to play it in tMediaPlayer ? thank you
  9. @emailx45 thank you its work thanks a lot ^^
  10. toufik

    The location of sqllite database ?

    good morning every one ^^ how is every one doing )) 1- i have fmx android app that s create sqllite db on create ,what's the location of db on the phone and is it const location ? (does not change for every other phones) 2- what's the proper way to copy it from that location to sd card (backup) ? thanks and take care
  11. Hello every one ... I have this very important question and its help a lot if any one can help me with it, I have an FMX app working normally on some Android versions 5 and 5.1 and 4.4 and with some medication on Android 10 and not working at all on other one ,its crash in startup in 6 and 9 ,and on android 7.1 and 8 its stuck on splash screen i have SDK and NDK and JAVA files set up correctly like the images shown bellow ,I did edit the AndroidManifest.template.xml so minSdkVersion="19" and targetSdkVersion="29" by the way the app request Camera permission and connect to fire-Dec database app on create cause im using ZXing project in my app what's I'm missing here .
  12. Hi all Delphier , good morning 😀😀 i have rest firemonkey app ,server , client im trying to check if the server is up or down from the client side using the code below , the code work fine , but when i run it its freeze the app for a while is there any proper way to do this ,thank you ,🤓☺️ try RequestLogin.Execute; if FrmLogin.RequestLogin.Response.Status.Success then begin showmessage ('server up') do something ..... end else except on e : exception do begin showmessage (' server down.... go home ') end end;
  13. @Uwe Raabe Thank you for reply ^ i will try that too , and of curse the first solution work just fine too .
  14. I can't thank you enough ,thank s a lot
  15. @Remy Lebeau i will try it ,,,,,thank you and ,,, if there any example to how to do this , it will be helpful thank you
  16. i did get this form the programmer who has written NetCom7 : you can pass that information to the server by packing it in the aData parameter (for example, you could pack the other client's info and the data with a TStringList.CommaText and pass that as aData). Now, the server will have to unpack the aData, again using TStringList.CommaText, and i'm trying it right now
  17. Thank you very much for help , i will try to accomplish what you suggested ,again thank you ^^
  18. @aehimself Thank a lot for reply , and yes there is demo folder , but it s missing what i'm looking for , the demos contain chat application ,that all client can see the text message that one client sent 'see the picture' and i want like i said before client 1 select client 2 to text with privately , i hope you understand the idea
  19. @aehimself i don't know the guy who made that , and i'm not here for any advertising by the way maybe he deserve an advertisement ^^
×