public GepirProductInformationDomainService(IMapper<Product, itemDataLineType> gepirProductMapper, IMapper<Company, partyDataLineType> gepirCompanyMapper, RepositoryFactory repositoryFactory, IRepository<Company> companyRepository)
 {
     _repositoryFactory = repositoryFactory;
     _companyRepository = companyRepository;
     _gepirCompanyMapper = gepirCompanyMapper;
     _gepirProductMapper = gepirProductMapper;
 }
Beispiel #2
0
 public Season GetCurrentSeason()
 {
     using (var seasonRepository = new RepositoryFactory().CreateSeasonRepository())
      {
     return seasonRepository.GetCurrentSeason(Game.Id);
      }
 }
        public override bool IsValid(object value)
        {
            var keyPhrase = value as string;

            using (var rf = new RepositoryFactory())
                return rf.SEOKeyword.Find(sq => sq.Phrase == keyPhrase && sq.IntStatus != (int)SEOKeywordStatus.New) == null;
        }
        private void OnAddNewStop(object sender, EventArgs e)
        {
            using (AddNewProductionStopForm form = new AddNewProductionStopForm())
            {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ProductionStop newStop = new ProductionStop(form.ProductionStopName);
                    using (RepositoryFactory factory = new RepositoryFactory())
                    {
                        using (IEntityRepository<ProductionStop> repository = factory.CreateEntityRepository<ProductionStop>())
                        {
                            repository.Save(newStop);
                        }

                        using (var repository = factory.CreateEntityRepository<MachineConfiguration>())
                        {
                            foreach (var machine in repository.LoadAll())
                            {
                                List<ProductionStop> stops = new List<ProductionStop>(machine.AvailableProductionStops);
                                stops.Add(newStop);
                                machine.AvailableProductionStops = stops;

                                repository.Save(machine);
                            }
                        }

                        Load();
                    }
                }
            }
        }
Beispiel #5
0
 public Season Get(string seasonId)
 {
     using (var seasonRepository = new RepositoryFactory().CreateSeasonRepository())
      {
     return seasonRepository.GetOne(seasonId);
      }
 }
Beispiel #6
0
 public DateTime GetNextMatchDay(string seasonId)
 {
     using (var matchRepository = new RepositoryFactory().CreateMatchRepository())
      {
     return matchRepository.GetNextMatchDay(seasonId);
      }
 }
Beispiel #7
0
        public LeagueTable GetBySeasonAndCompetition(string seasonId, string competitionId)
        {
            SeasonCompetition seasonCompetition;
             using (var seasonCompetitionRepository = new RepositoryFactory().CreateSeasonCompetitionRepository())
             {
            seasonCompetition = seasonCompetitionRepository.Find(sc => sc.SeasonId == seasonId && sc.CompetitionId == competitionId).FirstOrDefault();
            if (seasonCompetition == null)
            {
               string message = $"Combination of season '{seasonId}' and competition '{competitionId}' does not exist";
               throw new NotFoundException(message);
            }
             }

             using (var leagueTableRepository = new RepositoryFactory().CreateLeagueTableRepository())
             {
            var leagueTable = leagueTableRepository.GetBySeasonCompetition(seasonCompetition.Id);
            if (leagueTable == null)
            {
               string message = $"No league table exists for season '{seasonId}' and competition '{competitionId}'";
               throw new NotFoundException(message);
            }

            return leagueTable;
             }
        }
        public void Should_Get_Mappings_Specific_To_The_Type_Requested_When_Multiple_Types_Are_Requested()
        {
            //Arrange
            Func<Type, IMappingConfiguration> mappingsDelegate = x =>
            {
                if (x == typeof(Foo)) return fooMapping;
                if (x == typeof(Bar)) return barMapping;
                if (x == typeof(Baz)) return bazMapping;
                if (x == typeof(Qux)) return quxMapping;
                return null;
            };
            var target = new RepositoryFactory(Settings.Default.Connection, mappingsDelegate);

            //Act
            var repository = target.Create<Foo,Bar,Baz,Qux>();
            try
            {
                repository.Context.AsQueryable<Foo>().ToList();
            }
            catch (Exception)
            {
                //Suppress the error from the context. This allows us to test the mappings peice without having to actually map.
            }

            //Assert
            fooMapping.VerifyAllExpectations();
            barMapping.VerifyAllExpectations();
            bazMapping.VerifyAllExpectations();
            quxMapping.VerifyAllExpectations();
        }
        public void ShouldCreateInstanceOfDesiredRepository()
        {
            var fakeDatabaseSession = new Mock<IDatabaseSession>();
            var testRepository = new RepositoryFactory().GetInstanceOf<FakeRepository>(fakeDatabaseSession.Object);

             Assert.That(testRepository, Is.Not.Null);
        }
