예제 #1
0
        private Dictionary <EmsgLanguage, Dictionary <string, string> > ParseInhaltPages()
        {
            var result         = new Dictionary <EmsgLanguage, Dictionary <string, string> >();
            var helpFolderPath = serverPathProvider.MapPath("~/Help");

            foreach (EmsgLanguage language in Enum.GetValues(typeof(EmsgLanguage)))
            {
                result[language] = new Dictionary <string, string>();
                var contentFilePath = Path.Combine(Path.Combine(helpFolderPath, GetTwoLetterLanguageName(language), GetContentPageName(language)));
                if (!File.Exists(contentFilePath))
                {
                    continue;
                }

                var doc = new HtmlDocument();
                doc.Load(contentFilePath);
                foreach (HtmlNode node in doc.DocumentNode.SelectNodes(@"//a[@href]"))
                {
                    var link = node.Attributes["href"].Value.Split(new[] { "#" }, StringSplitOptions.RemoveEmptyEntries)[0];

                    if (!result[language].ContainsKey(link))
                    {
                        var text = node.InnerText;
                        text = Regex.Replace(text, @"(\.)*\s+\d+", "");
                        text = text.Trim();
                        if (!string.IsNullOrWhiteSpace(text))
                        {
                            result[language][link] = text;
                        }
                    }
                }
            }
            return(result);
        }
예제 #2
0
 public LogHandlerService(
     IServerConfigurationProvider serverConfigurationProvider,
     IServerPathProvider serverPathProvider)
 {
     this.serverConfigurationProvider = serverConfigurationProvider;
     nlogConfig = serverPathProvider.MapPath(@"~/NLog.config");
 }
예제 #3
0
 public GlobalResourceHandlerService(
     ILocalizationService localizationService,
     IServerConfigurationProvider serverConfigurationProvider,
     IServerPathProvider serverPathProvider)
 {
     this.localizationService = localizationService;
     mobileClientResources    = Path.Combine(serverConfigurationProvider.ClientFilesFolderPath, "Resources");
     appGlobalResources       = serverPathProvider.MapPath(@"~/App_GlobalResources");
 }
예제 #4
0
        public HelpSystemService(
            IServerConfigurationProvider serverConfigurationProvider,
            ILocalizationService localizationService,
            IServerPathProvider serverPathProvider)
        {
            this.localizationService = localizationService;

            mobilHelpSystem  = Path.Combine(serverConfigurationProvider.ClientFilesFolderPath, "Help");
            masterHelpSystem = serverPathProvider.MapPath("~/Help");
            LoadNames();
        }
예제 #5
0
        public override MandantLogoModel GetMandantLogo()
        {
            var imagePath = serverPathProvider.MapPath(@"~/App_Data/testLogo.png");
            var image     = Image.FromFile(imagePath);

            return(new MandantLogoModel
            {
                Logo = File.ReadAllBytes(imagePath),
                Height = image.Height,
                Width = image.Width
            });
        }
예제 #6
0
        protected Stream GetImportTemplateForImportModels(string importTemplateName)
        {
            var memoryStream = new MemoryStream();

            using (var fs = File.OpenRead(serverPathProvider.MapPath(string.Format("~/ImportTemplates/{0}/{1}.xlsx", cookieService.EmsgLanguage.ToCultureInfo().TwoLetterISOLanguageName, importTemplateName))))
            {
                var bytes = fs.ReadAllByte();
                memoryStream.Write(bytes, 0, bytes.Length);
            }

            memoryStream.Seek(0, 0);
            return(memoryStream);
        }
예제 #7
0
        public MandantLogoService(
            ITransactionScopeProvider transactionScopeProvider,
            IEntityServiceMappingEngine entityServiceMappingEngine,
            ISecurityService securityService,
            ILocalizationService localizationService,
            IServerPathProvider serverPathProvider)
            : base(transactionScopeProvider, entityServiceMappingEngine, securityService)
        {
            this.localizationService = localizationService;

            var imagePath = serverPathProvider.MapPath(@"~/App_Data/DefaultLogo.png");
            var image     = Image.FromFile(imagePath);

            defaultMandantLogoModel = new MandantLogoModel
            {
                Logo   = File.ReadAllBytes(imagePath),
                Height = image.Height,
                Width  = image.Width
            };
        }
예제 #8
0
 public string GetLegendUrl(string key)
 {
     return(string.Format("file:///{0}", serverPathProvider.MapPath(string.Format(@"~/Content/reports/{0}.png", key)).Replace("\\", "/")));
 }
