Example #1
0
    //------------------------------------------------------------------------
    private static void AddConstructeursToDb(CContexteDonnee ctx, CMemoryDb db)
    {
        CListeObjetDonneeGenerique <CDonneesActeurConstructeur> lst = new CListeObjetDonneeGenerique <CDonneesActeurConstructeur>(ctx);

        lst.ReadDependances("Acteur");
        foreach (CDonneesActeurConstructeur timosConst in lst)
        {
            TID.CConstructeur constructeur = new TID.CConstructeur(db);
            constructeur.CreateNew(timosConst.Id);
            constructeur.Libelle = timosConst.Acteur.Nom;
        }
    }
Example #2
0
    //------------------------------------------------------------------------
    private static void AddTypesEquipementsToDb(CContexteDonnee ctx, CMemoryDb db)
    {
        CListeObjetDonneeGenerique <CTypeEquipement> lst = new CListeObjetDonneeGenerique <CTypeEquipement>(ctx);

        lst.ReadDependances("RelationsConstructeurs");
        lst.ReadDependances("ParametragesSystemesCoordonnees");
        lst.ReadDependances("RelationsTypesParents");

        TID.CIndexIdTimos <TID.CConstructeur> dicConstructeurs = TID.CIndexIdTimos <TID.CConstructeur> .GetIdTimosIndex(db);

        TID.CIndexIdTimos <TID.CSystemeCoordonnees> dicSC = TID.CIndexIdTimos <TID.CSystemeCoordonnees> .GetIdTimosIndex(db);

        TID.CIndexIdTimos <TID.CRelationSystemeCoordonnees_FormatNumerotation> dicRFN = TID.CIndexIdTimos <TID.CRelationSystemeCoordonnees_FormatNumerotation> .GetIdTimosIndex(db);

        foreach (CTypeEquipement tpTimos in lst)
        {
            TID.CTypeEquipement tp = new TID.CTypeEquipement(db);
            tp.CreateNew(tpTimos.Id);
            tp.Libelle          = tpTimos.Libelle;
            tp.NbUnitesOccupees = tpTimos.NbUnitesOccupees;
            tp.Row[TID.CTypeEquipement.c_champUniteOccupation] = tpTimos.Row[CTypeEquipement.c_champUniteOccupation];
            tp.OptionsControleCoordonneesPropreInt             = tpTimos.OptionsControleCoordonneesPropreInt;
            foreach (CRelationTypeEquipement_Constructeurs relConsTimos in tpTimos.RelationsConstructeurs)
            {
                TID.CTypeEquipementConstructeur tpCons = new TID.CTypeEquipementConstructeur(db);

                int?nId = (int?)relConsTimos.Row[CDonneesActeurConstructeur.c_champId, true];
                TID.CConstructeur cons = dicConstructeurs.GetSafe(nId);

                if (cons != null)
                {
                    tpCons.CreateNew(relConsTimos.Id);
                    tpCons.IdTimos        = relConsTimos.Id;
                    tpCons.TypeEquipement = tp;
                    tpCons.Constructeur   = cons;
                    tpCons.Reference      = relConsTimos.Reference;
                }
            }


            //Coordonnées
            CParametrageSystemeCoordonnees     paramTimos  = tpTimos.ParametrageCoordonneesPropre;
            TID.CParametrageSystemeCoordonnees parametrage = ImporteParametrageSC(
                paramTimos,
                db,
                dicSC,
                dicRFN);
            if (parametrage != null)
            {
                parametrage.TypeEquipement = tp;
            }

            foreach (CRelationTypeEquipement_Heritage relTimos in tpTimos.RelationsTypesParents)
            {
                TID.CRelationTypeEquipement_Heritage rel = new TimosInventory.data.CRelationTypeEquipement_Heritage(db);
                rel.CreateNew(relTimos.Id);
                rel.Row[TID.CRelationTypeEquipement_Heritage.c_champIdTypeFils]   = relTimos.Row[CRelationTypeEquipement_Heritage.c_champIdTypeFils];
                rel.Row[TID.CRelationTypeEquipement_Heritage.c_champIdTypeParent] = relTimos.Row[CRelationTypeEquipement_Heritage.c_champIdTypeParent];
            }
        }
    }