Beispiel #1
0
        private void AddOperation(COperation operation, CItemOperation itemParent)
        {
            CItemOperation item = new CItemOperation(operation, itemParent);

            AddItem(item, false);
            foreach (COperation child in operation.OperationsFilles)
            {
                AddOperation(child, item);
            }
        }
Beispiel #2
0
        protected override CResultAErreur MyInitChamps(CCustomizableListItem item)
        {
            m_bIsInitializing = true;
            CResultAErreur result = base.MyInitChamps(item);

            CItemOperation itemOp = item as CItemOperation;

            if (itemOp != null && itemOp.Operation != null)
            {
                InitZoneActeur(itemOp.Operation.Acteur);
                m_txtCommentaire.Text = itemOp.Operation.Commentaires;
                UpdateVisiDates(itemOp.Operation.TypeOperation);
                m_cmbTypeOperation.Visible = !LockEdition && !IsCreatingImage;
                m_lblTypeOperation.Width   = m_cmbTypeOperation.Width;
                m_lblTypeOperation.Visible = LockEdition || IsCreatingImage;
                if (!IsCreatingImage)
                {
                    RefreshTypesOperationsEnCours();
                }
                InitSelectEquipement();

                SetTypeOperation(itemOp.Operation.TypeOperation);
                m_dateDebut.Value = itemOp.Operation.DateDebut == null?DateTime.Now : itemOp.Operation.DateDebut.Value;
                m_dateFin.Value   = itemOp.Operation.DateHeureFin == null?DateTime.Now : itemOp.Operation.DateHeureFin.Value;
                if (itemOp.Operation.Duree != null)
                {
                    m_txtDuree.UnitValue = new CValeurUnite(itemOp.Operation.Duree.Value, CClasseUniteTemps.c_idH);
                }
                else
                {
                    m_txtDuree.UnitValue = null;
                }
                m_txtCommentaire.Text = itemOp.Operation.Commentaires;

                if (itemOp.Operation.Equipement != null)
                {
                    m_txtSelectEquipementLie.ElementSelectionne = itemOp.Operation.Equipement;
                }
                UpdateMarge();
                UpdateAlerte();
            }
            m_bIsInitializing = false;
            return(result);
        }
Beispiel #3
0
 //---------------------------------------------------------------------------
 private void m_btnPoubelle_Click(object sender, EventArgs e)
 {
     if (m_extModeEdition.ModeEdition)
     {
         CEditeurOperations ctrlListe = AssociatedListControl as CEditeurOperations;
         if (ctrlListe != null && CurrentItem != null)
         {
             CItemOperation item = CurrentItem as CItemOperation;
             if (item != null && item.Operation != null)
             {
                 if (CFormAlerte.Afficher(I.T("Delete operation @1|20679", Operation.Libelle),
                                          EFormAlerteBoutons.OuiNon, EFormAlerteType.Question) == DialogResult.Yes)
                 {
                     ctrlListe.RemoveItem(CurrentItem, true);
                 }
             }
         }
     }
 }
Beispiel #4
0
 //--------------------------------------------------
 public override void RemoveItem(int nIndex, bool bRedraw)
 {
     if (nIndex >= 0 && nIndex < Items.Count())
     {
         CItemOperation item = Items[nIndex] as CItemOperation;
         if (item != null)
         {
             CurrentItemIndex = null;
             List <CCustomizableListItemANiveau> lstToDelete = GetItemsDependants(item);
             lstToDelete.Insert(0, item);
             lstToDelete.Reverse();
             foreach (CItemOperation toDelete in lstToDelete)
             {
                 item.Operation.Delete(true);
                 base.RemoveItem(item.Index, false);
             }
             Refresh();
         }
     }
 }
Beispiel #5
0
 //---------------------------------------------------
 public CItemOperation(COperation operation, CItemOperation itemParent)
     : base(itemParent)
 {
     Tag = operation;
 }
Beispiel #6
0
        //-------------------------------------------------------------
        public bool AddOperationALaFin()
        {
            if (LockEdition)
            {
                return(false);
            }
            //s'il y a des opérations sans type, on n'ajoute pas
            foreach (CItemOperation item in Items)
            {
                if (item.Operation == null || item.Operation.TypeOperation == null)
                {
                    CurrentItemIndex = item.Index;
                    return(false);
                }
            }
            //Regarde si le dernier item est vide
            if (!LockEdition && ElementAOperations != null)
            {
                CItemOperation item = null;

                COperation operation = new COperation(ElementAOperations.ContexteDonnee);
                operation.CreateNewInCurrentContexte();
                operation.ElementAOperationsRealisees = ElementAOperations;
                CItemOperation prec       = null;
                CItemOperation itemParent = null;
                if (Items.Count() > 0)
                {
                    prec = GetVisibleItemBefore(Items.Count()) as CItemOperation;
                    if (prec != null)
                    {
                        if (prec.Operation != null && prec.Operation.TypeOperation != null &&
                            prec.Operation.TypeOperation.TypesOperationsFilles.Count > 0)
                        {
                            operation.OperationParente = prec.Operation;
                            itemParent = prec;
                        }
                        else
                        {
                            operation.OperationParente = prec.Operation.OperationParente;
                            itemParent = prec.ItemParent as CItemOperation;
                        }
                        if (prec.Operation.DateHeureFin != null)
                        {
                            operation.DateDebut = prec.Operation.DateHeureFin;
                        }
                        else
                        {
                            operation.DateDebut = prec.Operation.DateDebut;
                        }

                        //Pour rester conforme au fonctionnement du contrôle
                        //avant sa réécriture
                        //c'est l'utilisateur en cours le bon acteur et non pas le précédent
                        //entre nov 2012 et Sept 2012, la ligne suivante a été active.
                        //operation.Acteur = prec.Operation.Acteur;
                    }
                }
                if (operation.Acteur == null)
                {
                    CDonneesActeurUtilisateur user = CUtilSession.GetUserForSession(operation.ContexteDonnee);
                    if (user != null)
                    {
                        operation.Acteur = user.Acteur;
                    }
                }
                if (operation.OperationParente != null)
                {
                    operation.Niveau = operation.OperationParente.Niveau + 1;
                }
                else
                {
                    operation.Niveau = 0;
                }
                item = new CItemOperation(operation, itemParent);
                AddItem(item, true);
                CurrentItemIndex = item.Index;
                if (AfterAddOperation != null)
                {
                    AfterAddOperation(this, null);
                }
                return(true);
            }
            return(false);
        }