예제 #1
0
        private void AfficheHistorique()
        {
            m_panelInfoSite.Visible = false;
            DataGridViewCell cell = m_grid.CurrentCell;

            if (m_grid.SelectedCells.Count == 1 && cell != null)
            {
                DataRowView rowView = m_grid.CurrentRow.DataBoundItem as DataRowView;
                if (rowView != null)
                {
                    DataRow    row  = rowView.Row;
                    int        nCol = cell.ColumnIndex;
                    DataColumn col  = m_dataTable.Columns[m_grid.Columns[nCol].DataPropertyName];
                    if (col != null)
                    {
                        CTypeTicketContrat tt = col.ExtendedProperties[typeof(CTypeTicketContrat)] as CTypeTicketContrat;
                        if (tt != null)
                        {
                            int   nIdSite = (int)row["SITE_ID"];
                            CSite site    = m_faciliteurEditePeriode.GetSite(nIdSite);
                            m_lblSite.Text          = site.Libelle;
                            m_lblTypeTicket.Text    = tt.TypeTicket.Libelle;
                            m_panelInfoSite.Visible = true;
                            CTypeTicketContrat_Site ts = tt.GetRelationSite(nIdSite);
                            FillHistorique(ts == null?null:(CTypeTicketContrat_Site_Periode[])ts.Periodes.ToArray(typeof(CTypeTicketContrat_Site_Periode)));
                            return;
                        }
                    }
                }
            }
        }
        public CTypeTicketContrat GetTypeTicketContrat(int nId)
        {
            if (m_contrat == null)
            {
                return(null);
            }
            CTypeTicketContrat tt = tt = new CTypeTicketContrat(m_contrat.ContexteDonnee);

            if (tt.ReadIfExists(nId))
            {
                return(tt);
            }
            return(null);
        }
예제 #3
0
        private void m_gridHistorique_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            CTypeTicketContrat_Site_Periode periode = ((CTypeTicketContrat_Site_Periode[])m_gridHistorique.DataSource)[e.RowIndex] as CTypeTicketContrat_Site_Periode;

            if (periode != null)
            {
                DataRowView rowView = m_grid.CurrentRow.DataBoundItem as DataRowView;
                if (rowView != null)
                {
                    DataRow            row        = rowView.Row;
                    CTypeTicketContrat typeTicket = periode.TypeTicketContrat_Site.TypeTicket_Contrat;
                    object             val        = row[m_dicColsIdSitePeriode[typeTicket]];
                    if (val is int && ((int)(val)) == periode.Id)
                    {
                        row[m_dicColsDebut[typeTicket]] = periode.DateDebut;
                        row[m_dicColsFin[typeTicket]]   = periode.DateFin;
                    }
                }
            }
        }
예제 #4
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();
            }
        }