コード例 #1
0
        //-----------------------------------------------
        public CResultAErreur MajChamps()
        {
            CResultAErreur result = CResultAErreur.True;

            if (m_donneeOperation != null)
            {
                CTypeOperation  tpOld      = m_donneeOperation.GetTypeOperation(m_besoin.ContexteDonnee);
                CTypeOperation  tpNew      = m_txtSelectTypeOperation.ElementSelectionne as CTypeOperation;
                CControleBesoin ctrlBesoin = ControleBesoin;
                if (ctrlBesoin != null)
                {
                    if ((tpOld == null || ctrlBesoin.LibelleBesoin.ToUpper() == tpOld.LibelleComplet.ToUpper() || ctrlBesoin.LibelleBesoin.Trim().Length == 0))
                    {
                        if (tpNew != null)
                        {
                            ctrlBesoin.LibelleBesoin = tpNew.LibelleComplet;
                        }
                        else
                        {
                            ctrlBesoin.LibelleBesoin = "";
                        }
                    }
                }
                m_donneeOperation.SetTypeOperation(tpNew);
            }
            return(result);
        }
コード例 #2
0
        //----------------------------------------------------
        public override int GetItemHeight(CCustomizableListItem item)
        {
            if (item.IsMasque)
            {
                return(0);
            }
            if (item.Height != null)
            {
                return(item.Height.Value);
            }
            int        nHeight = m_panelOperation.Height;
            COperation op      = item.Tag as COperation;

            CTypeOperation typeOp = op != null ? op.TypeOperation : null;

            if (typeOp != null)
            {
                if (typeOp.FormulaireCompteRendu != null)
                {
                    nHeight += typeOp.FormulaireCompteRendu.Formulaire.Height;
                }
                if (typeOp.IsLieeAEquipement)
                {
                    nHeight += m_panelLieEquipement.Height;
                }
                item.Height = nHeight;
            }
            else
            {
                nHeight = m_panelOperation.Height;
            }
            return(nHeight);
        }
コード例 #3
0
 //--------------------------------------------
 private void UpdateVisiDates(CTypeOperation typeOperation)
 {
     if (typeOperation == null)
     {
         return;
     }
     m_txtDuree.Visible = typeOperation.SaisieDureeAppliquee && !typeOperation.SaisieDureeParDateFin;
 }
コード例 #4
0
        //--------------------------------------------
        private void SetTypeOperation(CTypeOperation typeOperation)
        {
            bool bOldInitializing = m_bIsInitializing;

            if (typeOperation == null)
            {
                m_lblCode.Text                 = "";
                m_cmbTypeOperation.Text        = "";
                m_lblTypeOperation.Text        = "";
                m_panelLieEquipement.Visible   = false;
                m_panelEchangeMateriel.Visible = false;
                InitFormulaire(null);
                CalcHeight();
                UpdateAlerte();
            }
            else
            {
                if (Operation != null && !LockEdition)
                {
                    Operation.TypeOperation = typeOperation;
                }
                m_lblCode.Text = typeOperation.Code;
                if (!LockEdition && !IsCreatingImage)
                {
                    m_cmbTypeOperation.Visible      = true;
                    m_lblTypeOperation.Visible      = false;
                    m_cmbTypeOperation.Text         = typeOperation.Libelle;
                    m_cmbTypeOperation.SelectedItem = typeOperation.Libelle;
                    m_cmbTypeOperation.LockEdition  = LockEdition;
                    if (!LockEdition)
                    {
                        if (!Operation.IsNew() && typeOperation.VerrouillerLeTypeApresCreation)
                        {
                            m_cmbTypeOperation.LockEdition = true;
                        }
                    }
                }
                else
                {
                    m_lblTypeOperation.Text    = typeOperation.Libelle;
                    m_cmbTypeOperation.Visible = false;
                    m_lblTypeOperation.Visible = true;
                }
                m_panelLieEquipement.Visible   = typeOperation.IsLieeAEquipement;
                m_panelEchangeMateriel.Visible = typeOperation.IsRemplacementEquipement;
                m_btnPoubelle.Visible          = Operation.IsNew() || !typeOperation.InterditSuppressionApresCreation;



                UpdateVisiDates(typeOperation);
                InitFormulaire(typeOperation.FormulaireCompteRendu);
                CalcHeight();
                UpdateAlerte();
            }
            m_bIsInitializing = bOldInitializing;
        }
