Esempio n. 1
0
        public static DateTime GetLocalDate(this DateTime date)
        {
            var _settings = BloomServiceConfiguration.FromWebConfig(ConfigurationManager.AppSettings);
            var timezonId = _settings.CurrentTimezone;
            var USEastern = TimeZoneInfo.FindSystemTimeZoneById(timezonId);
            var utc       = date.ToUniversalTime();
            var result    = utc.AddHours(USEastern.BaseUtcOffset.Hours);

            //var result = TimeZoneInfo.ConvertTime(date.ToUniversalTime(), USEastern);
            return(result);
        }
Esempio n. 2
0
 public ImageService(IHttpContextProvider httpContextProvider, IRepository repository, IBloomServiceHub hub, IStorageProvider storageProvider)
 {
     this.repository             = repository;
     this.settings               = BloomServiceConfiguration.FromWebConfig(ConfigurationManager.AppSettings);
     _hub                        = hub;
     _storageProvider            = storageProvider;
     _urlToTechnicianIcon        = Path.Combine(settings.BasePath, "images/technician.png");
     _urlToWorkOrderIcon         = Path.Combine(settings.BasePath, "images/workorder.png");
     _urlToFolderTecnician       = Path.Combine(settings.BasePath, "technician");
     _urlToFolderWorkOrder       = Path.Combine(settings.BasePath, "workorder");
     _urlToFolderPhotoWorkOrders = Path.Combine(settings.BasePath, "images");
     _urlToFolderFonts           = Path.Combine(settings.BasePath.Replace("/userFiles", ""), "fonts");;
 }
Esempio n. 3
0
        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            var setting          = BloomServiceConfiguration.FromWebConfig(ConfigurationManager.AppSettings);
            var connectionString = ConfigurationManager.ConnectionStrings["MongoServerSettings"].ConnectionString;
            var dbName           = ConfigurationManager.AppSettings["MainDb"];
            var basePath         = ConfigurationManager.AppSettings["basePath"];
            var storageUrl       = ConfigurationManager.AppSettings["storageUrl"];
            var azureStorage     = bool.Parse(ConfigurationManager.AppSettings["azureStorage"]);
            var siteUrl          = ConfigurationManager.AppSettings["SiteUrl"];

            var sageApiHost = setting.SageApiHost;

            kernel.Bind <IRepository>().To <MongoRepository>().WithConstructorArgument("connectionString", connectionString).WithConstructorArgument("dbName", dbName);
            kernel.Bind <BloomServiceConfiguration>().ToConstant(setting);

            kernel.Bind <IHttpContextProvider>().To <HttpContextProvider>();
            kernel.Bind <IRestClient>().To <RestClient>().WithConstructorArgument(sageApiHost);
            kernel.Bind <ILocationService>().To <LocationService>();
            kernel.Bind <IImageService>().To <ImageService>();
            kernel.Bind <IUserService>().To <UserService>();
            kernel.Bind <ISageApiProxy>().To <SageApiProxy>();
            kernel.Bind <IAuthorizationService>().To <AuthorizationService>();
            kernel.Bind <IDashboardService>().To <DashboardService>();
            kernel.Bind <IScheduleService>().To <ScheduleService>();

            if (azureStorage)
            {
                CloudStorageAccount storageAccount =
                    CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
                kernel.Bind <IStorageProvider>()
                .To <AzureStorageProvider>()
                .WithConstructorArgument("storageAccount", storageAccount)
                .WithConstructorArgument("storageUrl", storageUrl);
            }
            else
            {
                kernel.Bind <IStorageProvider>().To <FileSystemStorageProvider>()
                .WithConstructorArgument("basePath", basePath)
                .WithConstructorArgument("siteUrl", siteUrl);
            }


            ComponentContainer.Current = new NinjectComponentContainer(kernel, new[] {
                typeof(MongoRepository).Assembly
            });
            kernel.Bind <IBloomServiceHub>().To <BloomServiceHub>();
            kernel.Bind <INotificationService>().To <NotificationService>();
            kernel.Bind <IHubConnectionContext <dynamic> >().ToMethod(ctx => GlobalHost.ConnectionManager.GetHubContext <BloomServiceHub>().Clients);
        }
Esempio n. 4
0
 public BloomJobRegistry()
 {
     _proxy               = ComponentContainer.Current.Get <ISageApiProxy>();
     _settings            = ComponentContainer.Current.Get <BloomServiceConfiguration>();
     _repository          = ComponentContainer.Current.Get <IRepository>();
     _httpContextProvider = ComponentContainer.Current.Get <IHttpContextProvider>();
     _locationService     = ComponentContainer.Current.Get <ILocationService>();
     _notification        = ComponentContainer.Current.Get <INotificationService>();
     _lateTechnicians     = new List <LateTechnician>();
     _hub = ComponentContainer.Current.Get <IBloomServiceHub>();
     SendNotifications();
     SendRequest();
     Synchronization();
     CheckTechnicians();
 }
Esempio n. 5
0
 public ApiMobileController(
     ISageApiProxy sageApiProxy,
     IImageService imageService,
     IRepository repository,
     IAuthorizationService authorizationService,
     INotificationService notification,
     BloomServiceConfiguration settings,
     IBloomServiceHub hub)
 {
     this.sageApiProxy         = sageApiProxy;
     this._imageService        = imageService;
     this.repository           = repository;
     this.settings             = settings;
     this.authorizationService = authorizationService;
     this.notification         = notification;
     _hub = hub;
 }
Esempio n. 6
0
 public AuthorizationService(IRepository repository, BloomServiceConfiguration configuration)
 {
     this._repository    = repository;
     this._configuration = configuration;
 }
Esempio n. 7
0
 public SageApiProxy(IRestClient restClient, BloomServiceConfiguration configuration)
 {
     this.restClient    = restClient;
     this.configuration = configuration;
 }