Example #1
0
    //-----------------------------------------------------------------
    private static TID.CParametrageSystemeCoordonnees ImporteParametrageSC(
        CParametrageSystemeCoordonnees paramTimos,
        CMemoryDb db,
        TID.CIndexIdTimos <TID.CSystemeCoordonnees> dicSC,
        TID.CIndexIdTimos <TID.CRelationSystemeCoordonnees_FormatNumerotation> dicRFN)
    {
        if (paramTimos == null)
        {
            return(null);
        }
        TID.CParametrageSystemeCoordonnees parametrage = null;
        TID.CSystemeCoordonnees            sc          = null;
        if (dicSC != null)
        {
            sc = dicSC.GetSafe((int?)paramTimos.Row[CSystemeCoordonnees.c_champId, true]);
        }
        parametrage = new TimosInventory.data.CParametrageSystemeCoordonnees(db);
        parametrage.CreateNew();
        if (sc != null)
        {
            parametrage.SystemeCoordonnees = sc;
        }
        else
        {
            parametrage.Row[TID.CSystemeCoordonnees.c_champId] = paramTimos.Row[TID.CSystemeCoordonnees.c_champId];
        }

        foreach (CParametrageNiveau paramNTimos in paramTimos.ParametragesNiveauxOrdonnees)
        {
            TID.CRelationSystemeCoordonnees_FormatNumerotation relFN = null;
            if (dicRFN != null)
            {
                relFN = dicRFN.GetSafe((int?)paramNTimos.Row[CRelationSystemeCoordonnees_FormatNumerotation.c_champId, true]);
            }
            TID.CParametrageNiveau paramN = new TimosInventory.data.CParametrageNiveau(db);
            paramN.CreateNew();
            paramN.ParametrageSystemeCoordonnees = parametrage;
            paramN.PremierIndice = paramNTimos.PremierIndice;
            paramN.Taille        = paramNTimos.Taille;
            if (relFN != null)
            {
                paramN.RelationSysCoor_FormatNum = relFN;
            }
            else
            {
                paramN.Row[TID.CRelationSystemeCoordonnees_FormatNumerotation.c_champId] = paramNTimos.Row[CRelationSystemeCoordonnees_FormatNumerotation.c_champId];
            }
        }
        return(parametrage);
    }
Example #2
0
    //------------------------------------------------------------------------
    public static DataSet GetListeSitesPourReferences(C2iSessionWeb session)
    {
        using (CContexteDonnee ctx = new CContexteDonnee(session.Session.IdSession, true, false))
        {
            CMemoryDb db = new CMemoryDb();
            AddTypesSitesToDb(ctx, db);
            TID.CIndexIdTimos <TID.CTypeSite> dicTypesSites = TID.CIndexIdTimos <TID.CTypeSite> .GetIdTimosIndex(db);

            CListeObjetDonneeGenerique <CSite> lstSites = new CListeObjetDonneeGenerique <CSite>(ctx);
            lstSites.AssureLectureFaite();
            lstSites.ReadDependances("SitesFils");
            lstSites.ReadDependances("TypeSite");
            lstSites.Filtre = new CFiltreData(CSite.c_champIdParent + " is null");
            foreach (CSite site in lstSites)
            {
                AddSitePourReference(site, null, db, dicTypesSites);
            }
            return(db);
        }
    }
Example #3
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];
            }
        }
    }