コード例 #5
0
 //--------------------------------------------------------------
 public CTypeOperation GetTypeOperation(CContexteDonnee ctx)
 {
     if (m_nIdTypeOperation != null)
     {
         CTypeOperation tp = new CTypeOperation(ctx);
         if (tp.ReadIfExists(m_nIdTypeOperation.Value))
         {
             return(tp);
         }
     }
     return(null);
 }
コード例 #6
0
ファイル: COperationServeur.cs プロジェクト: ykebaili/Timos
        //-------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="contexte"></param>
        /// <returns></returns>
        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);
            }
            ArrayList lst = new ArrayList(table.Rows);

            Dictionary <CFractionIntervention, bool> lstFractions = new Dictionary <CFractionIntervention, bool>();

            foreach (DataRow row in table.Rows)
            {
                if (row.RowState == DataRowState.Added)
                {
                    COperation operation = new COperation(row);
                    if (operation.FractionIntervention != null)
                    {
                        lstFractions[operation.FractionIntervention] = true;
                    }

                    CTypeOperation opType = operation.TypeOperation;

                    // Propage le lien de l'opération vers la phase si l'option est activée
                    if (opType != null && opType.PropagerSurPhaseApplique)
                    {
                        if (operation.FractionIntervention != null &&
                            operation.FractionIntervention.Intervention != null)
                        {
                            CPhaseTicket phase = operation.FractionIntervention.Intervention.PhaseTicket;
                            if (phase != null)
                            {
                                operation.PhaseTicket = phase;
                            }
                        }
                    }
                }
            }

            foreach (CFractionIntervention fraction in lstFractions.Keys)
            {
                fraction.UpdateEtat();
            }
            return(result);
        }
コード例 #7
0
 //--------------------------------------------------------------
 public void SetTypeOperation(CTypeOperation tp)
 {
     if (tp == null)
     {
         m_nIdTypeOperation = null;
     }
     else
     {
         m_nIdTypeOperation = tp.Id;
     }
     if (m_bIsCoutTarif)
     {
         m_fCoutUnitaire = null;
     }
 }
コード例 #8
0
 //-----------------------------------------
 /// <summary>
 /// Retourne le type de donnée correspondant au niveau demandé pour l'index de controle demandé
 /// </summary>
 /// <param name="nNiveau"></param>
 /// <param name="nIndexControle"></param>
 public CTypeOperation GetTypeDonneeNiveau(int nNiveau, int nIndexControle)
 {
     for (int nCtrl = nIndexControle - 1; nCtrl >= 0; nCtrl--)
     {
         if (nCtrl < m_listeControlsUtiles.Count - 1)
         {
             CControleSaisieOperation ctrl = (CControleSaisieOperation)m_listeControlsUtiles[nCtrl];
             CTypeOperation           tdq  = ctrl.TypeOperation;
             if (tdq != null && tdq.Niveau == nNiveau)
             {
                 return(tdq);
             }
         }
     }
     return(null);
 }
コード例 #9
0
ファイル: CLotValorisation.cs プロジェクト: ykebaili/Timos
        //-----------------------------------------------------------
        public CValorisationElement GetValorisation(CTypeOperation tp)
        {
            if (tp == null)
            {
                return(null);
            }
            CListeObjetsDonnees lstValos = Valorisations;

            lstValos.Filtre = new CFiltreData(CTypeOperation.c_champId + "=@1",
                                              tp.Id);
            if (lstValos.Count > 0)
            {
                return(lstValos[0] as CValorisationElement);
            }
            return(null);
        }
コード例 #10
0
        //----------------------------------------------------
        private void SetTypeOperationFromCombo()
        {
            string strText = m_cmbTypeOperation.Text.ToUpper();

            if (m_cmbTypeOperation.SelectedItem != null)
            {
                strText = m_cmbTypeOperation.SelectedItem.ToString().ToUpper();
            }

            if (m_dicTypesOperationsEnCours != null)
            {
                CTypeOperation typeOperation = null;
                if (m_dicTypesOperationsEnCours.TryGetValue(strText, out typeOperation))
                {
                    SetTypeOperation(typeOperation);
                }
            }
        }
