Esempio n. 1
0
        ////////////////////////////////////
        private void m_wndListeEntrees_DoubleClick(object sender, System.EventArgs e)
        {
            if (m_wndListeEntrees.SelectedItems.Count != 1)
            {
                return;
            }
            CVisuEntreeAgenda entree = (CVisuEntreeAgenda)m_wndListeEntrees.SelectedItems[0].Tag;

            if (OnDemandeAffichageEntree != null)
            {
                OnDemandeAffichageEntree(entree.Entree);
            }
        }
Esempio n. 2
0
        ////////////////////////////////////
        private void UpdateItemText(ListViewItem item)
        {
            if (!(item.Tag is CVisuEntreeAgenda))
            {
                return;
            }
            CVisuEntreeAgenda entree  = (CVisuEntreeAgenda)item.Tag;
            string            strText = "";

            if (!entree.Entree.SansHoraire && CUtilDate.SetTime0(entree.DateDebut) == CUtilDate.SetTime0(m_date))
            {
                if (Width > 68)
                {
                    strText = GetHeure(entree.DateDebut);
                }
                if (m_bModeSemaine)
                {
                    if (entree.DateFin.Date == m_date.Date)
                    {
                        strText += "-" + GetHeure(entree.DateFin) + " ";
                    }
                    else
                    {
                        strText += "...";
                    }
                }
                else
                {
                    strText += " ";
                }
            }
            if (CUtilDate.SetTime0(entree.DateDebut) != CUtilDate.SetTime0(m_date))
            {
                strText += "...";
                if (m_bModeSemaine && entree.DateFin.Date == m_date.Date)
                {
                    strText += GetHeure(entree.DateFin) + " ";
                }
            }
            if (m_bAvecInitiales)
            {
                if (entree.ElementLie is IElementAIdentificationCourteAgenda)
                {
                    strText += ((IElementAIdentificationCourteAgenda)entree.ElementLie).IdentificationCourte + "-";
                }
            }
            strText  += entree.Entree.Libelle;
            item.Text = strText;
        }
Esempio n. 3
0
        ////////////////////////////////////
        public void AddEntree(CVisuEntreeAgenda entree, int nIndexImage)
        {
            int nPos = 0;

            if (entree.Entree.SansHoraire || entree.Entree.DateDebut != m_date)
            {
                nPos = m_nFirstEntreeAvecHeure;
                m_listeEntreeAgenda.Insert(m_nFirstEntreeAvecHeure, entree);
                m_nFirstEntreeAvecHeure++;
            }
            else
            {
                nPos = 0;
                bool bAdded = false;
                foreach (CVisuEntreeAgenda entreeEnPlace in m_listeEntreeAgenda)
                {
                    if (!entreeEnPlace.Entree.SansHoraire &&
                        entreeEnPlace.DateDebut > entree.DateDebut)
                    {
                        m_listeEntreeAgenda.Insert(nPos, entree);
                        bAdded = true;
                        break;
                    }
                    nPos++;
                }
                if (!bAdded)
                {
                    nPos = m_listeEntreeAgenda.Count;
                    m_listeEntreeAgenda.Add(entree);
                }
            }
            //Créee l'item
            ListViewItem item = new ListViewItem();

            item.Tag        = entree;
            item.ImageIndex = nIndexImage;
            Color couleurTexte = Color.Black, couleurFond = Color.White;

            CCouleursForEntreeAgenda.GetCouleursFor(entree.Entree, ref couleurFond, ref couleurTexte);
            item.BackColor = couleurFond;
            item.ForeColor = couleurTexte;
            m_wndListeEntrees.Items.Insert(nPos, item);
            m_wndListeEntrees.ListViewItemSorter = new ItemSorter();
            m_wndListeEntrees.Sort();
            UpdateItemText(item);
        }
Esempio n. 4
0
        /// ////////////////////////////////////////////
        private void UpdateItems()
        {
            CreateControl();
            CListeRelationsEntreeAgenda listeEntrees = null;

            CVisuEntreeAgenda[] visus = new CVisuEntreeAgenda[0];
            if (m_elementsAAgenda != null && m_elementsAAgenda.Length > 0)
            {
                listeEntrees        = new CListeRelationsEntreeAgenda(m_elementsAAgenda[0].ContexteDonnee, m_elementsAAgenda);
                listeEntrees.Filtre = m_filtreAAppliquer;
                visus = listeEntrees.GetVisusForPeriode(m_dtFirstCellDate, m_dtFirstCellDate.AddDays(35));
            }
            foreach (CControlJourAgendaModeMois ctrl in m_listeControlsJours)
            {
                ctrl.Clear();
                ctrl.AvecInitiales = m_elementsAAgenda != null && m_elementsAAgenda.Length > 1;
            }
            if (m_elementsAAgenda == null)
            {
                return;
            }
            DateTime dtDebut = m_dtFirstCellDate;
            DateTime dtFin   = m_dtFirstCellDate.AddDays(35);

            foreach (CVisuEntreeAgenda visu in visus)
            {
                if (visu.DateDebut <= dtFin ||
                    visu.DateFin >= dtDebut)
                {
                    TimeSpan sp   = visu.DateDebut - m_dtFirstCellDate;
                    int      nMin = (int)Math.Max(sp.TotalDays, 0);
                    sp = visu.DateFin - m_dtFirstCellDate;
                    int nMax     = (int)Math.Min(sp.TotalDays, 34);
                    int nIdImage = -1;
                    if (m_imagesRoles != null)
                    {
                        nIdImage = m_imagesRoles.GetIndexImageForRole(visu.Role);
                    }
                    for (int nDay = nMin; nDay <= nMax; nDay++)
                    {
                        ((CControlJourAgendaModeMois)m_listeControlsJours[nDay]).AddEntree(visu, nIdImage);
                    }
                }
            }
        }
Esempio n. 5
0
        private void m_wndListeEntrees_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            ListViewItem item = m_wndListeEntrees.GetItemAt(e.X, e.Y);

            if (item == m_lastItemInTooltip)
            {
                return;
            }
            if (item == null)
            {
                m_tooltip.SetToolTip(m_wndListeEntrees, "");
            }
            else
            {
                CVisuEntreeAgenda entree  = (CVisuEntreeAgenda)item.Tag;
                string            strText = entree.Entree.Libelle + "\r\n";
                if (entree.Entree.Commentaires.Trim() != "")
                {
                    strText += entree.Entree.Commentaires + "\r\n";
                }
                if (entree.Entree is CEntreeAgenda)
                {
                    CEntreeAgenda ea = (CEntreeAgenda)entree.Entree;
                    foreach (CRelationEntreeAgenda_ElementAAgenda relation in ea.RelationsElementsAgenda)
                    {
                        if (relation.ElementLie != null)
                        {
                            strText += relation.RelationTypeEntree_TypeElement.Libelle + " : " +
                                       relation.ElementLie.DescriptionElement + "\r\n";
                        }
                    }
                }
                m_tooltip.SetToolTip(m_wndListeEntrees, strText);
            }
            m_lastItemInTooltip = item;
        }