Example #1
0
        private void ValidateDateColumnButton_Click(object sender, EventArgs e)
        {
            var fileOperations = new FileOperations();
            var fileName       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Import5.txt");
            var issueList      = fileOperations.ValidatePaidDate(fileName);

            if (issueList.Count > 0)
            {
                var issuesForm = new IssuesForm(issueList)
                {
                    Text = "Invalid paid dates"
                };
                try
                {
                    issuesForm.ShowDialog();
                }
                finally
                {
                    issuesForm.Dispose();
                }
            }
        }
Example #2
0
        /// <summary>
        /// Example were validation is performed in a method which
        /// returns information via a ValueTuple, a list of Customer
        /// and a list of issues if any
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RealWorldGoodButton_Click(object sender, EventArgs e)
        {
            var fileOperations = new FileOperations();
            var fileName       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Import1.txt");

            var(customers, issueList) = fileOperations.ReadCustomersPerfectWorldCreator(fileName);

            if (fileOperations.IsSuccessFul)
            {
                _bindingSource.DataSource = customers;
                dataGridView1.DataSource  = _bindingSource;
            }
            else
            {
                MessageBox.Show(fileOperations.LastExceptionMessage);
            }

            if (issueList.Count <= 0)
            {
                return;
            }

            if (Question("There were imperfect data, review?"))
            {
                var issuesForm = new IssuesForm(issueList)
                {
                    Text = "Encountered these issues"
                };
                try
                {
                    issuesForm.ShowDialog();
                }
                finally
                {
                    issuesForm.Dispose();
                }
            }
        }