private DbEntities.dbserver3.wordup.rows.Ort[] GetOrteToDraw(out DbEntities.dbserver3.wordup.rows.Projekt[] Projekte, TypeOfPictureToDraw PictureToDraw) { DbEntities.dbserver3.wordup.rows.Ort[] Result = new Ort[0]; Projekte = new Projekt[0]; switch (PictureToDraw) { case TypeOfPictureToDraw.AllActuallExistingOrte: case TypeOfPictureToDraw.AllActuallWuensche: Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Wuensche"); Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray(); break; case TypeOfPictureToDraw.AllActuallWuenscheNotFinish: Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Wuensche") .Where(sel => sel.Ort.WLaenge == null).ToArray(); Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray(); break; case TypeOfPictureToDraw.AllActualPlanungen: Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Planungen"); Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray(); break; case TypeOfPictureToDraw.AllActuallPlanungenNotFinish: Projekte = Data.DbServer3.WordUp.Projekte.Find_PhasenCorrectProjekte("Planungen") .Where(sel => sel.Ort.WLaenge == null || sel.PPTBilder.Count == 0).ToArray(); Result = Projekte.Select(sel => sel.Ort).Distinct().OrderBy(ord => ord.Bezeichnung).ToArray(); break; } return Result; }
public void CreateLagePlanBilder (String TargetDirectory, TypeOfPictureToDraw PictureToDraw) { DrawingVisual DrawingBoard = new DrawingVisual (); DrawingContext BoardContext = DrawingBoard.RenderOpen (); double AspectRatio = LiesingHorizontalExtent / LiesingVerticalExtent; double Width = 1280; double Height = Width / AspectRatio; Rect OutsideDrawingRect = new Rect (0, 0, Width, Height); DrawBackGroundPicture (BoardContext, OutsideDrawingRect, Path.Combine (TargetDirectory, Properties.Settings.Default.LiesingPicture)); Projekt[] ProjecteToDraw = null; DbEntities.dbserver3.wordup.rows.Ort[] OrteToDraw = GetOrteToDraw (out ProjecteToDraw, PictureToDraw); int OrtsNumber = 0; List<MapAdditionalInfo> mapAdditionalInfos = new List<MapAdditionalInfo> (); int OrteIDNumber = 0; foreach (Ort OrtToDraw in OrteToDraw) { OrteIDNumber++; MapAdditionalInfo mapAdditionalInfoEntry = new MapAdditionalInfo(OrtToDraw, OrteIDNumber); mapAdditionalInfos.Add(mapAdditionalInfoEntry); mapAdditionalInfoEntry.ProjekteOnThisOrt = ProjecteToDraw.Where(sel => sel.Ort == OrtToDraw).ToArray(); DrawOrtsEntry (BoardContext, Width, OutsideDrawingRect, mapAdditionalInfoEntry); /* DataTable Projekte = null; switch (PictureToDraw) { case TypeOfPictureToDraw.AllActuallWuensche: Projekte = WordUpWCFAccess.GetCommonDataSet ("Select * from ProjektUebersicht where WordUpRootID = '" + WordUpID + "' and OrteID = '" + OrtsID + "'").Tables ["ProjektUebersicht"]; MapAdditionalInfo.Add (mapAdditionalInfoEntry); AddProjektInfosToMapInfo (MapAdditionalInfo, Projekte); CreateDrawingLegende (TargetDirectory, ProjecteToDraw); break; case TypeOfPictureToDraw.AllActuallWuenscheNotFinish: Projekte = WordUpWCFAccess.GetCommonDataSet ("Select * from ProjektUebersicht where WordUpRootID = '" + WordUpID + "' and OrteID = '" + OrtsID + "' and ((DokumentationsStatus is null) or (DokumentationsStatus = '') " + "or (not DokumentationsStatus = 'Video;Bild')) and Zustaendig = 'Bezirk'") .Tables ["ProjektUebersicht"]; MapAdditionalInfo.Add (mapAdditionalInfoEntry); AddProjektInfosToMapInfo (MapAdditionalInfo, Projekte); CreateDrawingLegende (TargetDirectory, ProjecteToDraw); break; case TypeOfPictureToDraw.AllActuallExistingOrte: Projekte = WordUpWCFAccess.GetCommonDataSet ("Select * from ProjektUebersicht where OrteID = '" + OrtsID + "'").Tables ["ProjektUebersicht"]; MapAdditionalInfo.Add (mapAdditionalInfoEntry); AddProjektInfosToMapInfo (MapAdditionalInfo, Projekte); CreateDrawingLegende (TargetDirectory, ProjecteToDraw); break; } */ } BoardContext.Close (); RenderTargetBitmap DrawingBitmap = new RenderTargetBitmap ((int) (Width * XDPIFactor), (int) (Height * YDPIFactor), XDPIFactor * 96, YDPIFactor * 96, PixelFormats.Pbgra32); DrawingBitmap.Render (DrawingBoard); if (DrawingBoard.Drawing == null) return; Rect OriginalRect = DrawingBoard.Drawing.Bounds; ImageBrush IMBrush = new ImageBrush (); IMBrush.ImageSource = (BitmapSource) BitmapFrame.Create (DrawingBitmap); IMBrush.Stretch = Stretch.Uniform; IMBrush.AlignmentY = AlignmentY.Top; LagePlanWindow = new Window (); LagePlanWindow.Width = DrawingBoard.Drawing.Bounds.Width; LagePlanWindow.Height = DrawingBoard.Drawing.Bounds.Height + 25; LagePlanWindow.Background = IMBrush; LagePlanWindow.Title = "WordUp Projekt Orte"; LagePlanWindow.ContextMenuOpening += new ContextMenuEventHandler (LagePlanWindow_ContextMenuOpening); LagePlanWindow.Tag = mapAdditionalInfos; LagePlanWindow.Show (); }