Esempio n. 1
0
logical OCBitmap :: Read (PropertyHandle *ph )
{
  PropertyHandle         *bm;
  logical                 term = NO;
  OResource::Read(ph);
/* Bitmaps selbst können nicht in den Cache geschrieben werden
   da es attributes in ADK_Bitmap sind
  active   = CACHE_READ(ph, "aktiv_bitmap",   OBitmap);
  inactive = CACHE_READ(ph, "inaktiv_bitmap", OBitmap);
  disabled = CACHE_READ(ph, "disabled_bitmap", OBitmap);
*/
  bm     = PHREF(ph->GPH("aktiv_bitmap") );
  if ( !bm->GPH("path")->IsEmpty() )
  {
    active = ADKFACTORY(bm,OBitmap);  
    active->Read(bm);
  }

  bm       = PHREF(ph->GPH("inaktiv_bitmap") );
  if ( !bm->GPH("path")->IsEmpty() )
  {
    inactive = ADKFACTORY(bm,OBitmap);  
    inactive->Read(bm);
  }
  
  bm       = PHREF(ph->GPH("disabled_bitmap") );
  if ( !bm->GPH("path")->IsEmpty() )
  {
    disabled = ADKFACTORY(bm,OBitmap);  
    disabled->Read(bm);
  }
  return(term);
}
logical sBase_SharedData :: InitKey (char *prop_path, char *extnames )
{
  PropertyHandle    *ph        = GetPropertyHandle();
  PropertyHandle    *kennung   = ph->GPH("kennung");
  PropertyHandle    *id        = ph->GPH(prop_path);
  char               idkey[16];
BEGINSEQ
  if ( kennung->IsEmpty() )
    kennung->SetValue(::GetEigentuemerKennung(),NO);
    
  if ( extnames && id->IsEmpty() )
  {
    id->SetValue(1,NO);  

    PropertyHandle    all(ph->GetObjectHandle(),extnames,PI_Read);
                                                    SDBCERR
    all.SetOrder("ik_kennung");
    memset(idkey,0,sizeof(idkey));
    *idkey = *kennung->GetString();
    if ( !all.LocateKey(Key(idkey)) )
      all.Position(-1);
    else
      all.Get(LAST_INSTANCE);
    if ( all.IsPositioned() )
      if ( *all.GPH("kennung") == *kennung )
        id->SetValue(all.GPH(prop_path)->GetInt()+1,NO);  
  }

RECOVER

ENDSEQ
  return(NO);
}
logical pc_TopicFromOldStyle :: Setup_ODC_PFunction (PropertyHandle *prophdl )
{
  PropertyHandle  *imp_parms   = prophdl->GPH("imp_parms");
  PropertyHandle  *retval      = prophdl->GPH("retval");
  PropertyHandle  *retval_name = GPH("retval_name");
  int32            indx0       = 0;
  logical          term        = NO;
BEGINSEQ
  if ( Setup_SDB_Resource(prophdl) )                 ERROR
  *GPH("action") = *prophdl->GPH("action");
  
  pc_TopicFromOldStyle  implementations(GPH("implementations"));
  while ( implementations.Get(indx0++) )
    if ( imp_parms->Get(implementations.ExtractKey()) )
      implementations.Setup_ODC_FunctImp(imp_parms);

  if ( *retval_name->GetString()     &&
        retval->Get(FIRST_INSTANCE)  &&
       *retval_name == *retval->GPH("sys_ident") )
  {
    PropertyHandle       var_ph(GetDBHandle(),"ODC_Variable",PI_Write);
    pc_TopicFromOldStyle variables(&var_ph);
    if ( variables.Get(*retval_name) )
      variables.Setup_SDB_Resource(retval);
  }

  Save();
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
Esempio n. 4
0
logical sNotiz :: DBStored ( )
{
  PropertyHandle   *ph      = GetPropertyHandle();
  logical           del_opt = UNDEF;
BEGINSEQ
  if ( !ph->IsServer() )                            LEAVESEQ
  if ( !UserState1() )                              LEAVESEQ
  SetUserState1(NO);
  
  del_opt = ph->GPH("wiedervorlage")->IsEmpty();
  
  PropertyHandle   notizen_wv(ph->GetDBHandle(),"NotizWiedervorlage",PI_Write);
                                                    SDBCERR
  if ( notizen_wv.Get(ph->ExtractKey()) )
  {
    if ( !del_opt )                                 LEAVESEQ
    notizen_wv.Delete();
  }
  else
  {
    if ( del_opt )                                  LEAVESEQ
    notizen_wv.AddReference(*ph);
  }
RECOVER

ENDSEQ
  return(NO);
}
Esempio n. 5
0
logical sAction :: DBOpened ( )
{
  PropertyHandle    *ph        = GetPropertyHandle();

  ph->GPH("versicherungsnehmer")->SetType("Person");

  return(NO);
}
Esempio n. 6
0
logical sNotiz :: DBInitialize ( )
{
  PropertyHandle   *ph   = GetPropertyHandle();
  dttm              datetime;
  datetime.SetCurrent();
  ph->GPH("datum")->SetValue(datetime,NO);

  return(NO);
}
logical cClassCodeBase :: GetClassName ( )
{
  PropertyHandle   *prophdl = GetPropertyHandle();
  logical           term    = NO;
BEGINSEQ
  if ( !(prophdl = prophdl->GetParentProperty()->GetParentProperty()->GetParentProperty()) )
                                                     ERROR
  SetResult(prophdl->GPH("sys_ident")->GetString());
RECOVER
  SetResult("");
  term = YES;
ENDSEQ
  return(term);
}
Esempio n. 8
0
logical sNotiz :: DBModify ( )
{
  PropertyHandle   *ph = GetPropertyHandle();

BEGINSEQ
  if ( UserState2() )                                LEAVESEQ
  if ( !ph->IsServer() )                             LEAVESEQ
  if ( !strcmp(ph->GetPropertyPath(),"NotizWiedervorlage") )   
                                                    LEAVESEQ
  PropertyHandle  old_wv(ph->GetStructDef(),"wiedervorlage",GetOldInstance());
  PropertyHandle  old_typ(ph->GetStructDef(),"typ",GetOldInstance());
  PropertyHandle *wiedervorlage = ph->GPH("wiedervorlage");
  PropertyHandle *typ = ph->GPH("typ");
  
  if ( *typ != old_typ )
    InitWV();

  if (  *wiedervorlage != old_wv &&
         (wiedervorlage->IsEmpty() || old_wv.IsEmpty()) ) 
    SetUserState1(YES);

ENDSEQ
  return(NO);
}
logical sODS_Description :: SetupResRef ( )
{
  PropertyHandle         *ph = GPH("resource_ref");
  logical                 term = NO;
BEGINSEQ
  if ( !ph )                                         ERROR

  if ( ph->Get(FIRST_INSTANCE) )                     LEAVESEQ

  ph->Add(0);
  ph->GPH("description")->Provide(0);
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
logical cMainFunctionEdit :: Compile ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NBuffer             comp_out;
  int32               curidx          = UNDEF;
  int32               rc              = ERIC;
  logical             reserve_project = YES;
  logical             term            = NO;
BEGINSEQ
//  if ( (curidx = StartClassAction(YES,reserve_project)) == ERIC) 
//                                                     ERROR
  SetupOutput("...Creating source code file ...",NO);
  if ( prophdl->ExecuteExpression(GetRESDB(),"SourceCode()").IsValid() )
    SetupOutput("...  done.\n",NO);
  else
  {
    SetupOutput("...  terminated with errors, compile not started\n",NO);
    ERROR
  }
  
  if ( prophdl->ExecuteInstanceAction("GetCompileCommand",NULL) )
    SetupOutput("Error: providing compile command\n",NO);
  else
  {
    rc = ExecuteCommand(prophdl->GetActionResult(),comp_out,YES,NO);
    SetupOutput(comp_out,NO);
    if ( !rc && strstr(comp_out,"ERROR") )
      rc = ERIC;
      
    if ( rc )
    {
      *prophdl->GPH("req_compile") = (char*)(rc ? "CPS_failed" : "CPS_ready");
      term = YES;
    }
    prophdl->ExecuteInstanceAction("SetupModLevel",NULL);
  }


RECOVER
  term = YES;
ENDSEQ
//  StopClassAction(reserve_project,curidx);
  return(term);
}
logical pc0_HausratVS :: ImportResult (PropertyHandle *source_ph, TP_ImportGlobals *imp_globals )
{
  pc0_Leistung    leistungenO(GPH("leistungenO"));
  pc0_Leistung    leistungenI(GPH("leistungenI"));
  pc0_Leistung    leistungenD(GPH("leistungenD"));
  PropertyHandle *versicherungsnehmer = GPH("versicherungsnehmer");
  logical         term                = NO;
BEGINSEQ
  if ( pc0Base_VS::ImportResult(source_ph,imp_globals) ) 
                                                    ERROR
                                                    
  *GPH("versicherungssumme") = *source_ph->GPH("Deckungssumme");
  *GPH("wohnobject_plz")     = *source_ph->GPH("Plz");
  *GPH("wohnobject_typ")     = source_ph->GPH("WohnobjectTyp_ID")->GetInt();

  leistungenO.Import("Unterversicherungsverzicht",source_ph->GPH("Unterversicherungsverzicht"),imp_globals);
  leistungenO.Import("ElementarSchaeden"         ,source_ph->GPH("ElementarSchaeden"),imp_globals);
  leistungenO.Import("Glaskeramik"               ,source_ph->GPH("Glaskeramik"),imp_globals);
  leistungenO.Import("Spezialrisiken"            ,source_ph->GPH("Spezialrisiken"),imp_globals);

  leistungenI.Import("Wohnflaeche"               ,source_ph->GPH("QmWohnflaeche"),imp_globals);
  leistungenI.Import("Glasflaeche"               ,source_ph->GPH("QmGlasflaeche"),imp_globals);
  leistungenI.Import("Wertsachen"                ,source_ph->GPH("Wertsachen"),imp_globals);
  leistungenI.Import("Wasseraustritt"            ,source_ph->GPH("Wasseraustritt"),imp_globals);
  leistungenI.Import("Implosion"                 ,source_ph->GPH("Implosion"),imp_globals);
  leistungenI.Import("Nutzwaermeschaeden"        ,source_ph->GPH("Nutzwaermeschaeden"),imp_globals);
  leistungenI.Import("Lagerkosten"               ,source_ph->GPH("Lagerkosten"),imp_globals);
  leistungenI.Import("GewerblicheSachen"         ,source_ph->GPH("GewerblicheSachen"),imp_globals);
  leistungenI.Import("Gartenmoebel"              ,source_ph->GPH("Gartenmoebel"),imp_globals);
  leistungenI.Import("DiebstahlAUSPkw"           ,source_ph->GPH("DiebstahlAUSPkw"),imp_globals);
  leistungenI.Import("Bankschliessfaecher"       ,source_ph->GPH("Bankschliessfaecher"),imp_globals);
  leistungenI.Import("Aussenversicherung"        ,source_ph->GPH("Aussenversicherung"),imp_globals);

  leistungenD.Import("Selbstbehalt"              ,source_ph->GPH("Selbstbehalt"),imp_globals);
  leistungenD.Import("Fahrraeder"                ,source_ph->GPH("Fahrraeder"),imp_globals);
  leistungenD.Import("Ueberspannung"             ,source_ph->GPH("Ueberspannung"),imp_globals);

  if ( versicherungsnehmer->Get(FIRST_INSTANCE) )
    pc0_Arbeit(versicherungsnehmer->GPH("job")).ImportOD(source_ph->GPH("OD"),imp_globals);
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
int8 cLanguageDependend :: DoBeforeFillData ( )
{
  CTX_Control     *ctx_lang = GetControlContext("language");
  PropertyHandle  *prophdl  = GetPropertyHandle();
  char             language[33];
BEGINSEQ
  if ( !ctx_lang )                                   LEAVESEQ
  
//  if ( prophdl->Exist() )
  if ( prophdl->IsSelected() )
    strcpy(language,prophdl->GPH("language")->GetString());
  else
    strcpy(language,"undefined");  
    
  ctx_lang->SearchKey(language);

ENDSEQ
  return(NO);
}
logical pc_ODC_FunctImp :: ExistDescription (char *names )
{
  PropertyHandle  *parent  = GetParentProperty();
  logical          cond    = YES;
BEGINSEQ
  if ( !IsPositioned() )                            ERROR
  if ( !parent )                                    ERROR
  if ( !parent->IsA("ODC_PFunction") )              ERROR  

  PropertyHandle   impl_descr_copy(*parent->GPH("implementation_descr"));
  PropertyHandle phnames(names);
  if ( !impl_descr_copy.Get(phnames) )
                                                    ERROR

RECOVER
  cond = NO;
ENDSEQ
  return(cond);
}
logical pc_ADK_Field :: SetupColumn ( )
{
  PropertyHandle        *pfc = GetParentProperty();
  PropertyHandle        *my_class  = pfc->GPH("class");
  PropertyHandle        *member;
  logical                coll_opt;
  char                  *type;
  char                  *propnames = NULL;
  logical                term = NO;
BEGINSEQ
  if ( IsInitialized() )                             LEAVESEQ
  
  propnames = strdup(GPH("sys_ident")->GetString());
  if ( !my_class->Get(FIRST_INSTANCE) )              ERROR
    
  pc_ADK_Class   structure(*my_class);  
  if ( member = structure.GetMember(propnames) )
    coll_opt = pc0_SDB_Member(member).IsMultipleRef() ? YES : NO;
  else
  {
    pc_ADK_Class  all_class(GetObjectHandle(),PI_Read);  
    PropertyHandle phpropnames(propnames);
    if ( all_class.Get(phpropnames) )
    {
      type     = "DRT_Extent";
      coll_opt = YES;
    }
  }

  *GPH("auto_open") = YES;
  *GPH("size.oszwdth") = -1;
  *GPH("size.oszhgth") = 20;
  SetupDataSource(propnames,type,coll_opt);
  SetupTitle(propnames);

RECOVER
  term = YES;
ENDSEQ
  if ( propnames )
    free(propnames);
  return(term);
}
logical pc_ADK_Field :: SetupField ( )
{
  PropertyHandle        *pfc = GetParentProperty();
  PropertyHandle        *my_class  = pfc->GPH("class");
  PropertyHandle        *member;
  PropertyHandle        *fc;
  logical                vgrow = YES;
  logical                hgrow = YES;
  logical                coll_opt;
  char                  *ref_type;  
  char                  *propnames = NULL;
  char                   strnames[ID_SIZE+1];
  logical                term = NO;
BEGINSEQ
  if ( IsInitialized() )                             LEAVESEQ
    
  propnames = strdup(GPH("sys_ident")->GetString());
    
  SetupFromParent();
  
  if ( !my_class->Get(FIRST_INSTANCE) )              ERROR
    
  pc_ADK_Class   new_class(GetObjectHandle(),PI_Update);  
  PropertyHandle extent(GetObjectHandle(),"SDB_Extend",PI_Read);  
  PropertyHandle phpropnames(propnames);
  pc_ADK_Class    structure(*my_class);  
  if ( member = structure.GetMember(propnames) )
  {
    if ( !(fc = new_class.ProvideDefaultControl(member,hgrow,vgrow)) ||
         !fc->Exist()  )                             ERROR
    coll_opt = pc0_SDB_Member(member).IsMultipleRef() ? YES : NO;
    ref_type = "DRT_PropertyPath";
    strcpy(strnames,member->GetString("ddetype"));
  }
  else if ( extent.Get(phpropnames) )
  {
    if ( !(fc = new_class.ProvideDefaultControl(&extent,hgrow,vgrow)) ||
         !fc->Exist()  )                             ERROR
    coll_opt = YES;
    ref_type = "DRT_Extent";
    strcpy(strnames,extent.GetString("ddetype"));
  }
  else                                               ERROR
    
  if ( !hgrow )
    *GPH("allign.hori_sizing") = "SIZE_Fixed";
  if ( !vgrow )
    *GPH("allign.vert_sizing") = "SIZE_Fixed";
  
  *GPH("auto_open") = YES;
  SetupDataSource(propnames,ref_type,coll_opt);
  SetupFromFieldControl(fc);
  SetupTitle(propnames);

  GPH("class")->Add(new_class.ExtractKey());        CTXCERR
  GPH("field_control")->Add(fc->ExtractKey());      CTXCERR


RECOVER
  term = YES;
ENDSEQ
  if ( propnames )
    free(propnames);
  return(term);
}