Конференция "Базы" » DataSnap send Object [D 2010]
 
  • adigozelov © (05.02.12 15:49) [0]
    Zdrasduviyti Materi.
    U mina yes takoy nimnoqa slojnoy object
     
    TProductProperty = Class(Tobject)
     private
       stocGroup: TStocGroup;
       country: TCountry;
       compony: TCompany;
       single: TSingle;
       single2:TSingle;
       single3:TSingle;
       single2single:real; //nisbeti goster esas vahidle komekci vahid arasinda
       single3single:real;
       size: TSize;
       color: TColor;
       PRD: string;
       EXP: string;
       inPrice: Real;
       price: Real;
       priceSingle2:Real;
       priceSingle3:Real;
       valut: TValut;
       productPrice: TProductPrice;
       remark:String;
     public
    ....
    end;

    TProductAmount = Class(Tobject)
     private
       dovur: Real;
       toplamGiris: Real;
       toplamCixis: Real;
     public
    ...
    end;

     TProduct = Class(Tobject)
     private
       id: integer;
       barcod: String;
       name: String;
       short:boolean;
       productProperty: TProductProperty;
       productAmount: TProductAmount;
     public
    ...
    end;

    ye deliyu marshal
    var
     jMarshal:TJSONMarshal;
     jValue:TJSONValue;
    begin

     jMarshal := TJSONMarshal.Create(TJSONConverter.Create);
    // jMarshal.RegisterConverter(TProduct,'productProperty',
    //  function (Data: TObject; Field: string):TObject
    //  begin
    //    dumuyu shto tam shtota dalija bit no shto dalijna bit ya
    //  niznayu
    //  );
     jValue := jMarshal.Marshal(product);
     tfRemark.Text := jValue.ToString;
     jValue.Free;
     jMarshal.Free;

    end;

    vso narmalno delayit marsh.
    no kakda delayu unmarshal bivayit asibku

    var
     jvalue:TJSONValue;
     junmarshal:TJSONUnMarshal;
    begin
     jvalue := TJSONObject.ParseJSONValue(TEncoding.ASCII.GetBytes(tfRemark.Text),0);
     junmarshal := TJSONUnMarshal.Create;
     setProduct(junmarshal.Unmarshal(jvalue) as TProduct );
    end;

    no pajalista ni savetiyi procitat help ya eta znayu.
    i yesli kakoyta druqoy variant atpirafka object na datasnap server(vcl application)
    sbasiba
  • adigozelov © (05.02.12 16:28) [1]
    nu pajalista ktota abeta niznayut li?
    nu ktota pamayatli ina?
    mina crocna nujna.
 
Конференция "Базы" » DataSnap send Object [D 2010]
Есть новые Нет новых   [134431   +11][b:0][p:0]