Esempio n. 1
0
        internal static void UpdateProviderTerminalId()
        {
            string[] lineData = FileRepo.getFileData(FileRepo.Providers);
            Dictionary <string, string> TerminalMerchantList = getTerminalMerchantList();
            int linePadding = 58;

            for (int i = 0; i < lineData.Count(); i++)
            {
                string terminalId = lineData[i].Substring(0, 6);
                string merchantId = lineData[i].Substring(8, 8);
                if (TerminalMerchantList.ContainsValue(merchantId))
                {
                    terminalId = (from p in TerminalMerchantList
                                  where p.Value == merchantId
                                  select p.Key).FirstOrDefault();
                }
                else
                {
                    terminalId = TerminalMerchantList.ElementAt(0).Key;
                    merchantId = TerminalMerchantList.ElementAt(0).Value;
                }
                lineData[i] = ((terminalId + new string(' ', 8)).Substring(0, 8) +
                               (merchantId + new string(' ', 8)).Substring(0, 8) +
                               lineData[i].Substring(16) + new string(' ', linePadding)).Substring(0, linePadding);
            }
            //TODO
            FileRepo.setFileData(FileRepo.Providers, lineData);

            return;
        }
Esempio n. 2
0
        internal static void UpdateMerchantTerminalId(string terminalId)
        {
            string[] lineData;
            string[] terminalIdEnd = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
            lineData = FileRepo.getFileData(FileRepo.Merchants);
            int linePadding = 63;

            terminalId = (terminalId + new string(' ', 8)).Substring(0, 8);
            for (int i = 0; i < lineData.Count(); i++)
            {
                if (i + 1 == lineData.Count() || i >= 23)
                {
                    terminalId = terminalId.Substring(0, 5) + "X";
                }
                else
                {
                    terminalId = terminalId.Substring(0, 5) + terminalIdEnd[i];
                }
                terminalId = (terminalId + new string(' ', 8)).Substring(0, 8);
                if (!string.IsNullOrEmpty(lineData[i]) && lineData[i].Length > 8)
                {
                    lineData[i] = (terminalId + lineData[i].Substring(8) + new string(' ', linePadding)).Substring(0,
                                                                                                                   linePadding);
                }
            }
            FileRepo.setFileData(FileRepo.Merchants, lineData);
            UpdateProviderTerminalId();
        }
Esempio n. 3
0
        private static void Main(string[] args)
        {
            DefaultTypeMap.MatchNamesWithUnderscores = true;

            var dbStorableTypes = new[] { typeof(CheckTask) };

            foreach (var type in dbStorableTypes)
            {
                SqlMapper.AddTypeHandler(type, new DapperTypeHandler());
            }

            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            var jsRunner = new JsRunner();
            var fileRepo = new FileRepo(configuration);
            var jsJob    = new JsCheckJob(configuration, jsRunner, fileRepo);

            var cancellationSource = new CancellationTokenSource();

            //Task.Run(() => , cancellationSource.Token);

            jsJob.Run(cancellationSource.Token).GetAwaiter().GetResult();

            while (true)
            {
                var key = Console.ReadKey(true);
                if ((key.Modifiers & ConsoleModifiers.Control) != 0 && key.Key == ConsoleKey.C)
                {
                    cancellationSource.Cancel();
                    break;
                }
            }
        }
Esempio n. 4
0
        public void TestClearFile()
        {
            var fr = new FileRepo();

            fr.Clear();
            Assert.IsTrue(fr.LogFileExists());
        }
Esempio n. 5
0
        private async void btnConfirmTeam_Click(object sender, EventArgs e)
        {
            selectedCountry = countriesList[listTeams.SelectedIndex] as Country;

            if (playersList.Count != 0)
            {
                flpPlayers.Controls.Clear();
            }

            playersList = await Data.GetPlayersForCountry($"https://worldcup.sfg.io/matches/country?fifa_code={selectedCountry.FifaCode}", selectedCountry.FifaCode);

            foreach (var player in playersList)
            {
                PlayerProfile playerCard = CreateNewPlayerCard(player);
                playerCard.MouseDown += PlayerCard_MouseDown;
                flpPlayers.Controls.Add(playerCard);
            }
            flpFavoritePlayers.AllowDrop = true;
            btnAttendence.Enabled        = true;
            btnPlayerRanking.Enabled     = true;


            // FileRepo.SaveFavoriteTeam(favTeamFolder,favTeamFile,selectedCountry);
            FileRepo.WriteToFile(new[] { listTeams.Text }, FileRepo.FAV_COUNTRY);
        }
Esempio n. 6
0
        public void TestCreateFile()
        {
            var fr = new FileRepo();

            fr.Append("hello");
            Assert.IsTrue(fr.LogFileExists());
        }
Esempio n. 7
0
 public ServiceBuilder(string contentRootPath)
 {
     adresaMatcher             = new Matcher(SarateniInit);
     addressParser             = new AddressParser();
     combosIndexMatchProcessor = new combosIndexMatchProcessor();
     combosIndexMatcher        = new Matcher(CadGenCombosInit);
     DXFRepo   = new FileRepo(contentRootPath, "DXF", "*.dxf");
     ExcelRepo = new FileRepo(contentRootPath, "Excel", "*.xls");
 }