Beispiel #10
0
        private void GenerateReport()
        {
            System.Windows.Forms.Cursor cursor = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                using (RepositoryFactory factory = new RepositoryFactory())
                {

                    using (IProductionQueryRepository repository = factory.CreateProductionQueryRepository())
                    {
                        ProductionQuery query = new ProductionQuery().AddDateRange(dtPeriodStart.Value,
                                                                                   dtPeriodEnd.Value);
                        if (!string.IsNullOrEmpty(txtProduct.Text))
                            query = query.AddProduct(new ProductNumber(txtProduct.Text));
                        if (!string.IsNullOrEmpty(txtOrder.Text))
                            query = query.AddOrder(new OrderNumber(txtOrder.Text));
                        if (cbMachine.SelectedItem != null)
                            query = query.AddMachine(cbMachine.SelectedItem.ToString());
                        if (cbTeam.SelectedItem != null)
                            query = query.AddTeam((ProductionTeam) cbTeam.SelectedItem);

                        ShowResults(query, repository.LoadProductions(query));
                    }
                }
            } finally
            {
                Cursor.Current = cursor;
            }
        }
Beispiel #11
0
        public static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("nl-NL");
            ConfigurationFactory configurationFactory = new ConfigurationFactory();
            Configuration configuration = configurationFactory.Create();
            if (configuration == null)
            {
                // Newly created.
                return;
            }

            Application.Init();

            if (!authenticate())
            {
                return;
            }

            IDbConnection connection = new ConnectionFactory().createConnection(configuration.ConnectionString);

            IRepositoryFactory repositoryFactory = new RepositoryFactory(connection);

            new MainWindow(repositoryFactory).Show();

            Application.Run();
        }
        public void ShouldCreateInstanceOfDesiredRepositoryWithInjectedConntectionString()
        {
            var fakeDatabaseSession = new Mock<IDatabaseSession>();
            var testRepository = new RepositoryFactory("myconnectionstring").GetInstanceOf<FakeRepository>(fakeDatabaseSession.Object);

            Assert.That(testRepository, Is.Not.Null);
        }
Beispiel #13
0
        public IEnumerable<Team> Create(Game game, int howMany)
        {
            var teams = new List<Team>();

             using (var formationRepository = new RepositoryFactory().CreateFormationRepository())
             {
            var formations = formationRepository.GetAll();
            bool teamGenerationReady = false;
            while (!teamGenerationReady)
            {
               var team = _teamGenerator.Generate();

               // Team names must be unique.
               bool teamExists = teams.Any(t => t.Name == team.Name);
               if (!teamExists)
               {
                  team.Game = game;
                  team.Formation = _listRandomizer.GetItem(formations);
                  teams.Add(team);
               }

               teamGenerationReady = (teams.Count == howMany);
            }
             }

             return teams;
        }
 public void Initialize()
 {
     // No need to mock this repositories as they do not connect to the database but have their data in-memory.
      var repositoryFactory = new RepositoryFactory();
      _positionRepository = repositoryFactory.CreatePositionRepository();
      _formationRepository = repositoryFactory.CreateFormationRepository();
 }
Beispiel #15
0
 public Team GetMyTeam(Game game)
 {
     using (var teamRepository = new RepositoryFactory().CreateTeamRepository())
      {
     return teamRepository.GetTeam(game.CurrentTeamId);
      }
 }
Beispiel #16
0
 public void If_Passed_Context_Is_Null_Must_Throw_Exception()
 {
     //
     // Arrange, Act, Assert
     //
     var repositoryFactory = new RepositoryFactory(null);
 }
Beispiel #17
0
 public IEnumerable<Match> GetByRound(Round round)
 {
     using (var matchRepository = new RepositoryFactory().CreateMatchRepository())
      {
     return matchRepository.GetByRound(round.Id);
      }
 }
Beispiel #18
0
        private void btnUpdateBaseCost_Click(object sender, EventArgs e)
        {
            using (RepositoryFactory factory = new RepositoryFactory())
            {
                using (
                    IEntityRepository<MachineConfiguration> repository =
                        factory.CreateEntityRepository<MachineConfiguration>())
                {
                    List<MachineConfiguration> machines = new List<MachineConfiguration>(repository.LoadAll());

                    using (BaseCostForm form = new BaseCostForm())
                    {
                        form.Machines = machines;
                        if (form.ShowDialog(this) == DialogResult.OK)
                        {
                            foreach (var machine in machines)
                            {
                                repository.Save(machine);
                            }
                            LoadData(machines);
                        }
                    }
                }

            }
        }
Beispiel #19
0
 public User GetUser(string username, string password)
 {
     using (var userRepository = new RepositoryFactory().CreateUserRepository())
      {
     return userRepository.GetByUsernameAndPassword(username, password);
      }
 }
 public void should_create_repository()
 {
     var mockFactory = new FakeMongoDatabaseFactory();
     var sut = new RepositoryFactory(mockFactory);
     var result = sut.Create<User>(new RepositoryOptions("lorem", "ipsum", "users"));
     result.Should().NotBeNull();
     result.CollectionName.ShouldBeEquivalentTo("users");
 }
