Beispiel #1
0
 private static void AddMap(Document aDoc, Coordinates coor)
 {
     try
     {
         ExportMapImage exportmap     = new ExportMapImage();
         string         mapLayoutFile = exportmap.ExportImage(coor.lon, coor.lat, coor.zoomlevel);
         if (mapLayoutFile != String.Empty)
         {
             object oBookMark         = "Map";
             Object oMissed           = aDoc.Bookmarks.get_Item(ref oBookMark).Range; //the position you want to insert
             Object oLinkToFile       = false;
             Object oSaveWithDocument = true;
             aDoc.Bookmarks.get_Item(ref oBookMark).Range.Text = string.Empty;
             aDoc.InlineShapes.AddPicture(mapLayoutFile, ref oLinkToFile, ref oSaveWithDocument, ref oMissed);
         }
     }
     catch (Exception e)
     {
         log.Error(e);
     }
 }
Beispiel #2
0
        private string GenerateShortReport(Coordinates coord, string address, string customer, string recipients, List <Results> lstResults)
        {
            string content = string.Empty;

            try
            {
                // let's export the map to add it to the short report in zoom level const 17
                ExportMapImage exportmap     = new ExportMapImage();
                string         mapLayoutFile = exportmap.ExportImage(coord.lon, coord.lat, 17);

                Html2Image             html2Image = new Html2Image();
                Html2Image.Coordinates coor       = new Html2Image.Coordinates {
                    lon = coord.lon, lat = coord.lat
                };
                double[] arr = new double[6] {
                    lstResults[0].indexvalue, lstResults[1].indexvalue, lstResults[2].indexvalue, lstResults[3].indexvalue, lstResults[4].indexvalue, lstResults[5].indexvalue
                };
                string    report    = html2Image.CustomizeReport(coor, customer, address, arr, mapLayoutFile);
                EmailInfo EmailInfo = new EmailInfo();
                EmailInfo.Sender     = EmailSender;
                EmailInfo.Recipients = recipients;
                EmailInfo.Subject    = $"Dear.Earth Indcies report of location: {address} - " + coor.lon.ToString("0.######") + "," + coor.lat.ToString("0.######");
                EmailInfo.EmailMsg   = $"Dear {customer}, <br><br> Thank you for choosing Dear.Earth to Calculate your environmental Indcies. <br>" +
                                       $"Please find attached the requested information of location: {address} - Coordinates:[" + coor.lon.ToString("0.######") + "," + coor.lat.ToString("0.######") + "].<br><br>" +
                                       "Best Regards, <br> Dear.Earth Team <br>" +
                                       "<img id=\"CompanyLogo\" title=\"The Company Logo\" src=\"https://www.ager.earth/ExtractOSMMapProd/Markers/DeraEarthSignatureLogo.png\" </img>";
                EmailInfo.Attachment = report;
                StmpEmail email = new StmpEmail();
                email.SendEmail(EmailInfo);
                content = "Email Sent";
            }
            catch (Exception ex)
            {
                content = ex.Message;
            }
            return(content);
        }