Esempio n. 8
0
 public void CHeckFile()
 {
     var f = new FileRepo();
     var vendinglist = f.GrabInfo();
     foreach (var v in vendinglist)
     {
         Assert.IsNotNull(v.Value.Location);
     }
 }
Esempio n. 9
0
        public void TestFileHelperPathAbsolute()
        {
            var tempDir = Path.GetTempPath();

            Directory.SetCurrentDirectory(tempDir);

            var result = FileRepo.PathOffset("c:\\somepath\\someotherpath");

            Assert.AreEqual(result, "c:\\somepath\\someotherpath");
        }
Esempio n. 10
0
 internal static string[] getTranscodelist()
 {
     try
     {
         string[] lineData = FileRepo.getFileData(FileRepo.TransCodeList);
         return(lineData);
     }
     catch (Exception) {}
     return(new string[0]);
 }
Esempio n. 11
0
        public void TestFileHelperPathRelativeWithFileName2()
        {
            var tempDir = Path.GetTempPath();

            Directory.SetCurrentDirectory(tempDir);

            var result = FileRepo.PathOffset("someotherpath\\somefile.csproj");

            Assert.AreEqual(result, tempDir + "someotherpath\\somefile.csproj");
        }
Esempio n. 12
0
        public void TestFileHelperPathRelativeWithForwardSlash2()
        {
            var tempDir = Path.GetTempPath();

            Directory.SetCurrentDirectory(tempDir);

            var result = FileRepo.PathOffset("/someotherpath/");

            Assert.AreEqual(result, tempDir + "someotherpath");
        }
Esempio n. 13
0
        public void CheckInv()
        {
            var f = new FileRepo();
            var vendinglist = f.GrabInfo();

            foreach (var v in vendinglist)
            {
                Assert.LessOrEqual(0, v.Value.Inventory);
            }
        }
Esempio n. 14
0
        private static IEvolutionLogic GetApplication(IDatabaseAuthenticationOptions dbAuthOptions)
        {
            PopulateMissingConfigValues(ref dbAuthOptions);
            var context        = DbContextFactory.CreateContext(dbAuthOptions);
            var repo           = new EvolutionRepo(context);
            var fileSystem     = new FileContext();
            var fileSystemRepo = new FileRepo(fileSystem);

            return(new EvolutionLogic(repo, fileSystemRepo));
        }
Esempio n. 15
0
 public void Funds()
 {
     int currentfunding = 30;
     var f = new FileRepo();
     var vendinglist = f.GrabInfo();
     foreach (var v in vendinglist)
     {
         // this passed till it hit a vaule that was above the amount that was inputed aka the funds in the machine
         Assert.LessOrEqual(v.Value.Price, currentfunding);
     }
 }
Esempio n. 16
0
        public void Inventory()
        {
            var f = new FileRepo();
            var vendinglist = f.GrabInfo();

            foreach (var v in vendinglist)
            {
                // this is pretty much the same thing I had in the controller, would write to the file after doing v.value.Inventory - 1;
                Assert.AreNotEqual(v.Value.Inventory, v.Value.Inventory - 1);
            }
        }
Esempio n. 17
0
 public CrossTable()
 {
     classRepo           = unit.ClassRepo();
     fileRepo            = unit.FileRepo();
     employeeAccountRepo = unit.EmployeeAccountRepo();
     employeeRepo        = unit.EmployeeRepo();
     studentAccountRepo  = unit.StudentAccountRepo();
     studentRepo         = unit.StudentRepo();
     gradeRepo           = unit.GradeRepo();
     subjectRepo         = unit.SubjectRepo();
 }
        public void GetFilesByStudentIdTest()
        {
            UnitOfWork unit = new UnitOfWork();
            FileRepo   repo = unit.FileRepo();


            var expected = 2;

            var actual = repo.GetFilesByStudentId(7).First().FileId;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 19
0
        private void SetPlayer(Knjiznica.Model.Player player, Matches match)
        {
            System.Drawing.Bitmap image;
            image = FileRepo.LoadPlayerPictureFromCache(player.Name, FileRepo.playerPicturesPath);

            if (image == null)
            {
                image = Properties.Resources.p5;
            }
            // pImage.Source = MainWindow.BitmapToImageSource(image);
            pNumber.Text = player.Number.ToString();
            pName.Text   = player.Name;
        }
Esempio n. 20
0
        public void ListItems()
        {
            FileRepo f = new FileRepo();

            var vending = f.GrabInfo();

            foreach (var data in vending)
            {
                if (data.Value.Inventory > 0)
                {
                    Console.WriteLine($"{data.Value.Location} {data.Value.Name} {data.Value.Price} ({data.Value.Inventory})");
                }
            }
        }
Esempio n. 21
0
        private void pbPlayerIcon_Click(object sender, EventArgs e)
        {
            Bitmap btm = FileRepo.ChoosePicture(lblPlayerName.Text, IsFav) ?? Resources.p5;

            pbPlayerIcon.Image = btm;
            if (IsFav)
            {
                FileRepo.FillPlayerDictionary(lblPlayerName.Text, btm, FileRepo.favPlayerPictures);
            }
            else
            {
                FileRepo.FillPlayerDictionary(lblPlayerName.Text, btm, FileRepo.playerPictures);
            }
        }
Esempio n. 22
0
        public void CreateEvolutionFile_Success()
        {
            const string evolutionName     = "Evolution1";
            const string evolutionContents = "Programatic awesomeness";

            var evolution = new Model.Evolution(evolutionName, DateTime.Now);

            var mockBuilder = new FileContextBuilder()
                              .AddCreateEvolutionFileBehavior();

            var repo = new FileRepo(mockBuilder.Context);

            repo.CreateEvolutionFile(evolution, evolutionContents);

            Assert.NotEqual(0, mockBuilder.EvolutionCount);
        }
Esempio n. 23
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            string       msg    = Resources.Zatvaranje;
            DialogResult result = MessageBox.Show(msg, Resources.ZatvaranjeNaslov,
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                FileRepo.WriteToFile(new[] { listTeams.Text }, FileRepo.FAV_COUNTRY);
            }
            else if (result == DialogResult.No)
            {
                e.Cancel = true;
            }
        }
