Example #1
0
        public void EnsureSeedData(ConfigDbContext context)
        {
            using (var transaction = context.Database.BeginTransaction())
            {
                var anyData = context.ColorTypes.Any() ||
                              context.OrderStatuses.Any() ||
                              context.RimTypes.Any() ||
                              context.FuelTypes.Any() ||
                              context.Cars.Any() ||
                              context.Colors.Any() ||
                              context.Engines.Any() ||
                              context.Rims.Any() ||
                              context.AdditionalEquipmentItems.Any();

                if (!anyData)
                {
                    ImportJson(context, context.ColorTypes, "ColorTypes");
                    ImportJson(context, context.FuelTypes, "FuelTypes");
                    ImportJson(context, context.OrderStatuses, "OrderStatuses");
                    ImportJson(context, context.RimTypes, "RimTypes");
                    ImportJson(context, context.Colors, "Colors");
                    ImportJson(context, context.Engines, "Engines");
                    ImportJson(context, context.Rims, "Rims");
                    ImportJson(context, context.Cars, "Cars");
                    ImportJson(context, context.AdditionalEquipmentItems, "AdditionalEquipmentItems");

                    transaction.Commit();
                }
            }
        }
Example #2
0
 public string GetSetting(string key)
 {
     using (var db = new ConfigDbContext())
     {
         var setting = db.Set <ConfigSetting>().SingleOrDefault(c => c.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase));
         return(setting == null ? string.Empty : setting.Value);
     }
 }
Example #3
0
        //public private

        public ConfigsController(ConfigDbContext context)
        {
            _context          = context;
            _unitOfWork       = new EfUnitOfWork(_context);
            _configRepository = new EFRepository <Config>(_context);
            connection        = factory.CreateConnection();
            channel           = connection.CreateModel();
        }
 public AuthorizerConfigReader(ConfigDbContext context)
 {
     _context        = context;
     _authorizerName = GetAuthorizerName();
     if (_authorizerName == "")
     {
         throw new ArgumentException("Class " + typeof(TAuthorizer).Name + " does not have 'Authorizer' attribute defined");
     }
 }
        private static bool CheckIfIcuIsPresent(int icuNo)
        {
            ConfigDbContext context  = new ConfigDbContext();
            var             icuStore = context.Icu.ToList();

            if (icuStore.FirstOrDefault(item => item.IcuNo == icuNo) == null)
            {
                return(false);
            }
            return(true);
        }
Example #6
0
        protected override Object DoInBackground(params Object[] @params)
        {
            DataHolder.ClubList       = new GetData().GetClubsName();
            DataHolder.TopClubsModels = new GetData().GetTopFiveClub();
            var guid = new ConfigDbContext().SelectUserGuid().Result;

            if ((DataHolder.User = new GetData().GetLoginUser(guid)) != null)
            {
                new ConfigDbContext().UpdateData <UserModel>(DataHolder.User);
            }
            return(true);
        }
        public static void DeleteVitalLogsForDischargedPatient(int patientId)
        {
            ConfigDbContext context        = new ConfigDbContext();
            var             vitalsStore    = context.VitalsLogs.ToList();
            var             vitalsToRemove = vitalsStore.Where(item => item.PatientId == patientId).ToList();

            foreach (VitalsLogs vitals in vitalsToRemove)
            {
                context.Remove(vitals);
                context.SaveChanges();
            }
        }
