public static async Task<Service> GetServiceActiveAndExists(ManahostManagerDAL ctx, string client_id, string client_secret) { if (client_id == null) { throw new AuthenticationToolsException("client_id", GenericError.INVALID_GIVEN_PARAMETER); } var ServiceRepo = new ServiceRepository(ctx); var service = await ServiceRepo.GetUniqAsync(x => x.Id == client_id); if (service == null) { throw new AuthenticationToolsException("client_id", GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } if (service.ApplicationType == ApplicationTypes.NATIVE_CLIENT) { if (string.IsNullOrWhiteSpace(client_secret)) { throw new AuthenticationToolsException("client_secret", GenericError.INVALID_GIVEN_PARAMETER); } if (new BcryptPasswordHasher().VerifyHashedPassword(service.Secret, client_secret) == PasswordVerificationResult.Failed) { throw new AuthenticationToolsException("client_secret", GenericError.FORBIDDEN_RESOURCE_OR_DOES_NO_EXIST); } } if (!service.Active) { throw new AuthenticationToolsException("client_id", GenericError.CLIENT_DISABLED); } return service; }
public void A_ChangedService_modifies_Existing_country_in_the_database() { var bootStrapper = new BootStrapper(); bootStrapper.StartServices(); var serviceEvents = bootStrapper.GetService<IServiceEvents>(); //1.- Create message var aggr = GenerateRandomAggregate(); //2.- Create the tuple in the database var repository = new ServiceRepository(_configuration.TestServer); repository.Insert(aggr); //3.- Change the aggregate aggr.NameKeyId = StringExtension.RandomString(10); aggr.ServiceType.SapCode = StringExtension.RandomString(10); aggr.ServiceLevel.First().SapCode = StringExtension.RandomString(10); aggr.ServiceLevel.First().ServicePrice.First().Price = (float)new Random().NextDouble(); //4.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(ChangedService).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); //5.- Load the saved country var service = repository.Get(aggr.Id); //6.- Check equality Assert.True(ObjectExtension.AreEqual(aggr, service)); }
/// <summary> /// ��CompositeUI��ApplicationHost������ע��Զ�̷��� /// </summary> /// <param name="host"></param> /// <param name="serviceRepository"></param> public void RegisterRemoteServices(WorkItem host, ServiceRepository serviceRepository) { ILog logger = host.Services.Get<ILog>(); InterfaceConfigLoader.LoadInterfaceConfig(); Type[] services = InterfaceConfigLoader.GetAllSubSystem(); foreach (Type service in services) { if (logger != null) logger.Debug("ע��Զ�̷���: " + service.Name); host.Services.Add(service, serviceRepository.GetService(service)); } }
public void GetPerson_OnExecuteWithInvalidValue_ReturnsNull() { // Arrange var repo = new ServiceRepository(); repo.ServiceProxy = GetTestService(); // Act var output = repo.GetPerson("NOTAREALPERSON"); // Assert Assert.IsNull(output); }
// GET: /<controller>/ public async Task<IActionResult> Index() { var repo = new ServiceRepository(); var services = await repo.GetAllAsync(); var model = new ServiceIndexViewModel { Services = services, }; repo.Dispose(); return View(model); }
public void GetPerson_OnExecuteWithValidValue_ReturnsPerson() { // Arrange var repo = new ServiceRepository(); repo.ServiceProxy = GetTestService(); // Act var output = repo.GetPerson("Smith"); // Assert Assert.IsNotNull(output); Assert.AreEqual("Smith", output.LastName); }
public void GetPeople_OnExecute_ReturnsPeople() { // Arrange var repo = new ServiceRepository(); repo.ServiceProxy = GetTestService(); // Act var output = repo.GetPeople(); // Assert Assert.IsNotNull(output); Assert.AreEqual(2, output.Count()); }
public void A_RegisteredService_creates_a_new_currency_in_the_database() { var bootStrapper = new BootStrapper(); bootStrapper.StartServices(); var serviceEvents = bootStrapper.GetService<IServiceEvents>(); //1.- Create message var aggr = GenerateRandomAggregate(); var message = GenerateMessage(aggr); //2.- Emit message serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); //3.- Load the saved country var repository = new ServiceRepository(_configuration.TestServer); var service = repository.Get(aggr.Id); //4.- Check equality Assert.True(ObjectExtension.AreEqual(aggr, service)); }
public async Task<IActionResult> EditService(int id) { if (id != 0) { using (var repo = new ServiceRepository()) { var service = await repo.GetByIdAsync(id); return View(new EditServiceViewModel { Service = service }); } } return View(); }
public async Task<IViewComponentResult> InvokeAsync() { var model = new ServiceListComponentViewModel(); try { using (var repo = new ServiceRepository()) { var services = await repo.GetAllAsync(); model.Services = services; } } catch (Exception ex) { model.ErrorMessage = "Get Service List Error: " + ex.Message; } return View(model); }
public void A_UnregisteredService_modifies_Existing_country_in_the_database() { var bootStrapper = new BootStrapper(); bootStrapper.StartServices(); var serviceEvents = bootStrapper.GetService<IServiceEvents>(); //1.- Create message var aggr = GenerateRandomAggregate(); //2.- Create the tuple in the database var repository = new ServiceRepository(_configuration.TestServer); repository.Insert(aggr); //2.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(UnregisteredService).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); var service = repository.Get(aggr.Id); Assert.Null(service); }
public static IPersonRepository GetRepository(string repositoryType) { IPersonRepository repo switch (repositoryType) { case "Service": repo = new ServiceRepository(); break; case "CSV": repo = new CSVRepository(); break; case "SQL": repo = new SQLRepository(); break; default: throw new ArgumentException("Invalid Repository Type"); break; } return repo; }
public async Task<IActionResult> EditService(EditServiceViewModel model) { if ((model.Service?.Id ?? 0) != 0) { using (var repo = new ServiceRepository()) { await repo.UpdateAsync(model.Service); return View(model); } } if (!string.IsNullOrWhiteSpace(model.Service?.Name)) { using (var repo = new ServiceRepository()) { await repo.AddAsync(model.Service); return View(model); } } return View(model); }
public async Task CreateAsync(AuthenticationTokenCreateContext context) { var clientId = context.Ticket.Properties.Dictionary[GenericNames.AUTHENTICATION_CLIENT_ID_KEY]; if (string.IsNullOrEmpty(clientId)) return; var refreshTokenLifeTime = context.OwinContext.Get<int>(GenericNames.OWIN_CONTEXT_REFRESH_TOKEN_LIFETIME); var refreshToken = Guid.NewGuid().ToString("n"); //var refreshTokenRepository = new RefreshTokenRepository(context.OwinContext.Get<ManahostManagerDAL>()); /*var ClientManager = ClientUserManager.Create(null, context.OwinContext.Get<ManahostManagerDAL>());*/ IDependencyScope Scope = context.OwinContext.Get<IDependencyScope>(); ClientUserManager ClientManager = Scope.GetService(typeof(ClientUserManager)) as ClientUserManager; IRefreshTokenRepository refreshTokenRepository = Scope.GetService(typeof(IRefreshTokenRepository)) as IRefreshTokenRepository; var ServiceRepository = new ServiceRepository(context.OwinContext.Get<ManahostManagerDAL>()); var client = await ClientManager.FindByEmailAsync(context.Ticket.Identity.Name); var service = ServiceRepository.GetUniq(x => x.Id == clientId); var token = new RefreshToken() { Id = refreshToken, Client = client, Service = service, IssuedUtc = DateTime.UtcNow, ExpiresUtc = DateTime.UtcNow.AddMinutes(Convert.ToDouble(refreshTokenLifeTime)) }; token.ProtectedTicket = context.SerializeTicket(); refreshTokenRepository.Add(token); await refreshTokenRepository.SaveAsync(); context.SetToken(refreshToken); }
public async Task<IActionResult> DeleteService(int id) { try { var repo = new ServiceRepository(); var service = await repo.GetByIdAsync(id); ViewBag.StatusMessage = $"Are you sure delete service {service.Name}?"; } catch (Exception) { ViewBag.StatusMessage = "Get service info error."; } return View(); }
public void WcfService_DeleteCustomerTest() { IRepository <Customer> customersRepository = new ServiceRepository <Customer>(); var response = customersRepository.Delete(1); }
public override async Task <bool> ExistsAsync(Guid reservationId, object?userId = null) { return(await ServiceRepository.ExistsAsync(reservationId, userId)); }
public B01_LocalnetImport([NotNull] ServiceRepository services) : base(nameof(B01_LocalnetImport), Stage.Raw, 101, services, true) { }
//void ProcessTest(string queryFile, string process) //{ // // use this method for subscriber, since processing them in parallel causes to // // many issues with Provider Link, and join/unjoin. // string sql = string.Empty; // List<IEntity> entityList = new List<IEntity>(); // try // { // sql = FileReader.GetFileData(string.Format("{0}{1}", AppConfiguration.Query_Files_Path, queryFile)); // } // catch (Exception ex) // { // _service_repository.Log_Service_Message("ERROR", string.Format("ProcessSubscriber failed to retrieve query file {0}. ERROR: {1}", queryFile, ex.Message)); // } // if (!string.IsNullOrEmpty(sql)) // { // DataTable dtChangeLog = null; // try // { // dtChangeLog = this._service_repository.Run_Query_File(sql); // } // catch (Exception ex) // { // _service_repository.Log_Service_Message("ERROR", string.Format("ProcessSubscriber failed to get change log for query {0}. ERROR: {1}", queryFile, ex.Message)); // } // if (dtChangeLog != null) // { // foreach (DataRow dr in dtChangeLog.Rows) // { // _service_repository.Log_Service_Message("TEST", string.Format("Subscriber {0}", dr["Subscriber_Id"].ToString())); // } // } // } //} #endregion #region " Constructor " public Kshema_PNC_Sync(string group_record) { _service_repository = new ServiceRepository(); _group_record = group_record; }
public void RemoveTeam(Guid id) { ServiceRepository.Remove(id); ServiceUnitOfWork.SaveChangesAsync(); }
public A_LoadProfilePreparer([NotNull] ServiceRepository services) : base(nameof(A_LoadProfilePreparer), Stage.ProfileGeneration, 100, services, false, null) { }
public async Task <IEnumerable <ComponentTypeSpecificationDisplay> > FindAllDisplay() { return((await ServiceRepository.AllAsyncFull()).Select(dbEntity => _mapper.MapToBLLDisplay(dbEntity))); }
public async Task <ComponentTypeSpecificationDisplay> FindDisplay(int id) { return(_mapper.MapToBLLDisplay(await ServiceRepository.FindAsyncFull(id))); }
public async Task <TrainingDTO> MapTrainingData(Guid Id) { var training = await ServiceRepository.FirstOrDefaultAsync(Id); var creator = await ServiceUnitOfWork.AccountRepository.FirstOrDefaultAsync(training.CreatorId); var usersInThisTraining = await ServiceUnitOfWork.UsersInTrainingRepository.FindByTrainingId(Id); var usersAttending = new List <UserDTO>(); var usersInvited = new List <UserInTrainingDTO>(); foreach (var user in usersInThisTraining) { if (user.AttendingTraining == false) { var appUser = await ServiceUnitOfWork.AccountRepository.FirstOrDefaultAsync(user.AppUserId); var notification = await ServiceUnitOfWork.NotificationRepository.FindByTrainingAndUserId(user.AppUserId, training.Id); if (notification.Recived) { var notificationAnswer = await ServiceUnitOfWork.NotificationAnswerRepository.findbyNotificationId(notification.Id); var usrDTO = new UserInTrainingDTO() { Id = appUser.Id, email = appUser.Email, phoneNumber = appUser.PhoneNumber, userName = appUser.FirstName + " " + appUser.LastName, positions = await MapPlayerPositionDtos(appUser), recived = notification.Recived, answer = new NotificationAnswerDTO() { Coming = notificationAnswer.Attending, Content = notificationAnswer.Content } }; usersInvited.Add(usrDTO); } else { var userDTO = new UserInTrainingDTO() { Id = appUser.Id, email = appUser.Email, phoneNumber = appUser.PhoneNumber, userName = appUser.FirstName + " " + appUser.LastName, positions = await MapPlayerPositionDtos(appUser), recived = notification.Recived, answer = null }; usersInvited.Add(userDTO); } } if (user.AttendingTraining) { var appUser = await ServiceUnitOfWork.AccountRepository.FirstOrDefaultAsync(user.AppUserId); var usrDTO = new UserDTO { Id = appUser.Id, email = appUser.Email, phoneNumber = appUser.PhoneNumber, userName = appUser.FirstName + " " + appUser.LastName, positions = await MapPlayerPositionDtos(appUser) }; usersAttending.Add(usrDTO); } } var trainingPlace = await ServiceUnitOfWork.TrainingPlaceRepository.FirstOrDefaultAsync(training.TrainingPlaceId); var trainingPlaceDto = new TrainingPlaceDTO { Id = trainingPlace.Id, Address = trainingPlace.Address, Name = trainingPlace.Name, ClosingTime = trainingPlace.ClosingTime, OpeningTime = trainingPlace.OpeningTime }; if (usersAttending.Count >= 16) { training.TrainingStatus = ConfirmedTrainingStatus; } await ServiceUnitOfWork.SaveChangesAsync(); var trainingDto = new TrainingDTO { Id = training.Id, TrainingPlace = trainingPlaceDto, TrainingDate = training.Start, Description = training.Description, Duration = training.Duration, TrainingStatus = training.TrainingStatus, PeopleInvited = usersInvited, PeopleAttending = usersAttending, StartTime = training.StartTime, CreatedBy = new UserDTO() { Id = creator.Id, userName = creator.FirstName + " " + creator.LastName, email = creator.Email, phoneNumber = creator.PhoneNumber }, Comments = await CommentService.GetTrainingComments(training.Id) }; return(trainingDto); }
public static bool Prefix(CharacterInspectionScreen __instance, InputCommands.Id command) { switch (command) { // Handle 'E' for 'Export' - probably make it ctrl-E case InputCommands.Id.RotateCCW: ExportInspectedCharacter(); break; } return(true); void ExportInspectedCharacter() { // TODO: UI to allow user to supply name on export, and receive feedback if name already used var hero = __instance.InspectedCharacter.RulesetCharacterHero; var firstName = hero.Name; var surName = hero.SurName; // get all names in use var usedNames = Directory .EnumerateFiles(TacticalAdventuresApplication.GameCharactersDirectory, $"*.chr") .Select(f => Path.GetFileNameWithoutExtension(f)) .ToHashSet(StringComparer.OrdinalIgnoreCase); // get the available predefined names by race and sex var racePresentation = hero.RaceDefinition.RacePresentation; var availablePredefinedFirstNames = Enumerable.Empty <string>(); switch (hero.Sex) { case RuleDefinitions.CreatureSex.Male: availablePredefinedFirstNames = racePresentation .MaleNameOptions .Select(mn => Localize(mn)) .ToHashSet(StringComparer.OrdinalIgnoreCase) .Except(usedNames) .ToList(); break; case RuleDefinitions.CreatureSex.Female: availablePredefinedFirstNames = racePresentation .FemaleNameOptions .Select(fn => Localize(fn)) .ToHashSet(StringComparer.OrdinalIgnoreCase) .Except(usedNames) .ToList(); break; default: break; } var rnd = new Random(Environment.TickCount); string newFirstName; if (availablePredefinedFirstNames.Any()) { newFirstName = availablePredefinedFirstNames .Skip(rnd.Next(availablePredefinedFirstNames.Count())) .First(); } else { // Otherwise add "-n" to current name. // Get the next save character index - let's not have over 1000 characters with the same name :) var regex = new Regex($@"^{firstName}.*-(?<num>\d{{1,4}}).chr$", RegexOptions.Singleline | RegexOptions.Compiled); var next = (Directory .EnumerateFiles(TacticalAdventuresApplication.GameCharactersDirectory, $"{firstName}*.chr") .Select(f => Path.GetFileName(f)) .Select(f => regex.Match(f)) .Where(m => m.Success) .Select(m => (int?)int.Parse(m.Groups["num"].Value)) .Max() ?? 0) + 1; newFirstName = $"{firstName}-{next}"; } string newSurname; if (racePresentation.HasSurName && racePresentation.SurNameOptions.Any()) { var availableSurnames = racePresentation.SurNameOptions .Concat(Enumerable.Repeat(surName, 1)) .Where(s => !string.IsNullOrWhiteSpace(s)) .Select(sn => Localize(sn)) .Distinct() .ToList(); newSurname = availableSurnames .Skip(rnd.Next(availableSurnames.Count)) .First(); } else { newSurname = surName; } var msg = racePresentation.HasSurName ? $"Export '{firstName} {surName}' as '{newFirstName} {newSurname}'." : $"Export '{firstName}' as '{newFirstName}'."; // TODO: localize ServiceRepository.GetService <IGuiService>().ShowMessage( MessageModal.Severity.Informative1, "Character export", msg, "OK", "Cancel", () => { Main.Log("Ok pressed"); DoExportInspectedCharacter(newFirstName, newSurname); }, () => { Main.Log("Cancel pressed"); }); } void DoExportInspectedCharacter(string newFirstName, string newSurname) { var heroCharacter = __instance.InspectedCharacter.RulesetCharacterHero; // record current name, etc.. var firstName = heroCharacter.Name; var surName = heroCharacter.SurName; var builtin = heroCharacter.BuiltIn; var guid = heroCharacter.Guid; // record current conditions, powers, spells and attunements var conditions = heroCharacter.ConditionsByCategory.ToList(); var powers = heroCharacter.PowersUsedByMe.ToList(); var spells = heroCharacter.SpellsCastByMe.ToList(); var inventoryItems = new List <RulesetItem>(); heroCharacter.CharacterInventory.EnumerateAllItems(inventoryItems); var attunedItems = inventoryItems.Select(i => new { Item = i, Name = i.AttunedToCharacter }).ToList(); // record item guids var heroItemGuids = heroCharacter.Items.Select(i => new { Item = i, i.Guid }).ToList(); var inventoryItemGuids = inventoryItems.Select(i => new { Item = i, i.Guid }).ToList(); try { heroCharacter.Name = newFirstName; heroCharacter.SurName = newSurname; heroCharacter.BuiltIn = false; // remove active conditions (or filter out during serialization) heroCharacter.ConditionsByCategory.Clear(); // remove spells and effects (or filter out during serialization) heroCharacter.PowersUsedByMe.Clear(); heroCharacter.SpellsCastByMe.Clear(); // TODO: -- need help // TODO: remove weapon modifiers and effects // TODO: fully rest and restore hit points // remove attunement, attuned items don't work well in the character inspection screen out of game foreach (var item in attunedItems) { item.Item.AttunedToCharacter = string.Empty; } // clear guids heroCharacter.SetGuid(0); foreach (var item in heroItemGuids) { item.Item.SetGuid(0); } foreach (var item in inventoryItemGuids) { item.Item.SetGuid(0); } // finally, save the character ServiceRepository .GetService <ICharacterPoolService>() .SaveCharacter(heroCharacter, true); } finally { // and finally, finally, restore everything. // TODO: check these things are really restored // restore original values heroCharacter.Name = firstName; heroCharacter.SurName = surName; heroCharacter.BuiltIn = builtin; // restore conditions foreach (var kvp in conditions) { heroCharacter.ConditionsByCategory.Add(kvp.Key, kvp.Value); } // restore active spells and effects heroCharacter.PowersUsedByMe.AddRange(powers); heroCharacter.SpellsCastByMe.AddRange(spells); // restore attunements foreach (var item in attunedItems) { item.Item.AttunedToCharacter = item.Name; } // restore guids heroCharacter.SetGuid(guid); foreach (var item in heroItemGuids) { item.Item.SetGuid(item.Guid); } foreach (var item in inventoryItemGuids) { item.Item.SetGuid(item.Guid); } } } }
public ServicesController() { _repo = new ServiceRepository(); }
public B08_TrafoKreisImport([NotNull] ServiceRepository services) : base(nameof(B08_TrafoKreisImport), Stage.Raw, 108, services, true) { }
public void RunElectricCarProviderProvidingTest() { Config.LimitToScenarios.Add(Scenario.FromEnum(ScenarioEnum.Utopia)); Config.LimitToYears.Add(2050); Config.InitializeSlices(Logger); Config.LpgPrepareMode = LpgPrepareMode.PrepareWithFullLpgLoad; var slice = (Config.Slices ?? throw new InvalidOperationException()).First(x => x.DstYear == 2050 && x.DstScenario == Scenario.FromEnum(ScenarioEnum.Utopia)); // ReSharper disable twice AssignNullToNotNullAttribute var services = new ServiceRepository(null, null, Logger, Config, new Random()); var dbHouses = services.SqlConnectionPreparer.GetDatabaseConnection(Stage.Houses, slice); var houses = dbHouses.Fetch <House>(); var has = dbHouses.Fetch <Hausanschluss>(); var households = dbHouses.Fetch <Household>(); var cdes = dbHouses.Fetch <CarDistanceEntry>(); //SLPProvider slp = new SLPProvider(2017, vdewValues, feiertage); var cars = dbHouses.Fetch <Car>(); DBDto dbdto = new DBDto(houses, has, cars, households, new List <RlmProfile>()); CachingLPGProfileLoader clpl = new CachingLPGProfileLoader(Logger, dbdto); ElectricCarProvider ecp = new ElectricCarProvider(services, slice, dbdto, new List <HouseCreationAndCalculationJob>(), clpl); double sumenergyEstimates = 0; double kilometers = 0; double sumenergyProfiles = 0; double carCount = 0; int gascars = 0; int evs = 0; int count = 0; foreach (var carDistanceEntry in cdes) { var car = cars.Single(x => x.Guid == carDistanceEntry.CarGuid); if (car.CarType == CarType.Electric) { evs++; } else { gascars++; } HouseComponentRo hcro = new HouseComponentRo(carDistanceEntry.Name, carDistanceEntry.HouseComponentType.ToString(), 0, 0, "", carDistanceEntry.ISNsAsJson, carDistanceEntry.Standort, carDistanceEntry.EffectiveEnergyDemand); ProviderParameterDto ppd = new ProviderParameterDto(carDistanceEntry, Config.Directories.CalcServerLpgDirectory, hcro); ecp.PrepareLoadProfileIfNeeded(ppd); var prosumer = ecp.ProvideProfile(ppd); if (prosumer != null && prosumer.Profile != null) { double energyEstimate = carDistanceEntry.EnergyEstimate; sumenergyEstimates += energyEstimate; kilometers += carDistanceEntry.DistanceEstimate; double profileEnergy = prosumer.Profile.EnergySum(); sumenergyProfiles += profileEnergy; carCount++; } count++; if (count % 100 == 0) { Info("Processed " + count + " / " + cdes.Count); } //profileEnergy.Should().BeInRange(energyEstimate, energyEstimate * 1.5); } double avgKilometers = kilometers / carCount; Info("gasoline cars: " + gascars); Info("ev cars: " + evs); Info("EnergyEstimateSum: " + sumenergyEstimates); Info("ProfileSum: " + sumenergyProfiles); Info("cars profiles made for " + carCount + " / " + cdes.Count); Info("Avg km per car: " + avgKilometers); Info("Avg Energy estimate per car: " + sumenergyEstimates / carCount); Info("Avg Energy profile per car: " + sumenergyProfiles / carCount); }
public E_AddPVProfiles([NotNull] ServiceRepository services) : base(nameof(E_AddPVProfiles), Stage.ProfileGeneration, 500, services, true) { }
public void AddNoReturn(ComponentTypeSpecificationMinimal bllComponentTypeSpecificationMinimalList) { ServiceRepository.AddNoReturn(_mapper.MapToDALMinimal(bllComponentTypeSpecificationMinimalList)); }
public async Task <IEnumerable <DAL.App.DTO.Team> > getPersonsInTeam(string teamName) { return(await ServiceRepository.AllAsync(Guid.NewGuid())); }
public void RemoveNoReturnAsync(ComponentTypeSpecificationMinimal bllComponentTypeSpecificationMinimalList) { ServiceRepository.RemoveNoReturnAsync(_mapper.MapToDALMinimal(bllComponentTypeSpecificationMinimalList)); }
public C01_TrafostationListImporter([NotNull] ServiceRepository services) : base(nameof(C01_TrafostationListImporter), Stage.Raw, 201, services, false) { }
public ActionResult GetAllServices() { var serviceList = ServiceRepository.GetAllServices(); return(Created($"api/getAllServices", serviceList)); }
public CabinsController(ServiceRepository service, UserManager <FrontEndUser> userManager) { _service = service; _userManager = userManager; }
public void LoadDgSubServices() { ServiceRepository = new ServiceRepository(); dgSubService.DataSource = GetDataSource(ServiceRepository.LoadAllSousService()); }
public async Task <IEnumerable <Review> > PropertyReviews(Guid?propertyId) { return((await ServiceRepository.PropertyReviews(propertyId)).Select(dalEntity => Mapper.Map(dalEntity))); }
public B02_OsmLoader([NotNull] ServiceRepository services) : base(nameof(B02_OsmLoader), Stage.Raw, 102, services, false) { }
public void WcfService_RetrieveCustomersTest() { IRepository <Customer> customersRepository = new ServiceRepository <Customer>(); var customers = customersRepository.GetAll().ToList(); }
public ServiceController() { procedureRepo = new ProcedureRepository(); repo = new ServiceRepository(); }
//--- Class Methods --- public static void StartExtensionService(DekiContext context, ServiceBE service, ServiceRepository.IServiceInfo serviceInfo, bool forceRefresh) { // retrieve document describing the extension functions XUri uri = new XUri(service.Uri); XDoc manifest = null; DekiWikiService deki = context.Deki; var extension = serviceInfo.Extension; if(!service.ServiceLocal) { lock(deki.RemoteExtensionLibraries) { deki.RemoteExtensionLibraries.TryGetValue(uri, out manifest); } } if(manifest == null || forceRefresh) { manifest = Plug.New(uri).Get().ToDocument(); // normalize the extension XML manifest = manifest.TransformAsXml(_extensionConverterXslt); // check if document describes a valid extension: either the extension has no functions, or the functions have end-points if(manifest.HasName("extension") && ((manifest["function"].ListLength == 0) || (manifest["function/uri"].ListLength > 0))) { // add source uri for service manifest.Attr("uri", uri); // register service in extension list lock(deki.RemoteExtensionLibraries) { deki.RemoteExtensionLibraries[uri] = manifest; } } else { throw new ExtensionRemoveServiceInvalidOperationException(uri); } } extension.Manifest = manifest; // add function prefix if one is defined serviceInfo.Extension.SetPreference("namespace.custom", service.Preferences["namespace"]); string serviceNamespace = service.Preferences["namespace"] ?? manifest["namespace"].AsText; if(serviceNamespace != null) { serviceNamespace = serviceNamespace.Trim(); if(string.IsNullOrEmpty(serviceInfo.Namespace)) { // Note (arnec): Namespace from preferences is assigned at service creation. If we do not have one at this // point, it came from the extension manifest and needs to be registered as our default. Otherwise the // preference override persists as the namespace. context.Instance.RunningServices.RegisterNamespace(serviceInfo, serviceNamespace); } if(serviceNamespace.Length != 0) { if(!DekiScriptParser.IsIdentifier(serviceNamespace)) { throw new ExtensionNamespaceInvalidArgumentException(service.Preferences["namespace"] ?? manifest["namespace"].AsText); } } else { serviceNamespace = null; } } serviceNamespace = (serviceNamespace == null) ? string.Empty : (serviceNamespace + "."); // add custom library title extension.SetPreference("title.custom", service.Preferences["title"]); extension.SetPreference("label.custom", service.Preferences["label"]); extension.SetPreference("description.custom", service.Preferences["description"]); extension.SetPreference("uri.logo.custom", service.Preferences["uri.logo"]); extension.SetPreference("functions", service.Preferences["functions"]); extension.SetPreference("protected", service.Preferences["protected"]); // add each extension function bool.TryParse(service.Preferences["protected"], out extension.IsProtected); var functions = new List<ServiceRepository.ExtensionFunctionInfo>(); foreach(XDoc function in manifest["function"]) { XUri functionUri = function["uri"].AsUri; if(functionUri != null) { functions.Add(new ServiceRepository.ExtensionFunctionInfo(serviceNamespace + function["name"].Contents, functionUri)); } } extension.Functions = functions.ToArray(); }
public ServiceController(LeadDataContext context) { this.context = context; this.serviceRepo = new ServiceRepository(context); }
public async Task<IActionResult> DeleteService(int id, bool confirm) { try { var repo = new ServiceRepository(); await repo.RemoveAsync(id); ViewBag.StatusMessage = $"Service Deleted"; } catch (Exception) { ViewBag.StatusMessage = "Deleted service error."; } return View(); }
public F_AssignHeatingSystems([NotNull] ServiceRepository services) : base(nameof(F_AssignHeatingSystems), Stage.Houses, 600, services, true, new HeatingSystemCharts()) { }
public C07_SupplementalISN([NotNull] ServiceRepository services) : base(nameof(C07_SupplementalISN), Stage.Raw, 207, services, true) { }
public async Task <IEnumerable <Order> > GetAllByRestaurantAsync(Guid restaurantId, object?userId = null, bool noTracking = true) { var dalEntities = await ServiceRepository.GetAllByRestaurantAsync(restaurantId, userId, noTracking); return(dalEntities.Select(e => BLLMapper.Map(e))); }
protected RunnableForAllScenarioWithBenchmark([NotNull] string name, Stage stage, int sequenceNumber, [NotNull] ServiceRepository services, bool implementationFinished) : base(name, stage, sequenceNumber, Steptype.AllScenarios, services, implementationFinished, null) { }
public ServiceServices(PXHotelEntities entities) { _localizedResourceServices = HostContainer.GetInstance<ILocalizedResourceServices>(); _serviceRepository = new ServiceRepository(entities); }