//------------------------------------------------------- protected override void MyDraw(CContextDessinObjetGraphique ctx) { if (!m_prj.IsValide()) { return; } Graphics g = ctx.Graphic; foreach (I2iObjetGraphique objet in m_listeChilds) { if (objet is CWndProjetBrique && m_prj.AfficherMiniature && !m_bMiniature) { CWndProjetBrique prj = (CWndProjetBrique)objet; g.DrawImageUnscaled(prj.Miniature, new Rectangle(prj.Position.X, prj.Position.Y, prj.Projet.DesignerProjetWidth, prj.Projet.DesignerProjetHeight)); Rectangle rect = new Rectangle(prj.Position.X, prj.Position.Y, prj.Projet.DesignerProjetWidth, prj.Projet.DesignerProjetHeight); Pen pen = new Pen(Color.Black); g.DrawRectangle(pen, rect); pen.Dispose(); } else { objet.Draw(ctx); } } }
//------------------------------------------------- protected override void MyDraw(CContextDessinObjetGraphique ctx) { Graphics g = ctx.Graphic; if (!m_projet.IsValide()) { return; } Text = m_projet.Libelle; if (m_bMiniature) { g.DrawImage(new CWndProjetDetail(m_projet).Miniature, Position); } else { base.MyDraw(ctx); } m_bMiniature = false; CUtilProjet.DrawIcones(g, this); }
private void m_menuArbreGanttAdd_Click(object sender, EventArgs e) { CElementDeGanttProjet eltProjet = m_gantt.SelectedElement as CElementDeGanttProjet; if (eltProjet != null) { CProjet projet = new CProjet(eltProjet.ProjetAssocie.ContexteDonnee); projet.CreateNew(); projet.Projet = eltProjet.ProjetAssocie; CFormNavigateurPopup.Show(new CFormEditionProjet(projet), FormWindowState.Maximized); if (!projet.IsValide() || !projet.VerifieDonnees(false).Result) { return; } Init(); } }
//----------------------------------------------------- private CResultAErreur AfficherEditeur(IElementDeProjet element) { CResultAErreur result = CResultAErreur.True; if (element is CProjet) { CProjet projet = (CProjet)element; if (projet.IsNew() && m_controlEdition.ModeEdition == EModeEditeurProjet.Selection) { projet.BeginEdit(); } CFormNavigateurPopup.Show(new CFormEditionProjet(projet)); if (!projet.IsValide() || !projet.VerifieDonnees(false).Result) { result = CResultAErreur.False; } } if (element is CIntervention) { CIntervention inter = (CIntervention)element; if (inter.IsNew() && m_controlEdition.ModeEdition == EModeEditeurProjet.Selection) { inter.BeginEdit(); } CFormNavigateurPopup.Show(new CFormEditionIntervention(inter)); if (!inter.IsValide() || !inter.VerifieDonnees(false).Result) { result = CResultAErreur.False; } } if (result) { ActualiserDesigner(); GenererListeContenu(); } return(result); }
public void Init(CProjet projet) { if (projet == null || !projet.IsValide()) { Visible = false; return; } Visible = true; if (projet != m_projet) { DateTime dateDebut = DateTime.Now; if (projet != null && projet.DateDebutPlanifiee != null) { dateDebut = projet.DateDebutPlanifiee.Value; } m_parametreAffichage.DateDebut = m_parametreAffichage.AddCells(dateDebut, -1); } m_projet = projet; m_metaProjet = null; if (projet != null) { m_contexteDonnee = projet.ContexteDonnee; } CParametreDessinLigneGantt parametreDessinGantt; m_composantSauvegardePreferences.InitFromRegistre(); if (m_parametreDessinLigne != null) { parametreDessinGantt = m_parametreDessinLigne; } else { parametreDessinGantt = CParametreDessinLigneGantt.ParametreParDefaut; } m_parametreAffichage.LineHeight = parametreDessinGantt.HauteurLigne; m_gantt.Visible = false; m_gantt.Parametre = m_parametreAffichage; CFiltreData filtre = m_filtreDeBase; if (m_filtreUser != null) { filtre = CFiltreData.GetAndFiltre(filtre, m_filtreUser); } m_iconeHasFilter.Visible = m_filtreUser != null && m_filtreUser.Filtre != "" && m_filtreUser.Filtre != "1=1"; CResultAErreur result = CParametrageGantt.CreateGantt( projet, m_parametreGroupement == null ? null : m_parametreGroupement.GroupeRacine, filtre); if (result) { m_baseGantt = result.Data as CBaseGantt; m_gantt.Visible = true; m_gantt.Init(m_baseGantt); m_gantt.ParametreDessinLigne = parametreDessinGantt; } m_cmbDisplayMode.Init(typeof(CParametrageGantt), "Libelle", false); if (m_parametreGroupement != null) { m_cmbDisplayMode.ElementSelectionne = m_parametreGroupement; } }
//------------------------------------------------------------------- public override CResultAErreur TraitementAvantSauvegarde(CContexteDonnee contexte) { CResultAErreur result = CResultAErreur.True; try { result = base.TraitementAvantSauvegarde(contexte); } catch (Exception e) { result.EmpileErreur(new CErreurException(e)); return(result); } if (!result) { return(result); } DataTable table = contexte.Tables[GetNomTable()]; if (table == null) { return(result); } HashSet <CProjet> projetsARecalculer = new HashSet <CProjet>(); HashSet <CMetaProjet> metaProjetsARecalculer = new HashSet <CMetaProjet>(); bool bIsCalculatingAsynchrones = CGestionnaireProjetsAsynchrones.IsModeCalculProjet(contexte); List <int> lstProjetsAsynchrones = new List <int>(); List <int> lstMetasProjetsAsynchrones = new List <int>(); foreach (DataRow row in new ArrayList(table.Rows)) { if (!bIsCalculatingAsynchrones) { GereProjetAsynchrone(row); } if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added) { CProjet projet = new CProjet(row); if (projet.ModeCalculDatesParentes == (int)EModeCalculDatesProjet.Suspended) { projet.ModeCalculDatesParentes = (int)EModeCalculDatesProjet.Automatic; } if (projet.IsNew()) { result = CreateVersionRecursif(projet); if (!result) { return(result); } projetsARecalculer.Add(projet); } // Si les dates réelles (Début ou fin ) sont renseignées, alors on mes le flag Dates Auto à False if ((projet.DateDebutReel != null || projet.DateFinRelle != null) && !projet.HasChilds()) { projet.DateDebutAuto = false; } // Si les dates planifiées on changées, force le Parent de plus haut niveau à recalculer ses dates if (!row.HasVersion(DataRowVersion.Original) || (row[CProjet.c_champDateDebutPlanifiee] != row[CProjet.c_champDateDebutPlanifiee, DataRowVersion.Original] || row[CProjet.c_champDateFinPlanifiee] != row[CProjet.c_champDateFinPlanifiee, DataRowVersion.Original] || row[CProjet.c_champDateDebutReel] != row[CProjet.c_champDateDebutReel, DataRowVersion.Original] || row[CProjet.c_champDateFinReel] != row[CProjet.c_champDateFinReel, DataRowVersion.Original] || row[CProjet.c_champPctAvancement] != row[CProjet.c_champPctAvancement, DataRowVersion.Original] || row[CProjet.c_champPoids] != row[CProjet.c_champPoids, DataRowVersion.Original]) ) { foreach (CRelationMetaProjet_Projet rel in projet.RelationsMetaProjets) { if (rel.IsValide() && rel.MetaProjet.IsValide()) { if (rel.MetaProjet.ModeUpdateAsynchrone && rel.MetaProjet.Row.RowState != DataRowState.Added || bIsCalculatingAsynchrones) { lstMetasProjetsAsynchrones.Add(rel.MetaProjet.Id); } else { metaProjetsARecalculer.Add(rel.MetaProjet); } } } if (projet.IsNew() && !projet.HasChilds()) { projet.CalcWeight(false); projet.CalcProgress(false); } projet = projet.Projet; while (projet != null && projet.IsValide()) { if (!projet.ModeUpdateAsynchrone || projet.Row.RowState == DataRowState.Added || bIsCalculatingAsynchrones) { projetsARecalculer.Add(projet); projet = projet.Projet; } else { lstProjetsAsynchrones.Add(projet.Id); break; } } } } if (row.RowState == DataRowState.Deleted) { CProjet projet = new CProjet(row); projet.VersionToReturn = DataRowVersion.Original; if (projet.Projet != null && projet.Projet.IsValide()) { projetsARecalculer.Add(projet.Projet); } } } //Tri les projets par profondeur (du plus profond au moins profond) List <CProjet> lstProjetsTries = new List <CProjet>(); foreach (CProjet projet in projetsARecalculer) { if (projet.Row.RowState != DataRowState.Deleted) { lstProjetsTries.Add(projet); } } try { lstProjetsTries.Sort(delegate(CProjet x, CProjet y) { return(-x.CodeSystemeComplet.Length.CompareTo(y.CodeSystemeComplet.Length)); }); } catch (Exception ex) { result.EmpileErreur(new CErreurException(ex)); return(result); } // Recalcul les dates PLANIFIEES des projets marqués A recalculés, et leur Avancement foreach (CProjet projet in lstProjetsTries) { if (projet.HasChilds()) { projet.UpdateDateDebutPlanifieeCalculeeFromChilds(); projet.UpdateDateFinPlanifieeCalculeeFromChilds(); projet.UpdateDateDebutReelleFromFils(); projet.UpdateDateFinReelleFromFils(); } projet.UpdateWeight(); projet.UpdateProgress(); } foreach (CMetaProjet meta in metaProjetsARecalculer) { meta.UpdateDateDebutPlanifieeFromChilds(true); meta.UpdateDateFinPlanifieeFromChilds(true); meta.UpdateDateDebutReelleFromChilds(true); meta.UpdateDateFinReelleFromChilds(true); meta.CalcProgress(false); } if (!bIsCalculatingAsynchrones) { CGestionnaireProjetsAsynchrones.ASyncCalc(IdSession, lstProjetsAsynchrones, lstMetasProjetsAsynchrones); } return(result); }