예제 #9
0
        private Bitmap AddMapInfosToMapBitmap(Bitmap map, Bitmap legendBitmap, EmsgGisReportParameter emsgGisReportParameter, int dpi, Size webPreviewSize)
        {
            var widthScale  = map.Size.Width / (float)webPreviewSize.Width;
            var heightScale = map.Size.Height / (float)webPreviewSize.Height;

            map.SetResolution(dpi, dpi);
            var scale = Math.Min(widthScale, heightScale);

            float  lineLength = float.Parse(emsgGisReportParameter.ScaleWidth, CultureInfo.InvariantCulture.NumberFormat) * scale;
            string lineText   = emsgGisReportParameter.ScaleText;
            int    fontSize   = 10;
            int    padding    = (int)Math.Ceiling(0.033 * dpi);
            int    margin     = (int)Math.Ceiling(0.05 * dpi);

            Font       font  = new Font("Arial", fontSize, FontStyle.Regular, GraphicsUnit.Point);
            SolidBrush brush = new SolidBrush(Color.Black);

            using (Graphics graphics = Graphics.FromImage(map))
            {
                graphics.SmoothingMode     = SmoothingMode.HighQuality;
                graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
                SizeF sizeLength = graphics.MeasureString(lineText, font);

                #region north arrow
                Bitmap northArrowBitmap = new Bitmap(Bitmap.FromFile(serverPathProvider.MapPath(@"~/Content/images/north_arrow.png")));

                Point ancorNorthArrow = new Point(map.Width - (int)(northArrowBitmap.Width / 96d * dpi) - padding, padding);
                graphics.DrawImage(northArrowBitmap, ancorNorthArrow);

                #endregion

                #region length
                //Point ancor = new Point(map.Width - 80, map.Height - 40);

                IGeometry bbox                = GISService.GetGeometryFromBoundingBox(emsgGisReportParameter.BoundingBox);
                double    numericScale        = bbox.Envelope.EnvelopeInternal.Width / ((new ReportDefintion(dpi).ReportWidth / 100));
                int       scaleRoundingFactor = 1000;
                if (numericScale < 1000)
                {
                    scaleRoundingFactor = 100;
                }

                numericScale = Math.Round(numericScale / scaleRoundingFactor) * scaleRoundingFactor;
                string scaletext       = string.Format("1:{0}", (numericScale.ToString("###,###", new System.Globalization.CultureInfo(localizationService.CurrentCultureCode))));
                SizeF  scaleSize       = graphics.MeasureString(scaletext, font);
                float  rectangleWidth  = (lineLength > scaleSize.Width ? lineLength : scaleSize.Width) + margin * 2;
                float  rectangleHeight = (scaleSize.Height + sizeLength.Height) + margin * 2;

                Point ancor = new Point(map.Width - Convert.ToInt32(rectangleWidth) - padding, map.Height - Convert.ToInt32(rectangleHeight) - padding);

                Point endLineP   = new Point(Convert.ToInt32(ancor.X + rectangleWidth / 2 + lineLength / 2), ancor.Y + Convert.ToInt32(sizeLength.Height) + margin);
                Point startLineP = new Point(Convert.ToInt32(ancor.X + rectangleWidth / 2 - lineLength / 2), ancor.Y + Convert.ToInt32(sizeLength.Height) + margin);

                SizeF     lineScaleSize = graphics.MeasureString(lineText, font);
                Rectangle rect          = new Rectangle(ancor.X,
                                                        ancor.Y,
                                                        Convert.ToInt32(rectangleWidth),
                                                        Convert.ToInt32(rectangleHeight));
                graphics.FillRectangle(new SolidBrush(Color.WhiteSmoke), rect);

                Pen pen = new Pen(Color.Black, 2 * dpi / 100);
                graphics.DrawLine(pen, startLineP, endLineP);
                graphics.DrawLine(pen, startLineP, new Point(startLineP.X, startLineP.Y - Convert.ToInt32(sizeLength.Height) / 2));
                graphics.DrawLine(pen, endLineP, new Point(endLineP.X, endLineP.Y - Convert.ToInt32(sizeLength.Height) / 2));
                graphics.DrawString(lineText, font, brush, ancor.X + ((rectangleWidth + margin) / 2) - sizeLength.Width / 2, ancor.Y + margin);
                graphics.DrawString(scaletext, font, brush, ancor.X + ((rectangleWidth + margin) / 2) - scaleSize.Width / 2, ancor.Y + scaleSize.Height + margin);

                #endregion

                northArrowBitmap.Dispose();
            }

            #region add legend and preview rectangle
            int       rectLineWidth = (int)Math.Ceiling(0.01 * dpi);
            Rectangle previewRect   = ScalePreviewToReport(map.Size, dpi, webPreviewSize, rectLineWidth);
            Bitmap    all           = new Bitmap(map.Width + legendBitmap.Width, map.Height);
            all.SetResolution(dpi, dpi);
            if (map != null && legendBitmap != null)
            {
                using (Graphics graphics = Graphics.FromImage(all))
                {
                    graphics.SmoothingMode = SmoothingMode.HighQuality;
                    graphics.DrawImage(map, 0, 0);
                    graphics.DrawRectangle(new Pen(Color.Red, (float)Math.Ceiling(0.01 * dpi)), previewRect);
                    graphics.FillRectangle(new SolidBrush(Color.White), map.Width, 0, legendBitmap.Width, map.Height);
                    graphics.DrawImage(legendBitmap, map.Width, 0);
                    graphics.DrawRectangle(new Pen(Color.Black, (float)Math.Ceiling(0.01 * dpi)), map.Width + rectLineWidth - 1, 0 + rectLineWidth, legendBitmap.Width - 2 * rectLineWidth, map.Height - 2 * rectLineWidth);
                }
            }
            map.Dispose();
            legendBitmap.Dispose();
            #endregion
            return(all);
        }