Beispiel #21
0
 public IEnumerable<Match> GetBySeasonAndDate(string seasonId, DateTime matchDay)
 {
     using (var matchRepository = new RepositoryFactory().CreateMatchRepository())
      {
     var matches = matchRepository.GetBySeasonAndMatchDay(seasonId, matchDay);
     return matches;
      }
 }
Beispiel #22
0
        public void Factory_Should_Be_Cached()
        {
            var dataProvider = TestEnvironment.GetSqlServerDataProvider();
            var factory = new RepositoryFactory(dataProvider);
            var cachedFactory = RepositoryFactory.GetRepositoryFactoryFor(dataProvider);

            Assert.AreEqual(factory, cachedFactory);
        }
        static RepositoryRegistry()
        {
            RepositoryFactoryBuilder b = new RepositoryFactoryBuilder();

            var file = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "repository.config"));

            factory = b.Build(file);
        }
Beispiel #24
0
 public IEnumerable<Team> GetBySeasonCompetition(SeasonCompetition seasonCompetition)
 {
     using (var teamRepository = new RepositoryFactory().CreateTeamRepository())
      {
     var teams = teamRepository.GetTeamsBySeasonCompetition(seasonCompetition);
     return teams;
      }
 }
Beispiel #25
0
 public void Can_Get_Customers_From_Database()
 {
     using (var repo = new RepositoryFactory().Create())
     {
         var customers = repo.All<Customer>().ToList();
         CollectionAssert.IsNotEmpty(customers);
     }
 }
Beispiel #26
0
 public IEnumerable<Match> GetBySeasonAndTeam(string seasonId, string teamId)
 {
     using (var matchRepository = new RepositoryFactory().CreateMatchRepository())
      {
     var matches = matchRepository.GetBySeasonAndTeam(seasonId, teamId).OrderBy(match => match.Date);
     return matches;
      }
 }
Beispiel #27
0
 public IEnumerable<Line> GetAll()
 {
     using (var lineRepository = new RepositoryFactory().CreateLineRepository())
      {
     var lines = lineRepository.GetAll();
     return lines;
      }
 }
Beispiel #28
0
        public void Factory_Should_Return_Repository()
        {
            var factory = new RepositoryFactory(TestEnvironment.GetSqlServerDataProvider());

            var repository = factory.GetRepository<Product>();

            Assert.IsNotNull(repository);
        }
        public GrassrootsMembershipService()
        {
            var userProfileRepositoryFactory = new RepositoryFactory<IUserProfileRepository>();
            userProfileRepository = userProfileRepositoryFactory.GetRepository();

            var userRepositoryFactory = new RepositoryFactory<IUserRepository>();
            userRepository = userRepositoryFactory.GetRepository();
        }
Beispiel #30
0
 /// <summary>
 /// Gets all teams of the game.
 /// </summary>
 public IEnumerable<Team> GetAll(Game game)
 {
     using (var teamRepository = new RepositoryFactory().CreateTeamRepository())
      {
     var teams = teamRepository.GetTeamsByGame(game.Id);
     return teams;
      }
 }
 public MemberTypeService(RepositoryFactory repositoryFactory)
     : this(new PetaPocoUnitOfWorkProvider(), repositoryFactory)
 {
 }
Beispiel #32
0
        static RepositoryRegistry()
        {
            RepositoryFactoryBuilder builder = new RepositoryFactoryBuilder();

            factory = builder.Build(new System.IO.FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "repositories.config")));
        }
Beispiel #33
0
 public BookCopyService(RepositoryFactory rFactory)
 {
     this.bookCopyRepository = rFactory.CreateBookCopyRepository();
 }
 public DataTypeService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
     : base(provider, repositoryFactory, logger, eventMessagesFactory)
 {
 }
 //private
 public MemberExtendedService(IScopeUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IMemberGroupService memberGroupService, IDataTypeService dataTypeService)
     : base(provider, repositoryFactory, logger, eventMessagesFactory, memberGroupService, dataTypeService)
 {
     UowProvider = provider;
 }
 public PersonODataContext(RepositoryFactory repositoryFactory)
     : base(repositoryFactory)
 {
 }
Beispiel #37
0
 public TRepository Build <TRepository>()
 {
     return(RepositoryFactory.Create <TRepository>(RepositorySource));
 }
        //Function to delete SettingName
        protected virtual OperationResult _DeleteBySettingName(string settingName)
        {
            //Create repository based on its Key name : 'Keywords.DeleteGlobalApplicationSetting'.
            //The repository factory will create the repository object based on its key.
            IDeleteGlobalApplicationSettingRepository repository = (IDeleteGlobalApplicationSettingRepository)RepositoryFactory.Create(Keywords.DeleteGlobalApplicationSetting);

            try
            {
                //Execute DeleteBySettingName
                repository.DeleteBySettingName(settingName);
                return(new OperationResult(true, null));
            }
            catch (Exception e)
            {
                return(new OperationResult(false, e));
            }
        }