Example #8
0
 public void SaveSetting(string key, string value)
 {
     using (var db = new ConfigDbContext())
     {
         var setting = db.Set <ConfigSetting>().SingleOrDefault(c => c.Key.Equals(key, StringComparison.InvariantCultureIgnoreCase));
         if (setting == null)
         {
             setting = new ConfigSetting {
                 Key = key
             };
             db.Set <ConfigSetting>().Add(setting);
         }
         setting.Value = value;
         db.SaveChanges();
     }
 }
        public void ConfigureServices(IServiceCollection services)
        {
            #region Register DB Context
            ConfigDbContext.Register(Configuration, services);
            #endregion

            #region CORS
            var allowedCors = Configuration.GetSection("CORS")
                              .AsEnumerable()
                              .Where(h => !string.IsNullOrEmpty(h.Value))
                              .Select(h => h.Value).ToArray();

            services.AddCors(options =>
            {
                options.AddPolicy(_allowOriginPolicy,
                                  builder =>
                {
                    builder.WithOrigins(allowedCors)
                    .SetIsOriginAllowedToAllowWildcardSubdomains()
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials();
                });
            });
            #endregion

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
            .AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

            services.AddSwaggerServices();

            services.AddControllers()
            .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);


            #region Register Application Services
            ConfigServices.Register(services);
            #endregion
        }
        public AOrderRepository(AOrderDTO updateEntity,
                                IEnumerable <ICommandAble> references,
                                DateTime updateDatetime,
                                string updateUser,
                                OrderDbContext orderDbContext,
                                ConfigDbContext configDbContext)
        {
            _AOrder         = updateEntity;
            _customer       = references.First() as CustomerDTO;
            _updateDatetime = updateDatetime;
            _updateUser     = updateUser;

            _lastUpdatedOrderCommonEntity = _orderDbContest.OrderCommons
                                            .SingleOrDefault(i => i.Id == _AOrder.Id);
            _lastUpddatedOrderAEntity = _orderDbContest.AOrders
                                        .SingleOrDefault(i => i.Id == _AOrder.Id);

            Debug.Assert(_lastUpdatedOrderCommonEntity != null ?
                         _lastUpddatedOrderAEntity != null : _lastUpddatedOrderAEntity == null);

            _orderDbContest  = orderDbContext;
            _configDbContext = configDbContext;
        }
 public EfConfigController(ConfigDbContext config,
                           ILoggerFactory loggerFactory)
 {
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _logger = loggerFactory?.CreateLogger <EfConfigController>() ?? throw new ArgumentNullException(nameof(loggerFactory));
 }
Example #12
0
 public ProfilesController(ConfigDbContext dbContext, IActors actors)
     : base(dbContext)
 {
     _actors = actors;
 }
Example #13
0
 public OrderRepository(ConfigDbContext context) : base(context)
 {
     DbSet = context.Orders;
 }
Example #14
0
 public EFRepository(ConfigDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException("dbContext can not be null.");
     _dbSet     = dbContext.Set <T>();
 }
Example #15
0
 public ConfigReader(ConfigDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Example #16
0
 public SelectApiResourceViewComponent(ConfigDbContext context)
 {
     _context = context;
 }
 protected RepositoryBase(ConfigDbContext context)
 {
     Context = context;
 }
Example #18
0
 public MerchantsController(ConfigDbContext context, IMerchantConfigService merchantConfigService)
 {
     _context = context;
     _merchantConfigService = merchantConfigService;
 }
 public Repository(ConfigDbContext context)
 {
     _context = context;
 }
Example #20
0
 public SimpleCrudController(ConfigDbContext dbContext)
 {
     _dbContext = dbContext;
 }
Example #21
0
 public ProcessorConfigService(ConfigDbContext context)
 {
     _context = context;
 }
Example #22
0
 public UsersController(CoreDbContext coreDbContext, ConfigDbContext configDbContext)
 {
     m_CoreDbContext   = coreDbContext;
     m_ConfigDbContext = configDbContext;
 }
 public MerchantConfigService(ConfigDbContext context)
 {
     _context = context;
 }
Example #24
0
 public ConfigController(ConfigDbContext configDbContext)
 {
     m_ConfigDbContext = configDbContext;
 }
Example #25
0
 public ApiResourceController(ConfigDbContext context)
 {
     _context = context;
 }
 public RimRepository(ConfigDbContext context) : base(context)
 {
     DbSet = context.Rims;
 }
Example #27
0
 public AdditionalEquipmentRepository(ConfigDbContext context) : base(context)
 {
     DbSet = context.AdditionalEquipmentItems;
 }
 public BuildServersController(ConfigDbContext dbContext)
     : base(dbContext)
 {
 }
Example #29
0
 public CustomerRepository(ConfigDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
 public CarRepository(ConfigDbContext context) : base(context)
 {
     DbSet = context.Cars;
 }
Example #31
0
 public ApiSecretsController(ConfigDbContext context)
 {
     _context = context;
 }