コード例 #1
0
        public override CResultAErreur TraitementAvantSauvegarde(CContexteDonnee contexte)
        {
            CResultAErreur result = base.TraitementAvantSauvegarde(contexte);

            if (!result)
            {
                return(result);
            }

            DataTable table = contexte.Tables[GetNomTable()];

            if (table == null)
            {
                return(result);
            }
            foreach (DataRow row in new ArrayList(table.Rows))
            {
                if (row.RowState == DataRowState.Added || row.RowState == DataRowState.Modified)
                {
                    //S'assure que les unités et les classes sont en adéquation
                    CTypeConsommable tp = new CTypeConsommable(row);
                    if (tp.Unite != null)
                    {
                        tp.ClasseUnite = tp.Unite.Classe;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        //--------------------------------------------------------------
        public void SetTypeConsommable(CTypeConsommable tp)
        {
            if (tp == null)
            {
                m_nIdTypeConsommable = null;
            }
            else
            {
                m_nIdTypeConsommable = tp.Id;
            }

            if (tp != null && tp.Unite != null && m_valeurQuantite != null)
            {
                if (m_valeurQuantite.IUnite == null ||
                    m_valeurQuantite.IUnite.Classe.GlobalId !=
                    tp.Unite.Classe.GlobalId)
                {
                    m_valeurQuantite = new CValeurUnite(
                        m_valeurQuantite.Valeur,
                        tp.Unite.LibelleCourt);
                }
            }
            if (m_bIsCoutTarif)
            {
                m_valeurCU = null;
            }
        }
コード例 #3
0
        //----------------------------------------------------------------------------------------------
        private void UpdateQuantite()
        {
            CTypeConsommable tpCons = m_selectTypeEquipement.ElementSelectionne as CTypeConsommable;

            if (tpCons != null && CurrentItem != null)
            {
                CValorisationElement val = CurrentItem.Tag as CValorisationElement;
                IUnite unite             = tpCons.Unite;
                if (unite != null)
                {
                    m_txtQuantite.DefaultFormat = unite.LibelleCourt;
                }
                m_txtQuantite.UseValueFormat = true;
                CValeurUnite v = val.QuantiteEtUnite;
                if (v != null && unite != null)
                {
                    if (v.IUnite == null || v.IUnite.Classe.GlobalId != unite.Classe.GlobalId)
                    {
                        v = null;
                    }
                }
                m_txtQuantite.UnitValue   = v;
                m_txtQuantite.LockEdition = LockEdition;
            }
            else
            {
                IUnite unite = CGestionnaireUnites.GetUnite(CClasseUniteUnite.c_idUnite);
                m_txtQuantite.DefaultFormat = unite.LibelleCourt;
                m_txtQuantite.UnitValue     = new CValeurUnite(1, unite.LibelleCourt);
                m_txtQuantite.LockEdition   = true;
            }
        }
コード例 #4
0
 //--------------------------------------------------------------
 public CTypeConsommable GetTypeConsommable(CContexteDonnee ctx)
 {
     if (m_nIdTypeConsommable != null)
     {
         CTypeConsommable tp = new CTypeConsommable(ctx);
         if (tp.ReadIfExists(m_nIdTypeConsommable.Value))
         {
             return(tp);
         }
     }
     return(null);
 }
コード例 #5
0
        public void Init(CTypeConsommable typeConsommable)
        {
            if (typeConsommable == null)
            {
                return;
            }
            m_typeConso = typeConsommable;

            m_panelControles.ClearAndDisposeControls();
            foreach (CConditionnementConsommable pack in m_typeConso.Conditionnements)
            {
                AjouterControle(pack);
            }
        }
コード例 #6
0
ファイル: CLotValorisation.cs プロジェクト: ykebaili/Timos
        //-----------------------------------------------------------
        public CValorisationElement GetValorisation(CTypeConsommable tp)
        {
            if (tp == null)
            {
                return(null);
            }
            CListeObjetsDonnees lstValos = Valorisations;

            lstValos.Filtre = new CFiltreData(CTypeConsommable.c_champId + "=@1",
                                              tp.Id);
            if (lstValos.Count > 0)
            {
                return(lstValos[0] as CValorisationElement);
            }
            return(null);
        }
コード例 #7
0
        public override CResultAErreur VerifieDonnees(CObjetDonnee objet)
        {
            CResultAErreur result = CResultAErreur.True;

            CTypeConsommable typeConsom = objet as CTypeConsommable;

            if (typeConsom != null)
            {
                if (typeConsom.Libelle == string.Empty)
                {
                    result.EmpileErreur(I.T("Consumable Type Label connot be empty|10030"));
                }
                if (typeConsom.Famille == null)
                {
                    result.EmpileErreur(I.T("Consumable Type Family connot be null|10035"));
                }
            }

            return(result);
        }
コード例 #8
0
        //-----------------------------------------------
        private void FillFromDonnee()
        {
            if (m_donneeConsommable == null || m_besoin == null)
            {
                return;
            }

            CTypeConsommable typeConsommable = m_donneeConsommable.GetTypeConsommable(m_besoin.ContexteDonnee);

            if (typeConsommable != null)
            {
                IUnite unite = typeConsommable.Unite;
                if (unite != null)
                {
                    m_txtQuantité.DefaultFormat = unite.LibelleCourt;
                }
                m_txtQuantité.UseValueFormat = true;
            }

            m_txtQuantité.UnitValue = m_donneeConsommable.Quantite;
            m_lblUniteCU.Text       = "";
            m_uniteCU = null;
            if (m_donneeConsommable.CoutUnitaire != null)
            {
                m_txtCoutUnitaire.DoubleValue = m_donneeConsommable.CoutUnitaire.Valeur;
                string strU = CUtilUnite.GetUniteInverse(m_donneeConsommable.CoutUnitaire.Unite);
                IUnite u    = CGestionnaireUnites.GetUnite(strU);
                m_uniteCU         = u;
                m_lblUniteCU.Text = u.LibelleCourt;
            }
            else
            {
                m_txtCoutUnitaire.DoubleValue = null;
            }
            m_txtCoutUnitaire.LockEdition = LockEdition || m_donneeConsommable.IsCoutTarif;
            m_lblUniteCU.Enabled          = !LockEdition && !m_donneeConsommable.IsCoutTarif;
        }
コード例 #9
0
 //-------------------------------------------------------------------------
 public CFormEditionTypeConsommable(CTypeConsommable TypeConsommable, CListeObjetsDonnees liste)
     : base(TypeConsommable, liste)
 {
     // Cet appel est requis par le Concepteur Windows Form.
     InitializeComponent();
 }
コード例 #10
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;
            }
        }