コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IRecurringJobManager recurringJobManager,
                              IServiceProvider serviceProvider)
        {
            var section = Configuration.GetSection(nameof(IntegrationAppSettings));
            var integrationAppSettings = section.Get <IntegrationAppSettings>();

            string        userlist;
            List <string> UserNames = new List <string>();
            SFDCAction    sfdca     = new SFDCAction(integrationAppSettings);

            UserNames = sfdca.GetAllDriverInfo_NotMappedSFDC();
            userlist  = "'" + string.Join("','", UserNames.Where(k => !string.IsNullOrEmpty(k))) + "'";

            FleetCompleteAction fca = new FleetCompleteAction(integrationAppSettings);
            var url       = "https://hosted.fleetcomplete.com.au/Authentication/v9/Authentication.svc/authenticate/user?clientId=" + 46135 + "&userLogin="******"&userPassword="******"/swagger/v1/swagger.json", "My API V1");
            });
            app.UseHangfireDashboard();
            app.UseRouting();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            recurringJobManager.AddOrUpdate(
                "Scheduled Customer Service Line",
                () => serviceProvider.GetService <ISFDC>().IntegerateSfCustServiceLine(integrationAppSettings.SFDCUserName, integrationAppSettings.SFDCUserPassword),
                integrationAppSettings.CSLineScheduleTime, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")
                );
            recurringJobManager.AddOrUpdate(
                "Scheduled Customer List",
                () => serviceProvider.GetService <ISFDC>().IntegerateSfCustomeList(integrationAppSettings.SFDCUserName, integrationAppSettings.SFDCUserPassword),
                integrationAppSettings.CustomerListScheduleTime, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")
                );
            recurringJobManager.AddOrUpdate(
                "Scheduled Driver",
                () => serviceProvider.GetService <ISFDC>().IntegrateSFDCId_OperatortoDB(userlist, integrationAppSettings.SFDCUserName, integrationAppSettings.SFDCUserPassword),
                integrationAppSettings.DriverScheduleTime, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")
                );
            recurringJobManager.AddOrUpdate(
                "Scheduled Fleet complete asset",
                () => serviceProvider.GetService <IFleetComplete>().IntegrateAsset(integrationAppSettings.ClientID, tokeninfo.UserId, tokeninfo.Token),
                integrationAppSettings.FCAssetScheduleTime, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")
                );
            recurringJobManager.AddOrUpdate(
                "Scheduled Connx Driver",
                () => serviceProvider.GetService <IConnex>().IntegrateDriverDetails(integrationAppSettings.ConnexUserName, integrationAppSettings.ConnexUserPassword),
                integrationAppSettings.ConnxScheduleTime, TimeZoneInfo.FindSystemTimeZoneById("AUS Eastern Standard Time")
                );
        }
コード例 #2
0
        public Response Get()
        {
            Response rs = new Response();

            try
            {
                _logger.LogInformation("IntegerateAssets");

                var url = "https://hosted.fleetcomplete.com.au/Authentication/v9/Authentication.svc/authenticate/user?clientId=" + 46135 + "&userLogin="******"&userPassword="******"IntegerateAssets Appsettings:" + _integrationAppSettings.AppConnection.ToString());

                var tokeninfo = fca.GetAccessToken(url);
                _logger.LogInformation("IntegerateAssets Token:" + tokeninfo.Token);
                fca.IntegrateAsset(_integrationAppSettings.ClientID, tokeninfo.UserId, tokeninfo.Token);
                rs.ResponseCode = 200;
                rs.Message      = "Integrated Successfully";
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString());
                rs.ResponseCode = 500;
                rs.Message      = "Internal Server Error Occured";
            }
            return(rs);
        }