예제 #1
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            //Removed because it should just auto-end day. If the user restarts the program, it will continue anyways

            /*if (StaticHandler.MainWatch.IsRunning || StaticHandler.MainWatch.ElapsedMilliseconds > 0 || !TaskTracker.isCurrentTaskNull)
             * {
             *  if (e.CloseReason.Equals(CloseReason.WindowsShutDown))
             *  {
             *      if (MessageBox.Show("Are you sure you want to exit without ending the current Task?", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop) != DialogResult.Yes)
             *          e.Cancel = true;
             *  }
             *  else if (MessageBox.Show("Are you sure you want to exit without ending the current Task?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
             *      e.Cancel = true;
             * }*/

            if (!TaskTracker.isCurrentTaskNull)
            {
                TaskTracker.NullCurrentTask();
            }
            TaskTracker.EndCurrentDay();

            Setting.Save();

            CleanData.CleanJira();

            if (trayIcon != null)
            {
                trayIcon.Visible = false;
            }
        }
예제 #2
0
        public void IsCardNumberValid_Test3()
        {
            //Arrange
            bool   SpaceAllowed = true;
            string CardNumber   = "1111 1111 1111 1111";
            //Act
            bool returnModel = CleanData.IsCardNumberValid(CardNumber, SpaceAllowed);

            //Assert
            returnModel.Should().Be(false);
        }
예제 #3
0
        public void GetPayFrequency_Null()
        {
            //Arrange
            string input = "";

            //Act
            string returnModel = CleanData.GetPayFrequency(input);

            //Assert
            returnModel.Should().Be("sm");
        }
예제 #4
0
        public void GetPayFrequency_Monthly()
        {
            //Arrange
            string input = "MONTHLY";

            //Act
            string returnModel = CleanData.GetPayFrequency(input);

            //Assert
            returnModel.Should().Be("m");
        }
예제 #5
0
        public void GetCleanDollar_TestDecimalCheck()
        {
            //Arrange
            string Test = "13";

            //Act
            decimal returnModel = CleanData.GetCleanDollar(Test);

            //Assert
            returnModel.Should().Be(13.00m);
        }
예제 #6
0
        public void GetBoolValue_Yes_No()
        {
            //Arrange
            string input = "no";

            //Act
            bool returnModel = CleanData.GetBoolValue(input);

            //Assert
            returnModel.Should().Be(false);
        }
예제 #7
0
        public void GetCleanSSN_Test3()
        {
            //Arrange
            string UserImput = "987 65 4321";

            //Act
            string returnModel = CleanData.GetCleanSSN(UserImput);

            //Assert
            returnModel.Should().Be("987654321");
        }
예제 #8
0
        public void GetBoolValue_Y_N()
        {
            //Arrange
            string input = "y";

            //Act
            bool returnModel = CleanData.GetBoolValue(input);

            //Assert
            returnModel.Should().Be(true);
        }
예제 #9
0
        public void GetCleanSSN_Test2()
        {
            //Arrange
            string UserImput = "123de6789";

            //Act
            string returnModel = CleanData.GetCleanSSN(UserImput);

            //Assert
            returnModel.Should().Be("");
        }
예제 #10
0
        public void GetCleanDollar_TestNull()
        {
            //Arrange
            string Test = "";

            //Act
            decimal returnModel = CleanData.GetCleanDollar(Test);

            //Assert
            returnModel.Should().Be(0m);
        }
예제 #11
0
        public void GetCleanPhone_Test4()
        {
            //Arrange
            string UserPhone = "(816)-392-8808";

            //Act
            string returnModel = CleanData.GetCleanPhone(UserPhone);

            //Assert
            returnModel.Should().Be("8163928808");
        }
예제 #12
0
        public void GetPayFrequency_Bi_Weekly()
        {
            //Arrange
            string input = "BI WEEKLY";

            //Act
            string returnModel = CleanData.GetPayFrequency(input);

            //Assert
            returnModel.Should().Be("bi");
        }
예제 #13
0
 private void cleanToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to clean up unnecessary data? \n\nThis will not affect recorded data. This will only clean up data that is no longer used. This includes cached Jira attachments, backup data, etc.", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (CleanData.CleanAllData())
         {
             MessageBox.Show("Clean was successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.None);
         }
         else
         {
             MessageBox.Show("Clean was unsuccessful", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
예제 #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            bool clean = CleanData.CleanAllData();

            if (clean)
            {
                MessageBox.Show("Successfully cleaned all bad data. You can now run the conversion");
            }
            else
            {
                MessageBox.Show("Failed to clean all bad data (This isn't necessary for a successful conversion)");
            }
            button1.Enabled = true;
        }
예제 #15
0
    public static CleanData Validate(DirtyData d)
    {
        CleanData data = new CleanData();

        if (ValidateString(d.Name))
        {
            data.Name = d.Name
        }
        else
        {
            throw new ValidationException();
        }
        return(CleanData);
    }
예제 #16
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                try
                {
                    SeedData.Initialize(services);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred seeding the database.");
                }
                CleanData.RemoveZeroRating(services);
            }

            host.Run();
        }
예제 #17
0
        static void Main(string[] args)
        {
            //args = new[] {"unclean_data.txt", "code_mapping.txt", "8", "cs634_arif-gencosmanoglu_apriori_8.txt" }; // remove me when test is over
            //args = new[] { "practice_data.txt", "8", "out.txt"}; // remove me when test is over
            if (args.Length != 3 || args.Length != 4)
            {
                Console.WriteLine("You must enter either 3 or 4 different inputs.");
                return;
            }

            List <Transaction> transactions = new List <Transaction>();
            // get arguments
            var support = int.Parse(args[args.Length - 2]);
            var output  = args[args.Length - 1];

            if (args.Length == 4)
            {
                // clean transactions
                transactions = CleanData.Unclean(args[0], args[1]);
            }
            else if (args.Length == 3)
            {
                transactions = CleanData.Clean(args[0]);
            }

            // run apriori
            var candidates = new Candidates {
                Level = 1
            };
            // add the header lines
            var list = new List <string>
            {
                "Class Info: CS634-101 Data Mining",
                "Author: Arif Gencosmanoglu",
                $"File Name: {Path.GetFileName(output)}",
                "Due: 11:59pm on Monday October 29",
                "Purpose: Finding the frequently bought items based on transaction data"
            };

            //generate for candidates
            candidates = candidates.GenerateFirstLevelCandidates(transactions)
                         .ScanCandidates(transactions)
                         .ReturnFrequentItemList(support);
            candidates.Print();
            list.AddRange(candidates.CandidateItems.Select(_ => $"{_.ItemSet} ({_.Count})").ToList());
            // generate the rest candidates untill no candidate memebers exist
            while (candidates.CandidateItems.Count != 0)
            {
                candidates = candidates.GenerateCandidates()
                             .RemoveDuplicates()
                             .ScanCandidates(transactions)
                             .ReturnFrequentItemList(support);

                candidates.Print();
                list.AddRange(candidates.CandidateItems.Select(_ => $"{_.ItemSet} ({_.Count})").ToList());
            }
            // write result in putput file
            File.WriteAllLines(output, list);
            Console.WriteLine("Press any key to end the application.");
            Console.ReadKey();
        }