public UserProfileService(IUnitOfWork unitOfWork) { if (unitOfWork == null) throw new ArgumentNullException(nameof(unitOfWork)); workRepository = unitOfWork; }
public StopSelectionViewModel(IUnitOfWork unitOfWork, AppUse appUse, INavigationService navigationService) : base(appUse, ApplicationPage.StopSelection, unitOfWork, navigationService) { this.timerSearch = new DispatcherTimer(); this.timerSearch.Interval = new TimeSpan(0, 0, 1); this.timerSearch.Tick += TimerTickSearch; }
public VideoService( IUnitOfWork unitOfWork, IVideoRepository videoRepository) { this._unitOfWork = unitOfWork; this._videoRepository = videoRepository; }
public int AddFowardingServer(IUnitOfWork uow, ForwardingServer forwardingServer) { var mappedForwardingServer = Mapper.Map<SQL.Models.ForwardingServer>(forwardingServer); var id = Convert.ToInt32(uow.Db.Insert(mappedForwardingServer)); Mapper.Map(mappedForwardingServer, forwardingServer); return id; }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); var memberFactory = new MemberFactory(); _email = Guid.NewGuid().ToString(); _decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository); _oldCount = _unitOfWork.MemberRepository.Count(); _member = memberFactory.CreateMember(_email); _sameMember = memberFactory.CreateMember(_email); _decorator.Add(_member); _unitOfWork.PersistAll(); using (var uow = new UnitOfWork()) { _newCount = uow.MemberRepository.Count(); try { _loadedMember = uow.MemberRepository.Get(_member.Id); } catch (Exception) { _loadedMember = null; } } }
public static IEnumerable<ArticleUnitViewModel> ArticleUnitViewModelList(IUnitOfWork uow, IEnumerable<Article> articles) { var votesList = HttpRuntime.Cache.Get("PopularArticlesAndVotes") as IDictionary<int, int>; if (votesList == null) { votesList = uow.ArticleRepository.GetPopularArticlesIdAndVotes(); HttpRuntime.Cache["PopularArticlesAndVotes"] = votesList; } var newList = new List<ArticleUnitViewModel>(); foreach (var item in articles) { newList.Add(new ArticleUnitViewModel { Id = item.Id, Title = item.Title, Description = item.Description, UserId = item.UserId, Username = item.User.UserName, Items = item.Items.Count, Tags = item.Tags, Votes = votesList.Where(x => x.Key == item.Id).Select(x => x.Value).FirstOrDefault() }); } return newList; }
public AircraftsController( IUnitOfWork unitOfWork, ILotRepository lotRepository, IInventoryRepository inventoryRepository, IAircraftRepository aircraftRepository, IAircraftRegistrationRepository aircraftRegistrationRepository, IAircraftRegMarkRepository aircraftRegMarkRepository, ISModeCodeRepository sModeCodeRepository, IFileRepository fileRepository, IApplicationRepository applicationRepository, ICaseTypeRepository caseTypeRepository, ILotEventDispatcher lotEventDispatcher, UserContext userContext) { this.unitOfWork = unitOfWork; this.lotRepository = lotRepository; this.inventoryRepository = inventoryRepository; this.aircraftRepository = aircraftRepository; this.aircraftRegistrationRepository = aircraftRegistrationRepository; this.aircraftRegMarkRepository = aircraftRegMarkRepository; this.sModeCodeRepository = sModeCodeRepository; this.fileRepository = fileRepository; this.applicationRepository = applicationRepository; this.caseTypeRepository = caseTypeRepository; this.lotEventDispatcher = lotEventDispatcher; this.userContext = userContext; }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); _memberFactory = new MemberFactory(); _gomeeFactory = new GomeeFactory(); _targetFactory = new TargetFactory(); _targetDecorator = new TargetDecorator(_targetFactory, _unitOfWork.TargetRepository); _member = _memberFactory.CreateMember(Guid.NewGuid().ToString()); _gomee = _gomeeFactory.CreateGomee(_member); _targets = new List<Target>(); using (var uow = new UnitOfWork()) { uow.MemberRepository.Add(_member); uow.GomeeRepository.Add(_gomee); var count = new Random().Next(2, 5); for (var i = 0; i < count; i++) { var target = _targetFactory.CreateGomeeTarget(_member, _gomee); _targets.Add(target); uow.TargetRepository.Add(target); } uow.PersistAll(); } _loadedTargets = _targetDecorator.GetFor(_unitOfWork.GomeeRepository.Get(_gomee.Id)); }
public GpsService() { SailingDbContext context = new SailingDbContext(); _repositoryGpsData = new GpsDataRepository(context); _unitOfWork = new UnitOfWork(context); AutoMapperConfiguration.Configuration(); }
public static string GenerateCodeId(string codeTypeId, IUnitOfWork context) { var codeIds = context.FindAll<Code>().Where(c => c.CodeTypeId == codeTypeId).OrderBy(f => f.CodeId).Select(ci => ci.CodeId).ToList(); var lastCodeId = codeIds.Count > 0 ? codeIds.Last() : null; var IdCharCount = lastCodeId != null ? lastCodeId.Count() - 1 : 9; List<char> chars = codeTypeId.ToList(); var charArray = chars.ToArray(); var numberId = 0; if (lastCodeId != null) { numberId = int.Parse(lastCodeId.TrimStart(charArray)); if (lastCodeId[3].ToString(CultureInfo.InvariantCulture) == "1") { numberId++; } } var newId = codeTypeId + numberId.ToString(CultureInfo.InvariantCulture); var charCount = (codeTypeId + numberId.ToString(CultureInfo.InvariantCulture)).Count(); if (charCount < IdCharCount) { newId = string.Format(codeTypeId + '1' + new string('0', IdCharCount - charCount) + numberId.ToString(CultureInfo.InvariantCulture)); } return newId; }
public ExternalAuthSettings(IUnitOfWork unitOfWork) : base(unitOfWork) { AutoRegisterEnabled = true; GoogleSystemEnable = true; FacebookSystemEnable = true; }
public CompositeEntitySeeder(IUnitOfWork unitOfWork , CoreSqlSeeder coreSqlSeeder //, LanguageEntitySeeder languageEntitySeeder , LanguageSqlSeeder languageSqlSeeder , PlaceByGeoPlanetEntitySeeder placeByGeoPlanetEntitySeeder , RoleEntitySeeder roleEntitySeeder , EstablishmentEntitySeeder establishmentEntitySeeder , EmailTemplateEntitySeeder emailTemplateEntitySeeder , PersonEntitySeeder personEntitySeeder , UserEntitySeeder userEntitySeeder , MemberEntitySeeder memberEntitySeeder , InstitutionalAgreementEntitySeeder institutionalAgreementEntitySeeder , InstitutionalAgreementSettingsEntitySeeder institutionalAgreementSettingsEntitySeeder ) { _unitOfWork = unitOfWork; _coreSqlSeeder = coreSqlSeeder; _languageSqlSeeder = languageSqlSeeder; //_languageEntitySeeder = languageEntitySeeder; _placeByGeoPlanetEntitySeeder = placeByGeoPlanetEntitySeeder; _roleEntitySeeder = roleEntitySeeder; _establishmentEntitySeeder = establishmentEntitySeeder; _emailTemplateEntitySeeder = emailTemplateEntitySeeder; _personEntitySeeder = personEntitySeeder; _userEntitySeeder = userEntitySeeder; _memberEntitySeeder = memberEntitySeeder; _institutionalAgreementEntitySeeder = institutionalAgreementEntitySeeder; _institutionalAgreementSettingsEntitySeeder = institutionalAgreementSettingsEntitySeeder; }
public BaseApiController() { uow = new SandlerUnitOfWork(new SandlerRepositoryProvider(new RepositoryFactories()), new SandlerDBContext()); CurrentUser = new UserModel(RequestContext.Principal.Identity.Name); CurrentUser.Load(uow); //_contextProvider = new EFContextProvider<SandlerDBEntities>(); }
public Creator(IUnitOfWork unitOfWork, IRepository<Battle> repositoryOfBattle, IRepository<User> repositoryOfUser, IRepository<Team> repositoryOfTeam) { _unitOfWork = unitOfWork; _repositoryOfBattle = repositoryOfBattle; _repositoryOfUser = repositoryOfUser; _repositoryOfTeam = repositoryOfTeam; }
public ThreadServices( IRepository<Thread> threadRepository, IRepository<ThreadView> threadViewRepository, IRepository<Post> postRepository, IRepository<User> userRepository, IRepository<ThreadViewStamp> threadViewStampRepository, IRepository<Subscription> subscriptionRepository, IRepository<Attachment> attachmentRepository, PollServices pollServices, FileServices fileServices, ParseServices parseServices, RoleServices roleServices, IUnitOfWork unitOfWork) : base(unitOfWork) { _threadRepository = threadRepository; _threadViewRepository = threadViewRepository; _postRepository = postRepository; _userRepository = userRepository; _threadViewStampRepository = threadViewStampRepository; _subscriptionRepository = subscriptionRepository; _attachmentRepository = attachmentRepository; _pollServices = pollServices; _fileServices = fileServices; _parseServices = parseServices; _roleServices = roleServices; }
public AccountController(IUnitOfWork uow, IAuth a) { unitOfWork = uow; userService = new UserService(unitOfWork); metroRegionService = new MetroRegionService(unitOfWork); webSecurity = new WebSecurity(uow, a); }
public AulaService(IAulaRepository repoAula, IAlunoRepository repoAluno, ITurmaRepository repoTurma, IUnitOfWork unitOfWork) { _aulaRepository = repoAula; _alunoRepository = repoAluno; _turmaRepository = repoTurma; _unitOfWork = unitOfWork; }
public CustomerService( IUnitOfWork unitOfWork, ICustomerRepository customerRepository) { UnitOfWork = unitOfWork; _customerRepository = customerRepository; }
public void Setup() { var container = SetupTest.Container; _usuarioRepository = container.Resolve<IUsuarioRepository>(); _unitOfWork = container.Resolve<IUnitOfWork>(); }
private static void SetCurrentUow(IUnitOfWork value, ILogger logger) { if (value == null) { ExitFromCurrentUowScope(logger); return; } var unitOfWorkKey = CallContext.LogicalGetData(ContextKey) as string; if (unitOfWorkKey != null) { IUnitOfWork outer; if (UnitOfWorkDictionary.TryGetValue(unitOfWorkKey, out outer)) { if (outer == value) { logger.Warn("Setting the same UOW to the CallContext, no need to set again!"); return; } value.Outer = outer; } } unitOfWorkKey = value.Id; if (!UnitOfWorkDictionary.TryAdd(unitOfWorkKey, value)) { throw new AbpException("Can not set unit of work! UnitOfWorkDictionary.TryAdd returns false!"); } logger.Debug("Entering a new UOW scope: " + unitOfWorkKey); CallContext.LogicalSetData(ContextKey, unitOfWorkKey); }
public MainService(IUnitOfWork uow, ILotRepository lotrepository, ICathegoryRepository cathegoryRepository, IImageRepository imageRepository) { this.uow = uow; this.lotRepository = lotrepository; this.cathegoryRepository = cathegoryRepository; this.imageRepository = imageRepository; }
static ProposalRequestService() { ProposalRequestService.unitOfWork = new UnitOfWork(); ProposalRequestService.repository = RepositoryFactory.GetRepository<IProposalRequestRepository, ProposalRequest>(ProposalRequestService.unitOfWork); }
public PatientServiceTest() { patientRepository = Substitute.For<IPatientRepository>(); unitOfWork = Substitute.For<IUnitOfWork>(); validatorService = Substitute.For<IValidatorService>(); patientService = new PatientService(patientRepository, unitOfWork, validatorService); }
public void SetUp() { _context = new DataContext(); _context.Database.Connection.ConnectionString = "Server=.\\SQLEXPRESS;Database=Pristjek220Data.DataContext; Trusted_Connection=True;"; _context.Database.ExecuteSqlCommand("dbo.TestCleanTable"); _unitOfWork = new UnitOfWork(_context); }
public void SetUp() { mocks = new MockRepository(); instance = mocks.DynamicMock<IUnitOfWork>(); store = new ThreadedUnitOfWorkStore(); }
// // GET: /Partnership/ public PartnershipController(IUnitOfWork unitOfWork, PartnershipService partnershipService, StagedPartnershipService stagedPartnershipService, ChurchService churchService, PartnershipLogExcelFileHandler fileHandler) : base(unitOfWork) { _partnershipService = partnershipService; _stagedPartnershipService = stagedPartnershipService; _churchService = churchService; _fileHandler = fileHandler; }
public TagService(IUnitOfWork unitOfWork, ITagValidation tagValidation) : base(unitOfWork) { Guard.NotNull(tagValidation, "tagValidation"); this._tagValidation = tagValidation; }
public DigitalAccountsService(ICuentaRepository cuentaRepository, IProductoRepository productoRepository) { _unitOfWork = cuentaRepository.UnitOfWork; _cuentaRepository = cuentaRepository; _productoRepository = productoRepository; }
public virtual async Task<int> AddAsync(IUnitOfWork unitOfWork, List<IUser> entities, List<IUserRole> roles = null) { try { var result = 0; foreach (var entity in entities) { result += await this.AddAsync(unitOfWork, entity); } if (roles != null) { foreach (var role in roles) { result += await unitOfWork.AddAsync<UserRole>( Mapper.Map<UserRole>(role)); } } return result; } catch (Exception e) { throw e; } }
/// <summary> /// Initializes a new instance of the <see cref="CmsMembershipProvider" /> class. /// </summary> /// <param name="userService">The user service.</param> /// <param name="authenticationService">The authentication service.</param> /// <param name="unitOfWork">The unit of work.</param> /// <param name="membershipName">Name of the membership.</param> internal CmsMembershipProvider(IUserService userService, IAuthenticationService authenticationService, IUnitOfWork unitOfWork, string membershipName) { this.authenticationService = authenticationService; this.userService = userService; this.unitOfWork = unitOfWork; this.membershipName = membershipName; }
public RepositoryEF(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
public ProductsController(IUnitOfWork uow, IMapper mapper) { _uow = uow; _mapper = mapper; }
public SaveResponse Update(IUnitOfWork uow, UserRoleUpdateRequest request) { return(new MyRepository().Update(uow, request)); }
public UsersController(IUnitOfWork db) { this.db = db; }
public States(IUnitOfWork unitOfWork, IStatesRepository _statesRepository) { this.unitOfWork = unitOfWork; this._statesRepository = _statesRepository; }
public LocationController(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
public AuthController(IUnitOfWork unitOfWork, IConfiguration config) { this.unitOfWork = unitOfWork; this.config = config; }
public AomFieldObjectService(IUnitOfWork unitOfWork) : base(unitOfWork) { }
public MaterialPurchaseOrderFacts() { m_session = Scout.Core.Data.GetUnitOfWork(); }
public EmployeesController(IEmployeeRepository employeeRepository, IUnitOfWork unitOfWork) { _employeeRepository = employeeRepository; _unitOfWork = unitOfWork; }
public UserService(IRepository<User> UserRepsotiry, IUnitOfWork uow) { _UserRepsotiry = UserRepsotiry; _uow = uow; }
public PositionService(IRepository <Position> positionRepository, IUnitOfWork unitOfWork) { this.positionRepository = positionRepository; this.unitOfWork = unitOfWork; }
/// <summary> /// Initializes a new instance of the <see cref="Person_citizenRepository"/> class. /// </summary> /// <param name="unitOfWork">The unitOfWork<see cref="IUnitOfWork"/></param> public Person_citizenRepository(IUnitOfWork unitOfWork) : base(unitOfWork) { }
public UserRepository(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork as UnitOfWork; }
public SaveResponse Update(IUnitOfWork uow, SaveRequest <MyRow> request) { return(new MySaveHandler().Process(uow, request, SaveRequestType.Update)); }
public UserLoginRepository(IUnitOfWork unitOfWork) : base(unitOfWork) { }
/// <summary> /// Constructor /// </summary> /// <param name="unitOfWork">UnitOfWork Dependancy</param> /// <param name="mapper">Auto Mapper Injection</param> public PaymentService(IUnitOfWork unitOfWork, IMapper mapper) : base(unitOfWork, mapper) { }
public DeleteResponse Delete(IUnitOfWork uow, DeleteRequest request) { return(new MyDeleteHandler().Process(uow, request)); }
public CreateMqttPublishingMessageCommandHandler(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
public BaseService(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; }
public Repository(IUnitOfWork unitOfWork) { this.UnitOfWork = unitOfWork; DataSession = DataSessionFactory.GetDataSession <T, TEntityKey>(); }
public ProfilesService(IUnitOfWork unitOfWork, IProfilesRepository profilesRepository) : base(unitOfWork, profilesRepository) { _unitOfWork = unitOfWork; _profilesRepository = profilesRepository; }
public virtual IList <StockBalanceDTO> StockBalances( IUnitOfWork uow, Warehouse warehouse, IList <Nomenclature> nomenclatures, DateTime onTime, IEnumerable <WarehouseOperation> excludeOperations = null) { StockBalanceDTO resultAlias = null; WarehouseOperation warehouseExpenseOperationAlias = null; WarehouseOperation warehouseIncomeOperationAlias = null; WarehouseOperation warehouseOperationAlias = null; Nomenclature nomenclatureAlias = null; Size sizeAlias = null; Size heightAlias = null; var excludeIds = excludeOperations?.Select(x => x.Id).ToList(); // null == null => null null <=> null => true var expenseQuery = QueryOver.Of(() => warehouseExpenseOperationAlias) .Where(() => warehouseExpenseOperationAlias.Nomenclature.Id == nomenclatureAlias.Id && (warehouseExpenseOperationAlias.WearSize.Id == sizeAlias.Id || warehouseOperationAlias.WearSize == null && sizeAlias == null) && (warehouseExpenseOperationAlias.Height.Id == heightAlias.Id || warehouseOperationAlias.Height == null && heightAlias == null) && warehouseExpenseOperationAlias.WearPercent == warehouseOperationAlias.WearPercent) .Where(e => e.OperationTime <= onTime); if (warehouse == null) { expenseQuery.Where(x => x.ExpenseWarehouse != null); } else { expenseQuery.Where(x => x.ExpenseWarehouse == warehouse); } if (excludeIds != null && excludeIds.Count > 0) { expenseQuery.WhereNot(x => x.Id.IsIn(excludeIds)); } expenseQuery.Select(Projections .Sum(Projections .Property(() => warehouseExpenseOperationAlias.Amount))); var incomeSubQuery = QueryOver.Of(() => warehouseIncomeOperationAlias) .Where(() => warehouseIncomeOperationAlias.Nomenclature.Id == nomenclatureAlias.Id && (warehouseIncomeOperationAlias.WearSize.Id == sizeAlias.Id || warehouseOperationAlias.WearSize == null && sizeAlias == null) && (warehouseIncomeOperationAlias.Height.Id == heightAlias.Id || warehouseOperationAlias.Height == null && heightAlias == null) && warehouseIncomeOperationAlias.WearPercent == warehouseOperationAlias.WearPercent) .Where(e => e.OperationTime < onTime); if (warehouse == null) { incomeSubQuery.Where(x => x.ReceiptWarehouse != null); } else { incomeSubQuery.Where(x => x.ReceiptWarehouse == warehouse); } if (excludeIds != null && excludeIds.Count > 0) { incomeSubQuery.WhereNot(x => x.Id.IsIn(excludeIds)); } incomeSubQuery.Select(Projections .Sum(Projections .Property(() => warehouseIncomeOperationAlias.Amount))); var projection = Projections.SqlFunction( new SQLFunctionTemplate(NHibernateUtil.Int32, "( IFNULL(?1, 0) - IFNULL(?2, 0) )"), NHibernateUtil.Int32, Projections.SubQuery(incomeSubQuery), Projections.SubQuery(expenseQuery) ); var queryStock = uow.Session.QueryOver(() => warehouseOperationAlias); queryStock.Where(Restrictions.Not(Restrictions.Eq(projection, 0))); queryStock.Where(() => warehouseOperationAlias.Nomenclature.IsIn(nomenclatures.ToArray())); var result = queryStock .JoinAlias(() => warehouseOperationAlias.Nomenclature, () => nomenclatureAlias) .JoinAlias(() => warehouseOperationAlias.WearSize, () => sizeAlias, JoinType.LeftOuterJoin) .JoinAlias(() => warehouseOperationAlias.Height, () => heightAlias, JoinType.LeftOuterJoin) .SelectList(list => list .SelectGroup(() => nomenclatureAlias.Id).WithAlias(() => resultAlias.NomenclatureId) .SelectGroup(() => warehouseOperationAlias.WearSize).WithAlias(() => resultAlias.WearSize) .SelectGroup(() => warehouseOperationAlias.Height).WithAlias(() => resultAlias.Height) .SelectGroup(() => warehouseOperationAlias.WearPercent).WithAlias(() => resultAlias.WearPercent) .Select(projection).WithAlias(() => resultAlias.Amount) ) .TransformUsing(Transformers.AliasToBean <StockBalanceDTO>()) .List <StockBalanceDTO>(); //Проставляем номенклатуру. result.ToList().ForEach(item => item.Nomenclature = nomenclatures.First(n => n.Id == item.NomenclatureId)); return(result); }
/// <summary> /// Initializes a new instance of the <see cref="Service{TEntity}" /> class /// </summary> /// <param name="unitOfWork">The implementation of Unit Of Work pattern <see cref="IUnitOfWork" /></param> public Service(IUnitOfWork unitOfWork) { this.UnitOfWork = unitOfWork; this.repository = this.UnitOfWork.Repository <TEntity>(); }
public EmployeeController() { unitOfWork = new UnitOfWork(); }
public ArticleRepository(IUnitOfWork unit) : base(unit) { }
/// <summary>Constructor.</summary> /// <param name="work"> The work. </param> public MysqlDapperTranslationRepository(IUnitOfWork work) : base(work) { }
public ReportController(IUnitOfWork unitOfWork) { _unitOfWork = unitOfWork; _model = new ReportViewModel(); }
public VehiclesController(IVehicleRepository vehicleRepository, IUserRepository userRepository, IModelRepository modelRepository, IUnitOfWork unitOfWork, IUserAccessor userAccessor) { _vehicleRepository = vehicleRepository; _userRepository = userRepository; _modelRepository = modelRepository; _unitOfWork = unitOfWork; _userAccessor = userAccessor; }
public CarpetSkuSettingsController(ICarpetSkuSettingsService CarpetSkuSettingsService, IUnitOfWork unitOfWork, IExceptionHandlingService exec) { _CarpetSkuSettingsService = CarpetSkuSettingsService; _unitOfWork = unitOfWork; _exception = exec; UserRoles = (List<string>)System.Web.HttpContext.Current.Session["Roles"]; //Log Initialization LogVm.SessionId = 0; LogVm.ControllerName = System.Web.HttpContext.Current.Request.RequestContext.RouteData.GetRequiredString("controller"); LogVm.ActionName = System.Web.HttpContext.Current.Request.RequestContext.RouteData.GetRequiredString("action"); LogVm.User = System.Web.HttpContext.Current.Request.RequestContext.HttpContext.User.Identity.Name; }