Esempio n. 24
0
 internal static string getProviderName(string providerNumberId)
 {
     string[] lineData = FileRepo.getFileData(FileRepo.Providers);
     foreach (string myRow in lineData)
     {
         if (myRow.Length > 32)
         {
             if (myRow.Substring(23, 8) == providerNumberId)
             {
                 return(myRow.Substring(31, 16));
             }
         }
     }
     // Not Found
     return("");
 }
Esempio n. 25
0
 internal static string getProviderIdFromMerchantId(string merchantId)
 {
     string[] lineData = FileRepo.getFileData(FileRepo.Providers);
     foreach (string myRow in lineData)
     {
         if (myRow.Length > 32)
         {
             if (myRow.Substring(8, 8) == merchantId)
             {
                 return(myRow.Substring(23, 8));
             }
         }
     }
     // Not found
     return("");
 }
Esempio n. 26
0
 internal static string getHealthFundName(string cardNumber)
 {
     string[] lineData = FileRepo.getFileData(FileRepo.CardList);
     foreach (string myRow in lineData)
     {
         if (myRow.Length >= 16)
         {
             if (myRow.Substring(6, 8) == cardNumber.Substring(0, 8))
             {
                 return(myRow.Substring(0, 6));
             }
         }
     }
     // Not found
     return("");
 }
Esempio n. 27
0
 internal static string getMerchantName(string strMerchantName)
 {
     string[] lineData;
     lineData = FileRepo.getFileData(FileRepo.Merchants);
     foreach (string myRow in lineData)
     {
         if (myRow.Length > 24)
         {
             if (myRow.Substring(8, 8).Trim() == strMerchantName.Trim())
             {
                 return(myRow.Substring(23).Trim());
             }
         }
     }
     return("");
 }
Esempio n. 28
0
        public void CreateEvolutionFiles_FileExists()
        {
            const string evolutionName     = "Evolution1";
            const string evolutionContents = "Programatic awesomeness";

            var evolution = new Model.Evolution(evolutionName, DateTime.Now);

            var mockBuilder = new FileContextBuilder()
                              .AddCreateEvolutionFileBehavior()
                              .AddEvolution(evolution.FileName, evolutionContents);

            var repo = new FileRepo(mockBuilder.Context);

            Assert.Throws <EvolutionFileException>(() => repo.CreateEvolutionFile(evolution, evolutionContents));
            Assert.Equal(1, mockBuilder.EvolutionCount);
        }
Esempio n. 29
0
        public void GetEvolutionFileContents()
        {
            const string fileName = "20180125131211_evolution1.evo.sql";
            const string content  = "evolution file content";

            var contextBuilder = new FileContextBuilder()
                                 .AddEvolution(fileName, content)
                                 .AddGetEvolutionFileContentBehavior();

            var repo          = new FileRepo(contextBuilder.Context);
            var contentResult = repo.GetEvolutionFileContent(new Model.Evolution(fileName));

            Assert.NotNull(contentResult);
            Assert.True(!string.IsNullOrWhiteSpace(contentResult));
            Assert.Equal(content, contentResult);
        }
Esempio n. 30
0
 public FilesController(
     FolderSplitter folderLocator,
     TokenEnsurer tokenEnsurer,
     ProbeLocator probeLocator,
     IStorageProvider storageProvider,
     SiteRepo siteRepo,
     FolderRepo folderRepo,
     FileRepo fileRepo)
 {
     _folderSplitter  = folderLocator;
     _tokenEnsurer    = tokenEnsurer;
     _probeLocator    = probeLocator;
     _storageProvider = storageProvider;
     _siteRepo        = siteRepo;
     _folderRepo      = folderRepo;
     _fileRepo        = fileRepo;
 }