コード例 #11
0
        //Appelé lorsqu'un élément change de type de donnée
        public void OnChangeTypeDonnee(int nIndex, CTypeOperation typeDonnee)
        {
            if (nIndex > m_listeControlsUtiles.Count - 1)
            {
                return;
            }
            CControleSaisieOperation ctrl = (CControleSaisieOperation)m_listeControlsUtiles[nIndex];
            int nNiveau = ctrl.Niveau;

            nIndex++;
            while (nIndex < m_listeControlsUtiles.Count)
            {
                CControleSaisieOperation ctrlSuivant = (CControleSaisieOperation)m_listeControlsUtiles[nIndex];
                if (ctrlSuivant.Niveau <= nNiveau)
                {
                    return;
                }
                if (ctrlSuivant.Niveau == nNiveau + 1)
                {
                    ctrlSuivant.OnChangeTypeParent(typeDonnee);
                }
                nIndex++;
            }
        }
コード例 #12
0
 //--------------------------------------------
 private void InitZoneChoixTypeOperation(CTypeOperation typeOperation)
 {
 }
コード例 #13
0
        //-------------------------------------------------------------------
        public override CResultAErreur VerifieDonnees(CObjetDonnee objet)
        {
            CResultAErreur result = CResultAErreur.True;

            try
            {
                CTypeOperation type_Operation = (CTypeOperation)objet;

                if (type_Operation.Libelle == "")
                {
                    result.EmpileErreur(I.T("Operation type label cannot be empty|146"));
                }
                CListeObjetsDonnees lst = new CListeObjetsDonnees(objet.ContexteDonnee, typeof(CTypeOperation));
                lst.Filtre = new CFiltreData(CTypeOperation.c_champId + "<>@1 and " +
                                             CTypeOperation.c_champLibelle + "=@2", type_Operation.Id, type_Operation.Libelle);
                if (type_Operation.TypeOperationParente == null)
                {
                    lst.Filtre = CFiltreData.GetAndFiltre(lst.Filtre,
                                                          new CFiltreData(CTypeOperation.c_champIdOperationParente + " is null"));
                }
                else
                {
                    lst.Filtre = CFiltreData.GetAndFiltre(lst.Filtre,
                                                          new CFiltreData(CTypeOperation.c_champIdOperationParente + "=@1",
                                                                          type_Operation.TypeOperationParente.Id));
                }
                if (lst.Count != 0)
                {
                    result.EmpileErreur(I.T("Operation type @1 already exists|147"), type_Operation.Libelle);
                }

                if (type_Operation.Code != "")
                {
                    lst.Filtre = new CFiltreData(CTypeOperation.c_champId + "<>@1 and " +
                                                 CTypeOperation.c_champCode + "=@2", type_Operation.Id, type_Operation.Code);
                    if (type_Operation.TypeOperationParente == null)
                    {
                        lst.Filtre = CFiltreData.GetAndFiltre(lst.Filtre,
                                                              new CFiltreData(CTypeOperation.c_champIdOperationParente + " is null"));
                    }
                    else
                    {
                        lst.Filtre = CFiltreData.GetAndFiltre(lst.Filtre,
                                                              new CFiltreData(CTypeOperation.c_champIdOperationParente + "=@1",
                                                                              type_Operation.TypeOperationParente.Id));
                    }
                    if (lst.Count != 0)
                    {
                        if (!CObjetDonneeAIdNumerique.IsUnique(type_Operation, CTypeOperation.c_champCode, type_Operation.Code))
                        {
                            result.EmpileErreur(I.T("Another operation type with the code @1 already exists|148"), type_Operation.Code);
                        }
                    }
                }
                if (type_Operation.SaisieDureeParDateFin == true &&
                    (!type_Operation.SaisieDureeAppliquee ||
                     !type_Operation.SaisieHeureAppliquee))
                {
                    result.EmpileErreur(I.T("Option 'Enter end date' needs option 'Input duration' and 'Input start date'|20139"));
                }
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            return(result);
        }