コード例 #1
0
 public CanDeleteScenarioToTooltipConverter()
 {
     _apiHttpClient       = IoC.Resolve <IAPIHttpClient>();
     _localizationManager = IoC.Resolve <ILocalizationManager>();
     _prepareService      = IoC.Resolve <IServiceBus>().Get <IPrepareService>();
     _converter           = new CanChangeStatutToTooltipConverter(_apiHttpClient, _localizationManager, _prepareService);
 }
コード例 #2
0
 public UtilsController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, ILocalizedStrings localizedStrings, IAPIHttpClient apiHttpClient,
                        ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _applicationUsersService = applicationUsersService;
     _traceManager            = traceManager;
     _localizedStrings        = localizedStrings;
     _apiHttpClient           = apiHttpClient;
 }
コード例 #3
0
 public LicenseController(IApplicationUsersService applicationUsersService, ITraceManager traceManager, IAPIHttpClient apiHttpClient, ISystemInformationService systemInformationService,
                          ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _applicationUsersService  = applicationUsersService;
     _apiHttpClient            = apiHttpClient;
     _systemInformationService = systemInformationService;
     _traceManager             = traceManager;
 }
コード例 #4
0
        public SyncingJob(ITraceManager traceManager, IApplicationUsersService applicationUsersService, IAPIHttpClient apiHttpClient, IPrepareService prepareService)
        {
#if DEBUG
            OfflineFilesPath = @"..\..\..\..\Kprocess.KL2.TabletClient\bin\Debug\SyncFiles\Offline";
#endif

            _traceManager   = traceManager;
            _apiHttpClient  = apiHttpClient;
            _prepareService = prepareService;
        }
コード例 #5
0
 public AccountController(ILanguageStorageProvider languageStorageProvider,
                          ILocalizedStrings localizedStrings,
                          IAPIHttpClient apiHttpClient,
                          IApplicationUsersService applicationUsersService,
                          ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _languageStorageProvider = languageStorageProvider;
     _apiHttpClient           = apiHttpClient;
     _applicationUsersService = applicationUsersService;
 }
コード例 #6
0
 public AccountController(ApplicationUserManager userManager,
                          ApplicationSignInManager signInManager,
                          IAPIHttpClient apiHttpClient,
                          IApplicationUsersService applicationUsersService,
                          ILocalizationManager localizationManager
                          )
     : base(localizationManager)
 {
     UserManager              = userManager;
     SignInManager            = signInManager;
     _apiHttpClient           = apiHttpClient;
     _applicationUsersService = applicationUsersService;
 }
