public AppointmentCreatedInOutlookHandler(SqlController sqlController, Log log, eFormCore.Core sdkCore, IOutlookOnlineController outlookOnlineController)
 {
     this.sqlController           = sqlController;
     this.log                     = log;
     this.sdkCore                 = sdkCore;
     this.outlookOnlineController = outlookOnlineController;
 }
        //con
        public ServiceLogic()
        {
            try
            {
                LogEvent("Service called");
                {
                    _serviceLocation = "";
                    _sdkCore         = new eFormCore.Core();

                    //An aggregate catalog that combines multiple catalogs
                    var catalog = new AggregateCatalog();

                    //Adds all the parts found in the same assembly as the Program class
                    LogEvent("Start loading plugins...");
                    try
                    {
                        string path = Path.Combine(GetServiceLocation(), @"Plugins");
                        Directory.CreateDirectory(path);
                        LogEvent("Path for plugins is : " + path);
                        foreach (string dir in Directory.GetDirectories(path))
                        {
                            if (Directory.Exists(Path.Combine(dir, "net6.0")))
                            {
                                LogEvent("Loading Plugin : " + Path.Combine(dir, "net6.0"));
                                catalog.Catalogs.Add(new DirectoryCatalog(Path.Combine(dir, "net6.0")));
                            }
                            else
                            {
                                LogEvent("Loading Plugin : " + dir);
                                catalog.Catalogs.Add(new DirectoryCatalog(dir));
                            }
                        }
                    } catch (Exception e) {
                        LogException("Something went wrong in loading plugins.");
                        LogException(e.Message);
                    }
                    //Create the CompositionContainer with the parts in the catalog
                    CompositionContainer container = new CompositionContainer(catalog);

                    //Fill the imports of this object
                    try
                    {
                        container.ComposeParts(this);
                    }
                    catch (CompositionException compositionException)
                    {
                        LogException(compositionException.ToString());
                    }
                }
                LogEvent("Service completed");
            }
            catch (Exception ex)
            {
                LogException(t.PrintException("Fatal Exception", ex));
                throw;
            }
        }
Пример #3
0
        DateTime tLimitFrom; // = checkLast_At.AddHours(-checkRetrace_Hours);
        #endregion

        public ParseOutlookItemsHandler(SqlController sqlController, Log log, eFormCore.Core sdkCore, IOutlookOnlineController outlookOnlineController, OutlookExchangeOnlineAPIClient outlookExchangeOnlineAPIClient, IBus bus)
        {
            this.sqlController                  = sqlController;
            this.log                            = log;
            this.sdkCore                        = sdkCore;
            this.outlookOnlineController        = outlookOnlineController;
            this.outlookExchangeOnlineAPIClient = outlookExchangeOnlineAPIClient;
            this.bus                            = bus;
            //checkLast_At = DateTime.Parse(sqlController.SettingRead(Settings.checkLast_At));
            checkPreSend_Hours    = double.Parse(sqlController.SettingRead(Settings.checkPreSend_Hours));
            checkRetrace_Hours    = double.Parse(sqlController.SettingRead(Settings.checkRetrace_Hours));
            checkEvery_Mins       = int.Parse(sqlController.SettingRead(Settings.checkEvery_Mins));
            includeBlankLocations = bool.Parse(sqlController.SettingRead(Settings.includeBlankLocations));

            userEmailAddess = outlookOnlineController.GetUserEmailAddress();

            timeOfRun  = DateTime.Now;
            tLimitTo   = timeOfRun.AddHours(+checkPreSend_Hours);
            tLimitFrom = timeOfRun.AddHours(-checkRetrace_Hours);
        }