Beispiel #1
0
        //--------------------------------------------------------------------
        public void AjouterEquipementsDepuisCommandeInCurrentContext(CCommande commande)
        {
            if (commande == null)
            {
                return;
            }
            HashSet <IElementCommandable> setCommandablesPresents = new HashSet <IElementCommandable>();

            foreach (CValorisationElement val in Valorisations)
            {
                IElementCommandable eltCom = val.ElementValorisé as IElementCommandable;
                if (eltCom != null)
                {
                    setCommandablesPresents.Add(eltCom);
                }
            }
            foreach (CLigneCommande ligne in commande.Lignes)
            {
                if (ligne.ElementCommandé != null &&
                    !setCommandablesPresents.Contains(ligne.ElementCommandé))
                {
                    CValorisationElement valo = new CValorisationElement(ContexteDonnee);
                    valo.CreateNewInCurrentContexte();
                    valo.ElementValorisé = ligne.ElementCommandé;
                    valo.LotValorisation = this;
                    setCommandablesPresents.Add(ligne.ElementCommandé);
                }
            }
        }
Beispiel #2
0
        //-------------------------------------------------------------
        protected override CResultAErreur MyMajChamps()
        {
            CResultAErreur result = base.MyMajChamps();
            CLigneCommande ligne  = LigneCommande;

            if (result && ligne != null)
            {
                if (!ligne.IsValide())
                {
                    return(result);
                }
                IElementCommandable eltCommandé = m_selectTypeEquipement.ElementSelectionne as IElementCommandable;
                if (eltCommandé == null)
                {
                    result.EmpileErreur(I.T("Invalid equipment or consumable type on line @1|20401", (ligne.Numero + 1).ToString()));
                    m_selectTypeEquipement.Focus();
                }
                if (m_txtQte.DoubleValue == null)
                {
                    result.EmpileErreur(I.T("Invalid quantity on line @1|20402", (ligne.Numero + 1).ToString()));
                    m_txtQte.Focus();
                }
                if (!result)
                {
                    return(result);
                }
                ligne.ElementCommandé    = eltCommandé;
                ligne.ReferenceCommandée = m_txtSelectReference.ElementSelectionne as IReferenceElementCommandable;
                ligne.Libelle            = m_txtTexte.Text;
                ligne.Quantite           = m_txtQte.DoubleValue.Value;
                ligne.Reference          = m_txtReference.Text;
            }
            return(result);
        }
Beispiel #3
0
 //--------------------------------------------------------------------------------------
 private void m_selectTypeEquipement_OnSelectedObjectChanged(object sender, EventArgs e)
 {
     if (!m_bIsInitializing)
     {
         IReferenceElementCommandable rel = m_txtSelectReference.ElementSelectionne as IReferenceElementCommandable;
         InitSelectReference();
         if (rel != null && !rel.ElementCommandable.Equals(m_selectTypeEquipement.ElementSelectionne))
         {
             m_selectTypeEquipement.ElementSelectionne = rel.ElementCommandable as CObjetDonnee;
         }
         IElementCommandable eltCom = m_selectTypeEquipement.ElementSelectionne as IElementCommandable;
         if (eltCom != null)
         {
             m_txtTexte.Text = eltCom.Libelle;
         }
     }
     if (!m_bIsInitializing)
     {
         HasChange = true;
     }
 }
Beispiel #4
0
        private void InitSelectReference()
        {
            IReferenceElementCommandable lastRel = m_txtSelectReference.ElementSelectionne as IReferenceElementCommandable;
            IElementCommandable          eltCom  = m_selectTypeEquipement.ElementSelectionne as IElementCommandable;
            CFiltreData filtreEquipement         = null;
            CFiltreData filtreConsommable        = null;

            CTypeEquipement typeEquipement = m_selectTypeEquipement.ElementSelectionne as CTypeEquipement;

            if (typeEquipement != null)
            {
                filtreEquipement = CFiltreData.GetAndFiltre(filtreEquipement,
                                                            new CFiltreData(CTypeEquipement.c_champId + "=@1",
                                                                            typeEquipement.Id));
            }
            else if (m_fournisseurPourFiltre != null)
            {
                filtreEquipement = CFiltreData.GetAndFiltre(filtreEquipement,
                                                            new CFiltreData(CDonneesActeurFournisseur.c_champId + "=@1",
                                                                            m_fournisseurPourFiltre.Id));
            }

            CTypeConsommable typeConsommable = m_selectTypeEquipement.ElementSelectionne as CTypeConsommable;

            if (typeConsommable != null)
            {
                filtreConsommable = CFiltreData.GetAndFiltre(filtreConsommable,
                                                             new CFiltreData(CTypeConsommable.c_champId + "=@1",
                                                                             typeConsommable.Id));
            }
            else if (m_fournisseurPourFiltre != null)
            {
                filtreConsommable = CFiltreData.GetAndFiltre(filtreConsommable,
                                                             new CFiltreData(CDonneesActeurFournisseur.c_champId + "=@1",
                                                                             m_fournisseurPourFiltre.Id));
            }

            if (typeEquipement != null)
            {
                m_txtSelectReference.InitAvecFiltreDeBase(
                    typeof(CRelationTypeEquipement_Fournisseurs),
                    "Libelle",
                    filtreEquipement,
                    true);
            }
            else
            if (typeConsommable != null)
            {
                m_txtSelectReference.InitAvecFiltreDeBase(
                    typeof(CConditionnementConsommable),
                    "Libelle",
                    filtreConsommable,
                    true);
            }
            else
            {
                m_txtSelectReference.InitMultiple(
                    new CConfigTextBoxFiltreRapide[] {
                    new CConfigTextBoxFiltreRapide(
                        typeof(CRelationTypeEquipement_Fournisseurs),
                        filtreEquipement,
                        "Libelle"),
                    new CConfigTextBoxFiltreRapide(
                        typeof(CConditionnementConsommable),
                        filtreConsommable,
                        "Libelle")
                }, true);
            }



            if (lastRel != null && eltCom == null && lastRel.ElementCommandable == eltCom)
            {
                m_txtSelectReference.ElementSelectionne = (CObjetDonnee)lastRel;
            }
        }