Beispiel #39
0
        /// <inheritdoc />
        public override IPackage Load(ConfigBucketBase config, Type expectedClass)
        {
            if (!typeof(IPackageRoot).IsAssignableFrom(expectedClass))
            {
                throw new ArgumentException($"The type must implement \"{nameof(IPackageRoot)}\".");
            }

            if (string.IsNullOrEmpty(config.Name))
            {
                throw new RuntimeException("The \"name\" property not allowed to be empty.");
            }

            if (string.IsNullOrEmpty(config.Version))
            {
                throw new RuntimeException("The \"version\" property not allowed to be empty.");
            }

            IPackage realPackage, package;

            realPackage = package = base.Load(config, expectedClass);

            if (realPackage is PackageAlias packageAlias)
            {
                realPackage = packageAlias.GetAliasOf();
            }

            if (!(realPackage is PackageRoot packageRoot))
            {
                throw new UnexpectedException($"The package type does not meet expectations and should be: {nameof(PackageRoot)}");
            }

            if (config.MinimumStability != null)
            {
                packageRoot.SetMinimunStability(config.MinimumStability);
            }

            packageRoot.SetPlatforms(config.Platforms);

            var aliases        = new List <ConfigAlias>();
            var stabilityFlags = new Dictionary <string, Stabilities>();
            var references     = new Dictionary <string, string>();
            var required       = new HashSet <string>();

            void ExtractRequire(Link[] links)
            {
                var requires = new Dictionary <string, string>();

                foreach (var link in links)
                {
                    required.Add(link.GetTarget().ToLower());
                    requires[link.GetTarget()] = link.GetConstraint().GetPrettyString();
                }

                ExtractAliases(requires, aliases);
                ExtractStabilityFlags(requires, packageRoot.GetMinimumStability(), stabilityFlags);
                ExtractReferences(requires, references);
            }

            ExtractRequire(realPackage.GetRequires());
            ExtractRequire(realPackage.GetRequiresDev());

            if (required.Contains(config.Name.ToLower()))
            {
                throw new RuntimeException($"Root package \"{config.Name}\" cannot require itself in its bucket.json{Environment.NewLine}Did you accidentally name your root package after an external package?");
            }

            packageRoot.SetAliases(aliases.ToArray());
            packageRoot.SetStabilityFlags(stabilityFlags);
            packageRoot.SetReferences(references);
            packageRoot.SetPreferStable(config.PreferStable);

            var repositories = RepositoryFactory.CreateDefaultRepository(io, this.config, manager);

            foreach (var repository in repositories)
            {
                manager.AddRepository(repository);
            }

            packageRoot.SetRepositories(this.config.GetRepositories());

            return(package);
        }
