Ejemplo n.º 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")
                );
        }
Ejemplo n.º 2
0
        public Response IntegerateSfDCIDs()
        {
            _logger.LogInformation("IntegerateSFDCIDtoDriver");
            Response rs = new Response();

            try
            {
                string        userlist;
                List <string> UserNames = new List <string>();
                SFDCAction    sfdca     = new SFDCAction(_integrationAppSettings);
                UserNames = sfdca.GetAllDriverInfo_NotMappedSFDC();
                // userlist = string.Join(",'", UserNames);
                userlist = "'" + string.Join("','", UserNames.Where(k => !string.IsNullOrEmpty(k))) + "'";
                var result = sfdca.IntegrateSFDCId_OperatortoDB(userlist, _integrationAppSettings.SFDCUserName, _integrationAppSettings.SFDCUserPassword);
                if (result)
                {
                    rs.ResponseCode = 200;
                    rs.Message      = "Integrated Successfully";
                }
                else
                {
                    rs.ResponseCode = 500;
                    rs.Message      = "Internal server error occured";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString());
                rs.ResponseCode = 200;
                rs.Message      = "Internal Server Error Occur";
            }
            return(rs);
        }
Ejemplo n.º 3
0
        public Response DataPushedtoSFDC()
        {
            Response rs = new Response();

            try
            {
                SFDCAction sfdca   = new SFDCAction(_integrationAppSettings);
                var        results = sfdca.InsertDataintoSFDC(_integrationAppSettings.SFDCUserName, _integrationAppSettings.SFDCUserPassword);
                if (results)
                {
                    rs.ResponseCode = 200;
                    rs.Message      = "Integrated Successfully";
                }
                else
                {
                    rs.ResponseCode = 500;
                    rs.Message      = "SFDC Response Issue occured";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString());
                rs.ResponseCode = 200;
                rs.Message      = "Internal Server Error Occur";
            }
            return(rs);
        }
Ejemplo n.º 4
0
        public Response IntegerateSfCustomeList()
        {
            _logger.LogInformation("IntegerateCustomer");
            Response rs = new Response();

            try
            {
                SFDCAction sfdca  = new SFDCAction(_integrationAppSettings);
                var        result = sfdca.IntegerateSfCustomeList(_integrationAppSettings.SFDCUserName, _integrationAppSettings.SFDCUserPassword);
                rs.ResponseCode = 200;
                rs.Message      = "Integrated Successfully";
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString());
                rs.ResponseCode = 200;
                rs.Message      = "Internal Server Error Occur";
            }
            return(rs);
        }