Пример #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);
            }
        }
 //---------------------------------------------------------------------------
 private void m_btnPoubelle_Click(object sender, EventArgs e)
 {
     if (m_extModeEdition.ModeEdition)
     {
         CEditeurOperationsPreventives ctrlListe = AssociatedListControl as CEditeurOperationsPreventives;
         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);
                 }
             }
         }
     }
 }
Пример #3
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();
         }
     }
 }
Пример #4
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.ElementAOperationPrevisionnelle = 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 (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);
        }
        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)
            {
                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)
                {
                    m_dicTypesOperationsEnCours = new Dictionary <string, CTypeOperation>();
                    List <CTypeOperation>        lstTypes = TypesOperationsPossibles;
                    AutoCompleteStringCollection lstVals  = new AutoCompleteStringCollection();
                    if (lstTypes != null)
                    {
                        foreach (CTypeOperation type in lstTypes)
                        {
                            m_dicTypesOperationsEnCours[type.Libelle.ToUpper()] = type;
                            lstVals.Add(type.Libelle);
                            if (type.Code.Length > 0 && !m_dicObjetToTypesOperations.ContainsKey(type.Code))
                            {
                                m_dicTypesOperationsEnCours[type.Code.ToUpper()] = type;
                                lstVals.Add(type.Code);
                            }
                        }
                    }
                    m_cmbTypeOperation.Items.Clear();
                    foreach (string strVal in lstVals)
                    {
                        m_cmbTypeOperation.Items.Add(strVal);
                    }
                }
                InitSelectEquipement();

                SetTypeOperation(itemOp.Operation.TypeOperation);
                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.TypeEquipement != null)
                {
                    m_txtSelectEquipementLie.ElementSelectionne = itemOp.Operation.TypeEquipement;
                }
                UpdateMarge();
                UpdateAlerte();
            }
            m_bIsInitializing = false;
            return(result);
        }