Beispiel #40
0
        // key goal is to create background tracer that is independent of request.
        public static void PerformBackgroundDeployment(DeploymentInfo deployInfo, IEnvironment environment, IDeploymentSettingsManager settings, TraceLevel traceLevel, Uri uri, IDisposable tempDeployment, IAutoSwapHandler autoSwapHandler, ChangeSet tempChangeSet)
        {
            var tracer       = traceLevel <= TraceLevel.Off ? NullTracer.Instance : new XmlTracer(environment.TracePath, traceLevel);
            var traceFactory = new TracerFactory(() => tracer);

            var backgroundTrace = tracer.Step(XmlTracer.BackgroundTrace, new Dictionary <string, string>
            {
                { "url", uri.AbsolutePath },
                { "method", "POST" }
            });

            Task.Run(() =>
            {
                try
                {
                    // lock related
                    string lockPath           = Path.Combine(environment.SiteRootPath, Constants.LockPath);
                    string deploymentLockPath = Path.Combine(lockPath, Constants.DeploymentLockFile);
                    string statusLockPath     = Path.Combine(lockPath, Constants.StatusLockFile);
                    string hooksLockPath      = Path.Combine(lockPath, Constants.HooksLockFile);
                    var statusLock            = new LockFile(statusLockPath, traceFactory);
                    var hooksLock             = new LockFile(hooksLockPath, traceFactory);
                    var deploymentLock        = new DeploymentLockFile(deploymentLockPath, traceFactory);

                    var analytics = new Analytics(settings, new ServerConfiguration(), traceFactory);
                    var deploymentStatusManager = new DeploymentStatusManager(environment, analytics, statusLock);
                    var repositoryFactory       = new RepositoryFactory(environment, settings, traceFactory);
                    var siteBuilderFactory      = new SiteBuilderFactory(new BuildPropertyProvider(), environment);
                    var webHooksManager         = new WebHooksManager(tracer, environment, hooksLock);
                    var functionManager         = new FunctionManager(environment, traceFactory);
                    var deploymentManager       = new DeploymentManager(siteBuilderFactory, environment, traceFactory, analytics, settings, deploymentStatusManager, deploymentLock, NullLogger.Instance, webHooksManager, functionManager);
                    var fetchHandler            = new FetchHandler(tracer, deploymentManager, settings, deploymentStatusManager, deploymentLock, environment, null, repositoryFactory, autoSwapHandler);

                    try
                    {
                        // Perform deployment
                        deploymentLock.LockOperation(() =>
                        {
                            fetchHandler.PerformDeployment(deployInfo, tempDeployment, tempChangeSet).Wait();
                        }, "Performing continuous deployment", TimeSpan.Zero);
                    }
                    catch (LockOperationException)
                    {
                        if (tempDeployment != null)
                        {
                            tempDeployment.Dispose();
                        }

                        using (tracer.Step("Update pending deployment marker file"))
                        {
                            // REVIEW: This makes the assumption that the repository url is the same.
                            // If it isn't the result would be buggy either way.
                            FileSystemHelpers.SetLastWriteTimeUtc(fetchHandler._markerFilePath, DateTime.UtcNow);
                        }
                    }
                }
                catch (Exception ex)
                {
                    tracer.TraceError(ex);
                }
                finally
                {
                    backgroundTrace.Dispose();
                }
            });
        }
 public RepositoryOperationsManager(RepositoryFactory repositoryFactory)
 {
     _repository = repositoryFactory.GetRepository();
 }
 public HomeController(
     RepositoryFactory repositoryFactory,
     CommonFactory commonFactory)
     : base(repositoryFactory, commonFactory)
 {
 }
        /// <summary>
        /// 添加授权
        /// </summary>
        /// <param name="objectType">权限分类-1角色2用户</param>
        /// <param name="objectId">对象Id</param>
        /// <param name="moduleIds">功能Id</param>
        /// <param name="moduleButtonIds">按钮Id</param>
        /// <param name="moduleColumnIds">视图Id</param>
        public void SaveAuthorize(int objectType, string objectId, string[] moduleIds, string[] moduleButtonIds, string[] moduleColumnIds, string[] moduleForms)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                db.Delete <AuthorizeEntity>(t => t.F_ObjectId == objectId);

                #region 功能
                foreach (string item in moduleIds)
                {
                    AuthorizeEntity authorizeEntity = new AuthorizeEntity();
                    authorizeEntity.Create();
                    authorizeEntity.F_ObjectType = objectType;
                    authorizeEntity.F_ObjectId   = objectId;
                    authorizeEntity.F_ItemType   = 1;
                    authorizeEntity.F_ItemId     = item;
                    db.Insert(authorizeEntity);
                }
                #endregion

                #region  钮
                foreach (string item in moduleButtonIds)
                {
                    AuthorizeEntity authorizeEntity = new AuthorizeEntity();
                    authorizeEntity.Create();
                    authorizeEntity.F_ObjectType = objectType;
                    authorizeEntity.F_ObjectId   = objectId;
                    authorizeEntity.F_ItemType   = 2;
                    authorizeEntity.F_ItemId     = item;
                    db.Insert(authorizeEntity);
                }
                #endregion

                #region 视图
                foreach (string item in moduleColumnIds)
                {
                    AuthorizeEntity authorizeEntity = new AuthorizeEntity();
                    authorizeEntity.Create();
                    authorizeEntity.F_ObjectType = objectType;
                    authorizeEntity.F_ObjectId   = objectId;
                    authorizeEntity.F_ItemType   = 3;
                    authorizeEntity.F_ItemId     = item;
                    db.Insert(authorizeEntity);
                }
                #endregion

                #region 表单
                foreach (string item in moduleForms)
                {
                    AuthorizeEntity authorizeEntity = new AuthorizeEntity();
                    authorizeEntity.Create();
                    authorizeEntity.F_ObjectType = objectType;
                    authorizeEntity.F_ObjectId   = objectId;
                    authorizeEntity.F_ItemType   = 4;
                    authorizeEntity.F_ItemId     = item;
                    db.Insert(authorizeEntity);
                }
                #endregion

                db.Commit();
            }
            catch (Exception ex)
            {
                db.Rollback();
                if (ex is ExceptionEx)
                {
                    throw;
                }
                else
                {
                    throw ExceptionEx.ThrowServiceException(ex);
                }
            }
        }
Beispiel #44
0
 public AuthorService(RepositoryFactory repoFactory)
 {
     //Laddar in..
     _authorRepository = repoFactory.GetAuthorRepository();
 }
        public bool UpdateCustomerContactDetails(int clientId, CustomerContact custContactDetails)
        {
            IContactsRepository contactRepo = RepositoryFactory.CreateContactsRepository();

            return(contactRepo.UpdateCustomerContactDetails(clientId, custContactDetails));
        }
Beispiel #46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StoreSettingService"/> class.
 /// </summary>
 /// <param name="repositoryFactory">
 /// The repository factory.
 /// </param>
 public StoreSettingService(RepositoryFactory repositoryFactory)
     : this(new PetaPocoUnitOfWorkProvider(), repositoryFactory)
 {
 }