コード例 #7
0
        /// <summary>
        /// Envoie un rapport d'erreur par ticket.
        /// </summary>
        /// <param name="e">L'exception.</param>
        /// <param name="username">Le nom d'utilisateur.</param>
        /// <param name="company">La société.</param>
        /// <param name="email">L'email.</param>
        /// <param name="additionalInformation">Des informations complémentaires.</param>
        /// <returns>
        ///   <c>true</c> si l'envoi a réussi.
        /// </returns>
        public async Task SendErrorReportTicketAsync(Exception e, string username, string company, string email, string additionalInformation)
        {
            Ticket ticket = new Ticket()
            {
                Email         = DevEmail,
                Name          = username,
                Subject       = "[KL2] Rapport d'erreur",
                EmailConfigId = email_config_id,
                GroupId       = group_id,
                Type          = "Bug",
                CcEmails      = new[] { ccmail }
            };

            StringBuilder sb = new StringBuilder();

            // HEURE
            sb.AppendLine(DateTimeOffset.Now.ToString());

            // Informations client
            sb.AppendLine("Informations client :");
            sb.AppendLine($"Nom : {(!string.IsNullOrEmpty(username) ? username : string.Empty)}");

            sb.AppendLine($"Société : {(!string.IsNullOrEmpty(company) ? company : string.Empty)}");

            sb.AppendLine($"Email : {(!string.IsNullOrEmpty(email) ? email : string.Empty)}");

            sb.AppendLine();


            // VERSION APPLI
            sb.AppendLine($"Version : {System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}");
            sb.AppendLine();


            // Informations complémentaires

            /*sb.AppendLine("Informations complémentaires :");
             * if (!string.IsNullOrEmpty(additionalInformation))
             *  sb.AppendLine(additionalInformation);
             * sb.AppendLine();*/


            // Inforamtions licence
            sb.AppendLine("Informations licence :");
            IAPIHttpClient apiClient   = IoC.Resolve <IAPIHttpClient>();
            var            licenseInfo = await apiClient.ServiceAsync <WebProductLicense>(KL2_Server.API, "LicenseService", "GetLicense");

            if (licenseInfo != null && licenseInfo.Status != WebLicenseStatus.NotFound)
            {
                sb.AppendFormat("{0} {1}", licenseInfo.Status, licenseInfo.StatusReason);
            }
            else
            {
                sb.AppendLine("Aucune licence chargée");
            }
            sb.AppendLine();

            // Informations erreur en cours
            sb.AppendLine("Erreur en cours");
            if (e != null)
            {
                sb.AppendLine(e.ToString());
            }
            sb.AppendLine();

            StringBuilder log = new StringBuilder();

            log.AppendLine("Contenu des fichiers de logs");

            try
            {
                foreach (var appender in ((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root.Appenders.OfType <FileAppender>())
                {
                    using (var fs = new FileStream(appender.File, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        using (var sr = new StreamReader(fs, appender.Encoding))
                        {
                            var    lines = new List <string>();
                            string line;
                            while ((line = await sr.ReadLineAsync()) != null)
                            {
                                lines.Add(line);
                            }

                            log.AppendLine();
                            log.AppendLine(appender.File);
                            log.AppendLine();
                            foreach (string l in lines.Skip(lines.Count - LogFilesLinesToInclude).Take(LogFilesLinesToInclude))
                            {
                                log.AppendLine(l);
                            }
                            log.AppendLine();
                            log.AppendLine();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.AppendLine("Impossible de récupérer les fichiers de log. Erreur :");
                log.AppendLine(ex.Message);
            }

            ticket.Description = sb.Replace(Environment.NewLine, "<br />").ToString();

            ticket.Attachments = new Dictionary <string, byte[]>
            {
                ["Log.txt"] = Encoding.UTF8.GetBytes(log.ToString())
            };

            try
            {
                await FreshdeskClient.Instance.SendTicketAsync(ticket);
            }
            catch (Exception ex)
            {
                TraceManager.TraceWarning(ex.Message);
            }
        }
コード例 #8
0
 public CanChangeStatutToTooltipConverter(IAPIHttpClient apiHttpClient, ILocalizationManager localizationManager, IPrepareService prepareService)
 {
     _apiHttpClient       = apiHttpClient;
     _localizationManager = localizationManager;
     _prepareService      = prepareService;
 }
コード例 #9
0
 public SampleController(IConfiguration config, IAPIHttpClient iAPIHttpClient)
 {
     _config         = config;
     _iAPIHttpClient = iAPIHttpClient;
 }
コード例 #10
0
 public UISettingsService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #11
0
 public NotificationService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #12
0
 public SharedDatabaseService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #13
0
 public ApplicationUsersService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #14
0
 public AnalyzeService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #15
0
 public ValidateService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #16
0
        /// <summary>
        /// Envoie un rapport d'erreur par email.
        /// </summary>
        /// <param name="e">L'exception.</param>
        /// <param name="username">Le nom d'utilisateur.</param>
        /// <param name="company">La société.</param>
        /// <param name="email">L'email.</param>
        /// <param name="additionalInformation">Des informations complémentaires.</param>
        /// <returns>
        ///   <c>true</c> si l'envoi a réussi.
        /// </returns>
        public async Task <bool> SendErrorReportEmail(Exception e, string username, string company, string email, string additionalInformation)
        {
            string errorReportEmail = ConfigurationManager.AppSettings["ErrorReportEmail"];

            bool sendCopyToDev = false;

#if !DEBUG
            string copyReportEmail = ConfigurationManager.AppSettings["SendReportCopy"];
            if (copyReportEmail != null)
            {
                bool.TryParse(copyReportEmail, out sendCopyToDev);
            }
#endif

            var emailessage = new Email()
            {
                From = errorReportEmail,
                PreferConfigurationFrom = true,
                To      = new string[] { errorReportEmail },
                Subject = "[Ksmed] Rapport d'erreur",
            };

            if (sendCopyToDev)
            {
                emailessage.Bcc = new string[] { DevEmail }
            }
            ;

            emailessage.AttachmentsStreams = new Dictionary <string, Stream>();

            var sb = new StringBuilder();

            // HEURE
            sb.AppendLine(DateTimeOffset.Now.ToString());

            // Informations client
            sb.AppendLine("Informations client :");
            sb.AppendLine("Nom : ");
            if (!string.IsNullOrEmpty(username))
            {
                sb.AppendLine(username);
            }
            else
            {
                sb.AppendLine();
            }

            sb.AppendLine("Société : ");
            if (!string.IsNullOrEmpty(company))
            {
                sb.AppendLine(company);
            }
            else
            {
                sb.AppendLine();
            }

            sb.AppendLine("Email : ");
            if (!string.IsNullOrEmpty(email))
            {
                sb.AppendLine(email);
            }
            else
            {
                sb.AppendLine();
            }

            sb.AppendLine();


            // VERSION APPLI
            sb.AppendLine("Version :");
            sb.AppendLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            sb.AppendLine();


            // Informations complémentaires
            sb.AppendLine("Informations complémentaires :");
            if (!string.IsNullOrEmpty(additionalInformation))
            {
                sb.AppendLine(additionalInformation);
            }
            sb.AppendLine();


            // Informations licence
            sb.AppendLine("Informations licence :");
            IAPIHttpClient apiClient   = IoC.Resolve <IAPIHttpClient>();
            var            licenseInfo = await apiClient.ServiceAsync <WebProductLicense>(KL2_Server.API, "LicenseService", "GetLicense");

            if (licenseInfo != null && licenseInfo.Status != WebLicenseStatus.NotFound)
            {
                sb.AppendFormat("{0} {1}", licenseInfo.Status, licenseInfo.StatusReason);
            }
            else
            {
                sb.AppendLine("Aucune licence chargée");
            }
            sb.AppendLine();

            // Informations erreur en cours
            sb.AppendLine("Erreur en cours");
            if (e != null)
            {
                sb.AppendLine(e.ToString());
            }
            sb.AppendLine();


            sb.AppendLine("Contenu des fichiers de logs");

            try
            {
                foreach (var appender in ((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root.Appenders.OfType <FileAppender>())
                {
                    using (var fs = new FileStream(appender.File, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        using (var sr = new StreamReader(fs, appender.Encoding))
                        {
                            var    lines = new List <string>();
                            string line;
                            while ((line = await sr.ReadLineAsync()) != null)
                            {
                                lines.Add(line);
                            }

                            sb.AppendLine();
                            sb.AppendLine(appender.File);
                            sb.AppendLine();
                            foreach (string l in lines.Skip(lines.Count - LogFilesLinesToInclude).Take(LogFilesLinesToInclude))
                            {
                                sb.AppendLine(l);
                            }
                            sb.AppendLine();
                            sb.AppendLine();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                sb.AppendLine("Impossible de récupérer les fichiers de log. Erreur :");
                sb.AppendLine(ex.Message);
            }
            sb.AppendLine();

            emailessage.Body = sb.ToString();

            var ret = SendEmail(emailessage);

            return(ret);
        }
    }
コード例 #17
0
 public DownloadFileConverter(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #18
0
 public AppResourceService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #19
0
 public AccountController(IAPIHttpClient apiHttpClient, IApplicationUsersService applicationUsersService, ILocalizationManager localizationManager)
     : base(localizationManager)
 {
     _apiHttpClient           = apiHttpClient;
     _applicationUsersService = applicationUsersService;
 }
コード例 #20
0
 public ReferentialsService(IAPIHttpClient apiHttpClient)
 {
     _apiHttpClient = apiHttpClient;
 }
コード例 #21
0
 public ImportExportService(IAPIHttpClient apiHttpClient, ISecurityContext securityContext, ITraceManager traceManager)
 {
     _apiHttpClient   = apiHttpClient;
     _securityContext = securityContext;
     _traceManager    = traceManager;
 }
コード例 #22
0
 public AuthenticationService(IAPIHttpClient apiHttpClient, ILocalizationManager localizationManager = null)
 {
     _apiHttpClient       = apiHttpClient;
     _localizationManager = localizationManager;
 }