Пример #1
0
        private void FillHistorique(CTypeTicketContrat_Site_Periode[] periodes)
        {
            if (periodes == null)
            {
                m_gridHistorique.DataSource = null;
                m_gridHistorique.Visible    = false;
            }
            else
            {
                m_gridHistorique.Visible = true;
                m_gridHistorique.Columns.Clear();
                m_gridHistorique.AutoGenerateColumns = false;

                CDataGridViewDateTimeColumn colDt = new CDataGridViewDateTimeColumn();
                colDt.HeaderText       = I.T("Start|20239");
                colDt.Width            = 80;
                colDt.DataPropertyName = "DateDebut";
                m_gridHistorique.Columns.Add(colDt);

                colDt                  = new CDataGridViewDateTimeColumn();
                colDt.HeaderText       = I.T("End|20240");
                colDt.Width            = 80;
                colDt.DataPropertyName = "DateFin";
                m_gridHistorique.Columns.Add(colDt);
                m_gridHistorique.DataSource = periodes;
                m_gridHistorique.ReadOnly   = !m_extModeEdition.ModeEdition;
            }
        }
Пример #2
0
        public void Init(CContrat contrat)
        {
            m_contrat = contrat;
            if (m_contrat == null)
            {
                Visible = false;
                return;
            }
            using (CWaitCursor waiter = new CWaitCursor())
            {
                Visible = true;
                m_faciliteurEditePeriode = new CFaciliteurEditionPeriodesSiteTypeTicket();
                m_faciliteurEditePeriode.InitFromContrat(contrat);
                m_dtFiltre.Value = m_dateFiltrePeriodes;
                InitDataSet();

                m_dataTable.AcceptChanges();
                m_grid.AutoGenerateColumns = false;
                m_grid.AllowUserToAddRows  = false;
                m_grid.Columns.Clear();
                DataGridViewTextBoxColumn colTxt = new DataGridViewTextBoxColumn();
                colTxt.ReadOnly         = true;
                colTxt.HeaderText       = "Site";
                colTxt.DataPropertyName = "SITE_LABEL";
                m_grid.Columns.Add(colTxt);

                DataTable table   = m_dataTable;
                int       nCpt    = 0;
                Color     couleur = Color.FromArgb(255, 200, 200);
                m_dicColsParTypeTicket.Clear();
                foreach (DataColumn col in table.Columns)
                {
                    CTypeTicketContrat tt = col.ExtendedProperties[typeof(CTypeTicketContrat)] as CTypeTicketContrat;
                    if (tt != null)
                    {
                        ETypeContenuColonne?typeContenu = col.ExtendedProperties[typeof(ETypeContenuColonne)] as ETypeContenuColonne?;
                        if (typeContenu != null && (typeContenu.Value == ETypeContenuColonne.dateDebut ||
                                                    typeContenu.Value == ETypeContenuColonne.dateFin))
                        {
                            if ((typeContenu == ETypeContenuColonne.dateDebut))
                            {
                                couleur = nCpt % 2 == 0 ? Color.FromArgb(255, 200, 200) : Color.FromArgb(200, 255, 200);
                                nCpt++;
                            }
                            CDataGridViewDateTimeColumn colDt = new CDataGridViewDateTimeColumn();
                            colDt.HeaderText = typeContenu.Value == ETypeContenuColonne.dateDebut ? I.T("Start|20239") : I.T("End|20240");
                            colDt.DefaultCellStyle.BackColor = couleur;
                            colDt.DataPropertyName           = col.ColumnName;
                            colDt.Width = 80;
                            m_grid.Columns.Add(colDt);
                            DataGridViewColumn[] cols = null;
                            if (!m_dicColsParTypeTicket.TryGetValue(tt, out cols))
                            {
                                cols = new DataGridViewColumn[2];
                                m_dicColsParTypeTicket[tt] = cols;
                            }
                            if (typeContenu.Value == ETypeContenuColonne.dateDebut)
                            {
                                cols[0] = colDt;
                            }
                            else
                            {
                                cols[1] = colDt;
                            }
                        }
                    }
                }
                m_grid.DataSource = m_dataTable;
                m_grid.ReadOnly   = !m_extModeEdition.ModeEdition;
                m_panelTypeTicketHeader.Refresh();
            }
        }