Beispiel #47
0
 public static RetentionDetailsTabPresenter Create(IRetentionDetailsTabView view)
 {
     return(new RetentionDetailsTabPresenter(view, RepositoryFactory.CreateRetentionRepository()));
 }
 private IPayrollRepository GetRepository()
 {
     return(RepositoryFactory.GetRepository());
 }
 public SSPStaffService()
 {
     _rep         = RepositoryFactory.SSPStaffRepository();
     _userSession = ServiceFactory.UserSession();
     _webContext  = ServiceFactory.WebContext();
 }
        public Guid SalvarAgenda(bool disponivelNoPortal, string clienteId, string treinamentoId, string local, string cidade, DateTime dataInicial, DateTime dataFinal, int numeroDeVagas, string instrutorId, string horaInicial, string horaFinal, string organizacao)
        {
            Guid agendaId = new Guid();

            try
            {
                if (treinamentoId == string.Empty)
                {
                    throw new Exception("O parametro 'treinamentoId' está em branco ou nulo");
                }
                if (local == string.Empty)
                {
                    throw new Exception("O parametro 'local' está em branco ou nulo");
                }
                if (cidade == string.Empty)
                {
                    throw new Exception("O parametro 'cidade' está em branco ou nulo");
                }
                if (instrutorId == string.Empty)
                {
                    throw new Exception("O parametro 'instrutorId' está em branco ou nulo");
                }
                if (horaInicial == string.Empty)
                {
                    throw new Exception("O parametro 'horaInicial' está em branco ou nulo");
                }
                if (horaFinal == string.Empty)
                {
                    throw new Exception("O parametro 'horaFinal'está em branco ou nulo");
                }

                var org    = new Organizacao(organizacao);
                var agenda = new Agenda(org);
                var cid    = new Cidade(org);

                if (cidade != null)
                {
                    agenda.Cidade   = cid.PesquisarPor(new Guid(cidade));
                    agenda.Regional = agenda.Cidade.Regional;
                }

                agenda.Fim                = dataFinal;
                agenda.Inicio             = dataInicial;
                agenda.DisponivelnoPortal = disponivelNoPortal;
                agenda.Instrutor          = new Usuario(org)
                {
                    Id = new Guid(instrutorId)
                };
                //agenda.Proprietario = agenda.Instrutor;
                agenda.Local       = local;
                agenda.Treinamento = new Treinamento(org)
                {
                    Id = new Guid(treinamentoId)
                };
                agenda.Vagas       = numeroDeVagas;
                agenda.HoraInicial = new TimeSpan(int.Parse(horaInicial.Split(':')[0]), int.Parse(horaInicial.Split(':')[1]), 00);
                agenda.HoraFinal   = new TimeSpan(int.Parse(horaFinal.Split(':')[0]), int.Parse(horaFinal.Split(':')[1]), 00);
                if (!string.IsNullOrEmpty(clienteId))
                {
                    agenda.Cliente = new Cliente(org)
                    {
                        Id = new Guid(clienteId)
                    }
                }
                ;

                var agendaRepository = RepositoryFactory.GetRepository <IAgendaRepository>();
                agendaRepository.Organizacao = org;

                agendaId = agendaRepository.Create(agenda);
            }
            catch (SoapException soapEx)
            {
                EventLog.WriteEntry("CRM Salvar Agenda", string.Format("SOAPEXCEPTION: <strong>{0}</strong><br />{1}", soapEx.Message + soapEx.Detail.InnerXml, soapEx.Detail.InnerText));
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("CRM Salvar Agenda", string.Format("<strong>{0}</strong><br />{1}", ex.Message, ex.StackTrace));
            }

            return(agendaId);
        }
Beispiel #51
0
 public ErrorInfoService()
     : this(RepositoryFactory.Create <ErrorInfo>())
 {
 }
Beispiel #52
0
 public RepositoryInstance(ISharpRepositoryConfiguration configuration)
     : base(() => (IRepository <T>)RepositoryFactory.GetInstance(typeof(T), configuration, null))
 {
 }
        public bool InsertCliContactInfoDetailsForValidation(int clientId, ClientContact cliInfoDetails)
        {
            IContactsRepository contactRepo = RepositoryFactory.CreateContactsRepository();

            return(contactRepo.InsertClientContactInfoDetailsForValidation(clientId, cliInfoDetails));
        }
