Ejemplo n.º 1
0
        //Crée une opération réalisée à partir d'une opération prévisionnelle
        public CResultAErreur CreateRealisee(CFractionIntervention fractionDest, COperation opParente)
        {
            COperation newOperation = new COperation(fractionDest.ContexteDonnee);

            newOperation.CreateNewInCurrentContexte();
            newOperation.TypeOperation        = TypeOperation;
            newOperation.FractionIntervention = fractionDest;
            newOperation.Commentaires         = Commentaires;
            newOperation.TypeEquipement       = TypeEquipement;
            newOperation.Equipement           = Equipement;
            newOperation.OperationParente     = opParente;

            if (TypeOperation.FormulaireOpPrevisionnelle != null)
            {
                foreach (CRelationOperation_ChampCustom relChamp in this.RelationsChampsCustom)
                {
                    CRelationOperation_ChampCustom relClone = (CRelationOperation_ChampCustom)relChamp.Clone(false);
                    relClone.ElementAChamps = newOperation;
                }
            }

            foreach (COperation opFille in OperationsFilles)
            {
                opFille.CreateRealisee(fractionDest, newOperation);
            }
            CResultAErreur result = CResultAErreur.True;

            result.Data = newOperation;
            return(result);
        }
Ejemplo n.º 2
0
        //--------------------------------------------------------------------------------------------
        public CResultAErreur CreerOperationPrevisionnelleSurIntervention(CIntervention intervention, CEquipement equipement)
        {
            CResultAErreur result = CResultAErreur.True;

            if (this.Intervention != null)
            {
                result.EmpileErreur(I.T("The Operation is already planned in the Intervention '@1'|428", Intervention.Libelle));
                return(result);
            }

            if (this.FractionIntervention != null)
            {
                result.EmpileErreur(I.T("The Operation is already associated to the Intervention '@1' report|429", Intervention.Libelle));
                return(result);
            }

            COperation newOperation = new COperation(ListeOperations.ContexteDonnee);

            newOperation.CreateNewInCurrentContexte();
            newOperation.TypeOperation  = TypeOperation;
            newOperation.Intervention   = intervention;
            newOperation.Commentaires   = Commentaires;
            newOperation.TypeEquipement = TypeEquipement;
            newOperation.Equipement     = equipement;

            if (TypeOperation.FormulaireOpPrevisionnelle != null)
            {
                foreach (CRelationOperation_ChampCustom relChamp in this.RelationsChampsCustom)
                {
                    CRelationOperation_ChampCustom relClone = (CRelationOperation_ChampCustom)relChamp.Clone(false);
                    relClone.ElementAChamps = newOperation;
                }
            }
            result.Data = newOperation;
            return(result);
        }