static public void testCode() { using (EFoefContext ctx = new EFoefContext()) { TeamRepository teamRepo = new TeamRepository(ctx); SpelerRepository spelerRepo = new SpelerRepository(ctx); TransferRepository TransferRepo = new TransferRepository(ctx); // Voeg Nieuwe Speler toe Speler speler = new Speler("Nicolas", 13, 1000, teamRepo.SelecteerTeam(3)); spelerRepo.VoegSpelerToe(speler); // Voeg Nieuwe Team toe Team team = new Team(69, "team naam", "bijnaam", "trainer"); teamRepo.VoegTeamToe(team); // voeg Nieuwe transfertoe Transfer transfer = new Transfer(spelerRepo.SelecteerSpeler(5), 55555.55, teamRepo.SelecteerTeam(35), teamRepo.SelecteerTeam(3)); TransferRepo.VoegTransferToe(transfer); // update speler Speler spelerUpdate = spelerRepo.SelecteerSpeler(4); spelerUpdate.Naam = "Nieuwe naam"; spelerRepo.UpdateSpeler(spelerUpdate); // update team Team teamUpdate = teamRepo.SelecteerTeam(35); teamUpdate.Naam = "Nieuwe naam"; teamRepo.UpdateTeam(teamUpdate); ctx.SaveChanges(); } }
public IHttpActionResult list() { TransferRepository TransferRepository = new TransferRepository(); List <eventList> list = TransferRepository.GetList(); return(Ok(list)); }
public UnitOfWork(RestaurantContext context) { _context = context; Adjustments = new AdjustmentRepository(_context); AdjustmentsItems = new AdjustmentItemRepository(_context); Branches = new BranchRepository(_context); Categories = new CategoryRepository(_context); Customers = new CustomerRepository(_context); Deliveries = new DeliveryRepository(_context); DeliveryItems = new DeliveryItemRepository(_context); Divisions = new DivisionRepository(_context); Expirations = new ExpirationRepository(_context); Groups = new GroupRepository(_context); Stocks = new InventoryItemRepository(_context); Locations = new LocationRepository(_context); Units = new MeasurementUnitRepository(_context); Productions = new ProductionRepository(_context); Ingredients = new ProductionItemRepository(_context); Products = new ProductRepository(_context); Purchases = new PurchaseRepository(_context); PurchaseItems = new PurchaseItemRepository(_context); PurchaseOrders = new PurchaseOrderRepository(_context); PurchaseOrderItems = new PurchaseOrderItemRepository(_context); SalesInvoices = new SalesInvoiceRepository(_context); SalesInvoiceItems = new SalesInvoiceItemRepository(_context); Suppliers = new SupplierRepository(_context); Transfers = new TransferRepository(_context); TransferItems = new TransferItemRepository(_context); Wastages = new WastageRepository(_context); WastageItems = new WastageItemRepository(_context); Workers = new WorkerRepository(_context); ItemLocation = new ItemLocationRepository(_context); StockHistory = new StockHistoryRepository(_context); Currencies = new CurrencyRepository(_context); }
public StatsController(TransactionsRepository transactionsRepository, TransferRepository transferRepository, OutcomeTransactionRepository outcomeRepository, TradeRepository tradeRepository, UsersInfoRepository usersInfoRepository, UserRepository userRepository) { _transactionsRepository = transactionsRepository; _transferRepository = transferRepository; _outcomeRepository = outcomeRepository; _tradeRepository = tradeRepository; _usersInfoRepository = usersInfoRepository; _userRepository = userRepository; }
static public void InitialiseerDatabank(string path) { Dictionary <string, Team> teamrDict = new Dictionary <string, Team>(); HashSet <Speler> spelerSet = new HashSet <Speler>(); using (StreamReader r = new StreamReader(path)) { string line; string naam; int nummer; string team; int waarde; int stamnr; string trainer; string bijnaam; while ((line = r.ReadLine()) != null) { if (!(line == "naam,nummer,club,waarde,stamnr,trainer,bijnaam")) { string[] ss = line.Split(",").Select(x => x.Trim()).ToArray(); naam = ss[0]; nummer = int.Parse(ss[1]); team = ss[2]; waarde = int.Parse(ss[3].Replace(" ", "")); stamnr = int.Parse(ss[4]); trainer = ss[5]; bijnaam = ss[6]; if (!teamrDict.ContainsKey(team)) { teamrDict.Add(team, new Team(stamnr, team, bijnaam, trainer)); } spelerSet.Add(new Speler(naam, nummer, (double)waarde, teamrDict[team])); } } } using (EFoefContext ctx = new EFoefContext()) { TeamRepository teamRepo = new TeamRepository(ctx); SpelerRepository spelerRepo = new SpelerRepository(ctx); TransferRepository TransferRepo = new TransferRepository(ctx); foreach (Team item in teamrDict.Values) { teamRepo.VoegTeamToe(item); } foreach (Speler item in spelerSet) { spelerRepo.VoegSpelerToe(item); } ctx.SaveChanges(); } Console.WriteLine("Einde"); }
public TransferApp(TransferEntity transfer) { errors = IsValid(transfer); if (errors.Count == 0) { TransferRepository _dados = new TransferRepository(); var retorno = _dados.RealizaTransferencia(transfer); if (!retorno) { errors.Add("Ocorreu um erro ao gravar as informações"); } } }
private void RequestRepository(TransferRepository repository, Reporter reporter) { var repozipFile = RepoEnv.TempFiles.CreateFile(); UpdateLock.EnterUpgradeableReadLock(); try { Log.Info("Incomming Transfer Request for Repository {Name}", repository.RepoName); reporter.Send(RepositoryMessages.GetRepo); var data = _repos.AsQueryable().FirstOrDefault(r => r.RepoName == repository.RepoName); if (data == null) { reporter.Compled(OperationResult.Failure(RepoErrorCodes.DatabaseNoRepoFound)); return; } var commitInfo = _gitHubClient.Repository.Commit.GetSha1(data.RepoId, "HEAD").Result; var repozip = repozipFile.Stream; if (!(commitInfo != data.LastUpdate && UpdateRepository(data, reporter, repository, commitInfo, repozip))) { reporter.Send(RepositoryMessages.GetRepositoryFromDatabase); Log.Info("Downloading Repository {Name} From Server", repository.RepoName); repozip.SetLength(0); _bucket.DownloadToStream(ObjectId.Parse(data.FileName), repozip); } //_reporter = reporter; //repozip.Seek(0, SeekOrigin.Begin); //Timers.StartSingleTimer(_reporter, new TransferFailed(string.Empty, FailReason.Timeout, data.RepoName), TimeSpan.FromMinutes(10)); var request = DataTransferRequest.FromStream(repository.OperationId, repozip, repository.Manager ?? throw new ArgumentNullException("FileManager"), commitInfo); request.SendCompletionBack = true; _dataTransfer.Request(request); _currentTransfers[request.OperationId] = repozipFile; reporter.Compled(OperationResult.Success(new FileTransactionId(request.OperationId))); } finally { UpdateLock.ExitUpgradeableReadLock(); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }; IJobManager jobManager = new JobManager(); IExchangeRateProvider exchangeRateProvider = new BitfinexExchangeRateProvider(); IContextHolder contextHolder = new ContextHolder(Configuration, jsonSerializerSettings); DaemonClientFactory daemonClientFactory = new DaemonClientFactory(contextHolder, jsonSerializerSettings); IConnectionFactory dbFactory = new PgConnectionFactory(contextHolder); ITransferRequestRepository transferRequestRepository = new TransferRequestRepository(); ITransferRepository transferRepository = new TransferRepository(); NotificationService notificationService = new NotificationService(contextHolder, jsonSerializerSettings); services.AddSingleton <IContextHolder>(contextHolder); services.AddSingleton <IExchangeRateProvider>(exchangeRateProvider); services.AddSingleton <IJobManager>(jobManager); services.AddSingleton <JsonSerializerSettings>(jsonSerializerSettings); services.AddSingleton <DaemonClientFactory>(daemonClientFactory); services.AddSingleton <IConnectionFactory>(dbFactory); services.AddSingleton <ITransferRequestRepository>(transferRequestRepository); services.AddSingleton <ITransferRepository>(transferRepository); services.AddSingleton <NotificationService>(notificationService); jobManager.Start(); //Lazy load, requires explicit instantiation ExchangeRateUpdater exchangeRateUpdater = new ExchangeRateUpdater(jobManager, exchangeRateProvider, contextHolder); PayoutManager payoutManager = new PayoutManager(jobManager, contextHolder, transferRequestRepository, transferRepository, dbFactory, jsonSerializerSettings, daemonClientFactory, notificationService); services.Configure <IISOptions>(options => { options.ForwardClientCertificate = false; }); services.AddSingleton <PayoutManager>(payoutManager); services.RegisterServices(); // Add framework services. services.AddMvc(); }
/// <summary> /// When implemented in a derived class, executes the scheduled job asynchronously. Implementations that want to know whether /// the scheduled job is being cancelled can get a <see cref="P:Microsoft.WindowsAzure.Mobile.Service.ScheduledJob.CancellationToken"/> from the <see cref="M:CancellationToken"/> property. /// </summary> /// <returns> /// A <see cref="T:System.Threading.Tasks.Task"/> representing the asynchronous operation. /// </returns> public override async Task ExecuteAsync() { // Load Feed Message var dbConnStr = ConfigurationManager.ConnectionStrings["MTA_DB"].ConnectionString; var service = new StaticFileService(new StaticFileDownloader()); StringBuilder sb = new StringBuilder(); List<string> tableNames = new List<string>() { "agency", "calendar", "calendar_dates", "shapes", "stop_times", "transfers", "trips", "routes", "stops", }; tableNames.ForEach(s => sb.AppendFormat("TRUNCATE TABLE {0};", s)); using (var conn = new SqlConnection(dbConnStr)) { using (var cmd = new SqlCommand(sb.ToString(), conn)) { conn.Open(); cmd.ExecuteNonQuery(); } //Agency using (var repository = new AgencyRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetAgencies()); } // using (var repository = new CalendarDateRepository(dbConnStr)) // { // // Load Tables // repository.AddRange(service.GetCalendarDates()); // } //Calendars using (var repository = new CalendarRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetCalendars()); } //Route using (var repository = new RouteRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetRoutes()); } //Shape using (var repository = new ShapeRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetShapes()); } //Stop using (var repository = new StopRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetStops()); } //Stop Time using (var repository = new StopTimeRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetStopTimes()); } //Transfer using (var repository = new TransferRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetTransfers()); } //Trip using (var repository = new TripRepository() {Connection = conn}) { // Load Tables repository.AddRange(await service.GetTrips()); } // Build Stations using (var cmd = new SqlCommand("sp_BuildStations", conn)) { cmd.CommandType = CommandType.StoredProcedure; // conn.Open(); cmd.ExecuteNonQuery(); } using (var cmd = new SqlCommand("sp_CreateStaticSchedule", conn)) { cmd.CommandTimeout = 120; cmd.CommandType = CommandType.StoredProcedure; // conn.Open(); TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); DateTime easternTimeNow = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.Utc, easternZone); cmd.Parameters.AddWithValue("@today", easternTimeNow); cmd.ExecuteNonQuery(); } } }
public TransferBusinessLogic(TransferRepository transferRepository, AccountRepository accountRepository, MovementsRepository movementsRepository) { _transferRepository = transferRepository; _accountRepository = accountRepository; _movementsRepository = movementsRepository; }
public EngageWithTransferAgreementHandler(TransferInstructionRepository transferInstructionRepository, TransferRepository transferRepository) { _transferInstructionRepository = transferInstructionRepository; _transferRepository = transferRepository; }
private bool UpdateRepository(RepositoryEntry data, Reporter reporter, TransferRepository repository, string commitInfo, Stream repozip) { Log.Info("Try Update Repository"); UpdateLock.EnterWriteLock(); try { var downloadCompled = false; var repoConfiguration = new RepositoryConfiguration(reporter, data); using var repoPath = RepoEnv.TempFiles.CreateDic(); var data2 = _repos.AsQueryable().FirstOrDefault(r => r.RepoName == repository.RepoName); if (data2 != null && commitInfo != data2.LastUpdate) { if (!string.IsNullOrWhiteSpace(data.FileName)) { try { Log.Info("Downloading Repository {Name} From Server", repository.RepoName); reporter.Send(RepositoryMessages.GetRepositoryFromDatabase); _bucket.DownloadToStream(ObjectId.Parse(data.FileName), repozip); downloadCompled = true; } catch (Exception e) { Log.Error(e, "Error on Download Repo File {Name}", data.FileName); } } if (downloadCompled) { Log.Info("Unpack Repository {Name}", repository.RepoName); repozip.Seek(0, SeekOrigin.Begin); using var unpackZip = new ZipArchive(repozip); reporter.Send(RepositoryMessages.ExtractRepository); unpackZip.ExtractToDirectory(repoPath.FullPath); } Log.Info("Execute Git Pull for {Name}", repository.RepoName); using var updater = GitUpdater.GetOrNew(repoConfiguration); var result = updater.RunUpdate(repoPath.FullPath); var dataUpdate = Builders <RepositoryEntry> .Update.Set(e => e.LastUpdate, result.Sha); Log.Info("Compress Repository {Name}", repository.RepoName); reporter.Send(RepositoryMessages.CompressRepository); if (repozip.Length != 0) { repozip.SetLength(0); } using (var archive = new ZipArchive(repozip, ZipArchiveMode.Create, true)) archive.AddFilesFromDictionary(repoPath.FullPath); repozip.Seek(0, SeekOrigin.Begin); Log.Info("Upload and Update Repository {Name}", repository.RepoName); reporter.Send(RepositoryMessages.UploadRepositoryToDatabase); var current = data.FileName; var id = _bucket.UploadFromStream(repository.RepoName.Replace('/', '_') + ".zip", repozip); dataUpdate = dataUpdate.Set(e => e.FileName, id.ToString()); if (!string.IsNullOrWhiteSpace(current)) { _revisions.InsertOne(new ToDeleteRevision(current)); } _repos.UpdateOne(e => e.RepoName == data.RepoName, dataUpdate); data.FileName = id.ToString(); repozip.Seek(0, SeekOrigin.Begin); return(true); } } finally { UpdateLock.ExitWriteLock(); } return(false); }
public GetTransferByIdQuery(TransferRepository db) { _db = db; }
public EngageWithoutTransferAgreement(TransferRepository transferRepository) { _transferRepository = transferRepository; }
public ReleasePlayerHandler(TransferInstructionRepository transferInstructionRepository, TransferRepository transferRepository) { _transferInstructionRepository = transferInstructionRepository; _transferRepository = transferRepository; }
public TransferController(TransferRepository transferRepository) { _transferRepository = transferRepository; }