Beispiel #54
0
        /// <summary>
        /// Builds the various services
        /// </summary>
        /// <param name="dbDatabaseUnitOfWorkProvider">
        /// Database unit of work provider used by the various services
        /// </param>
        /// <param name="repositoryFactory">
        /// The <see cref="RepositoryFactory"/>
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="eventMessagesFactory">
        /// The event Messages Factory.
        /// </param>
        private void BuildServiceContext(IDatabaseUnitOfWorkProvider dbDatabaseUnitOfWorkProvider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
        {
            if (_anonymousCustomerService == null)
            {
                _anonymousCustomerService = new Lazy <IAnonymousCustomerService>(() => new AnonymousCustomerService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_appliedPaymentService == null)
            {
                _appliedPaymentService = new Lazy <IAppliedPaymentService>(() => new AppliedPaymentService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_auditLogService == null)
            {
                _auditLogService = new Lazy <IAuditLogService>(() => new AuditLogService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }


            if (_noteService == null)
            {
                _noteService = new Lazy <INoteService>(() => new NoteService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }


            if (_customerAddressService == null)
            {
                _customerAddressService = new Lazy <ICustomerAddressService>(() => new CustomerAddressService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_customerService == null)
            {
                _customerService = new Lazy <ICustomerService>(() => new CustomerService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _anonymousCustomerService.Value, _customerAddressService.Value, _invoiceService.Value, _paymentService.Value));
            }

            if (_detachedContentTypeService == null)
            {
                _detachedContentTypeService = new Lazy <IDetachedContentTypeService>(() => new DetachedContentTypeService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_digitalMediaService == null)
            {
                _digitalMediaService = new Lazy <IDigitalMediaService>(() => new DigitalMediaService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_entityCollectionService == null)
            {
                _entityCollectionService = new Lazy <IEntityCollectionService>(() => new EntityCollectionService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_itemCacheService == null)
            {
                _itemCacheService = new Lazy <IItemCacheService>(() => new ItemCacheService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_notificationMethodService == null)
            {
                _notificationMethodService = new Lazy <INotificationMethodService>(() => new NotificationMethodService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_notificationMessageService == null)
            {
                _notificationMessageService = new Lazy <INotificationMessageService>(() => new NotificationMessageService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_offerSettingsService == null)
            {
                _offerSettingsService = new Lazy <IOfferSettingsService>(() => new OfferSettingsService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_offerRedeemedService == null)
            {
                _offerRedeemedService = new Lazy <IOfferRedeemedService>(() => new OfferRedeemedService(DatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_paymentService == null)
            {
                _paymentService = new Lazy <IPaymentService>(() => new PaymentService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _appliedPaymentService.Value));
            }

            if (_paymentMethodService == null)
            {
                _paymentMethodService = new Lazy <IPaymentMethodService>(() => new PaymentMethodService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_productVariantService == null)
            {
                _productVariantService = new Lazy <IProductVariantService>(() => new ProductVariantService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_productService == null)
            {
                _productService = new Lazy <IProductService>(() => new ProductService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _productVariantService.Value));
            }

            if (_storeSettingsService == null)
            {
                _storeSettingsService = new Lazy <IStoreSettingService>(() => new StoreSettingService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_shipCountryService == null)
            {
                _shipCountryService = new Lazy <IShipCountryService>(() => new ShipCountryService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _storeSettingsService.Value));
            }

            if (_shipMethodService == null)
            {
                _shipMethodService = new Lazy <IShipMethodService>(() => new ShipMethodService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_shipRateTierService == null)
            {
                _shipRateTierService = new Lazy <IShipRateTierService>(() => new ShipRateTierService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }

            if (_shipmentService == null)
            {
                _shipmentService = new Lazy <IShipmentService>(() => new ShipmentService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _storeSettingsService.Value));
            }

            if (_orderService == null)
            {
                _orderService = new Lazy <IOrderService>(() => new OrderService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _storeSettingsService.Value, _shipmentService.Value));
            }

            if (_invoiceService == null)
            {
                _invoiceService = new Lazy <IInvoiceService>(() => new InvoiceService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _appliedPaymentService.Value, _orderService.Value, _storeSettingsService.Value));
            }

            if (_countryTaxRateService == null)
            {
                _countryTaxRateService = new Lazy <ITaxMethodService>(() => new TaxMethodService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _storeSettingsService.Value));
            }

            if (_gatewayProviderService == null)
            {
                _gatewayProviderService = new Lazy <IGatewayProviderService>(() => new GatewayProviderService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _shipMethodService.Value, _shipRateTierService.Value, _shipCountryService.Value, _invoiceService.Value, _orderService.Value, _countryTaxRateService.Value, _paymentService.Value, _paymentMethodService.Value, _notificationMethodService.Value, _notificationMessageService.Value, _warehouseService.Value));
            }

            if (_warehouseCatalogService == null)
            {
                _warehouseCatalogService = new Lazy <IWarehouseCatalogService>(() => new WarehouseCatalogService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _productVariantService.Value));
            }

            if (_warehouseService == null)
            {
                _warehouseService = new Lazy <IWarehouseService>(() => new WarehouseService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory, _warehouseCatalogService.Value));
            }

            if (_notificationMessageService == null)
            {
                _notificationMessageService = new Lazy <INotificationMessageService>(() => new NotificationMessageService(dbDatabaseUnitOfWorkProvider, repositoryFactory, logger, eventMessagesFactory));
            }
        }
Beispiel #55
0
 public MonthlyPlanActivity()
 {
     timer.Start();
     repository = RepositoryFactory.GetSingleton().GetRepository();
 }
Beispiel #56
0
 public RepositoryInstance(string repositoryName)
     : base(() => (IRepository <T>)RepositoryFactory.GetInstance(typeof(T), repositoryName))
 {
 }
Beispiel #57
0
        /// <summary>
        /// 获取 缴费查询 列表
        /// </summary>
        /// <param name="pagination"></param>
        /// <param name="property_id"></param>
        /// <param name="queryJson"></param>
        /// <returns></returns>
        public IEnumerable <OtherincomeListEntity> GetList(Pagination pagination, string property_id, string queryJson)
        {
            var queryParam = queryJson.ToJObject();

            #region 老系统逻辑 Update:2017/9/28 Jerry.Li

            string fullowner    = "(select top 1 building_name from wy_building where building_id=(select top 1 building_id from wy_room where room_id=wy_feereceive.room_id)) + '/' + (select top 1 room_name from wy_room where room_id=wy_feereceive.room_id) + '(' +(select owner_name from wy_owner where owner_id=wy_feereceive.owner_id) + ')' ";
            string rentcustomer = "(select top 1 customername from wy_rentcontract where contractid=wy_feereceive.rentcontract_id)";
            string sql_rec      = "select receive_id AS id,'0' as feetype,'customer'=case when rentcontract_id is null or rentcontract_id='' then " + fullowner + " else " + rentcustomer + " end, receive_date,userid,fee_money,ticket_id,(select ticket_code from wy_feeticket where ticket_id=wy_feereceive.ticket_id) as ticket_code,'' notes from wy_feereceive where property_id='" + property_id + "'";

            string sql_other = "select incomeid AS id,'1' as feetype,customer,feedate as receive_date,operateuser as userid,feemoney as feemoney,ticketid as ticket_id,(select ticket_code from wy_feeticket where ticket_id=a.ticketid) as ticket_code,(SELECT [subject]+',' FROM wy_otherincomeitem WHERE incomeid = a.incomeid AND [subject] != ''  FOR XML PATH('')) AS notes from wy_otherincome a where property_id='" + property_id + "'";

            if (!queryParam["feeitem_id"].IsEmpty())
            {
                string feeitem_id = queryParam["feeitem_id"].ToString();
                sql_rec   = sql_rec + " and wy_feereceive.receive_id in (select distinct receive_id from wy_feecheck inner join wy_feeincome on wy_feecheck.income_id=wy_feeincome.income_id where wy_feeincome.feeitem_id='" + feeitem_id + "')";
                sql_other = sql_other + " and incomeid in(select distinct incomeid from wy_otherincomeitem where feeitem_id='" + feeitem_id + "')";
            }

            if (!queryParam["userid"].IsEmpty())
            {
                string userid = queryParam["userid"].ToString();
                sql_rec   = sql_rec + " and wy_feereceive.userid='" + userid + "'";
                sql_other = sql_other + " and operateuser='******'";
            }

            if (!queryParam["ticket_id"].IsEmpty())
            {
                string ticket_id = queryParam["ticket_id"].ToString();
                if (ticket_id != "0")
                {
                    sql_rec   = sql_rec + " and  ticket_id='" + ticket_id + "'";
                    sql_other = sql_other + " and  ticketid='" + ticket_id + "'";
                }
            }

            if (!queryParam["state"].IsEmpty())
            {
                string state = queryParam["state"].ToString();
                sql_rec   = sql_rec + " and receive_date>='" + state + "'";
                sql_other = sql_other + " and feedate>='" + state + "'";
            }

            if (!queryParam["end"].IsEmpty())
            {
                string end = queryParam["end"].ToString();
                sql_rec   = sql_rec + " and receive_date<='" + end + "'";
                sql_other = sql_other + " and feedate<='" + end + "'";
            }

            if (!queryParam["contractid"].IsEmpty())
            {
                string contractid = queryParam["contractid"].ToString();
                sql_rec = sql_rec + " and rentcontract_id='" + contractid + "'";
            }

            if (!queryParam["owner_id"].IsEmpty())
            {
                string owner_id = queryParam["owner_id"].ToString();
                sql_rec = sql_rec + " and owner_id='" + owner_id + "'";
            }

            string sqls = "";
            if (queryParam["owner_id"].IsEmpty() && queryParam["contractid"].IsEmpty())
            {
                sqls = sql_rec + " union " + sql_other;
                sqls = string.Format("SELECT * FROM ({0}) t ORDER BY {1} {2}", sqls, pagination.sidx, pagination.sord);
            }
            else
            {
                sqls = string.Format("{0} ORDER BY {1} {2}", sql_rec, pagination.sidx, pagination.sord);
            }

            #endregion

            RepositoryFactory <OtherincomeListEntity> repository = new RepositoryFactory <OtherincomeListEntity>();

            return(repository.BaseRepository().FindList(sqls));
        }
Beispiel #58
0
        public IEnumerable <Customer> GetAll()
        {
            var repo = new RepositoryFactory().CreateRepository <Customer>();

            return(repo.GetAll());
        }
Beispiel #59
0
 protected ScopeRepositoryService(IScopeUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory)
     : base(provider, repositoryFactory, logger, eventMessagesFactory)
 {
     UowProvider = provider;
 }
Beispiel #60
0
 static TaskService()
 {
     _repository = RepositoryFactory.GetRepository <ITaskRepository, long, Task>();
 }