Пример #1
0
        public TaxResultForm()
        {
            InitializeComponent();

            this.count = TaxpayerList.MainTaxpayerData.Count;
            TaxpayerData data = TaxpayerList.MainTaxpayerData[index];

            this.tfFullName.Text       = (data.GetFirstName() + " " + data.GetLastName());
            this.tfSSN2.Text           = data.GetSSN();
            this.tfAdjustedGross.Text  = data.GetAdjustedGross().ToString("c2");
            this.tfAmountCalc.Text     = data.GetTaxCalc().ToString("c2");
            this.tfAmountWithheld.Text = data.GetFedTaxWithheld().ToString("c2");
            this.tfPenalty.Text        = data.GetPenalty().ToString("c2");
            this.tfTaxOwed.Text        = data.GetTaxOwed().ToString("c2");
            this.tfRefund.Text         = data.GetRefund().ToString("c2");
            index++;
        }
Пример #2
0
        private void btNextData_Click(object sender, EventArgs e)
        {
            if (index < count)
            {
                TaxpayerData data = TaxpayerList.MainTaxpayerData[index];
                this.tfFullName.Text       = (data.GetFirstName() + " " + data.GetLastName());
                this.tfSSN2.Text           = data.GetSSN();
                this.tfAdjustedGross.Text  = data.GetAdjustedGross().ToString("c2");
                this.tfAmountCalc.Text     = data.GetTaxCalc().ToString("c2");
                this.tfAmountWithheld.Text = data.GetFedTaxWithheld().ToString("c2");
                this.tfPenalty.Text        = data.GetPenalty().ToString("c2");
                this.tfTaxOwed.Text        = data.GetTaxOwed().ToString("c2");
                this.tfRefund.Text         = data.GetRefund().ToString("c2");

                index++;
            }
            else
            {
                //show summary of all taxpayer in third form
                Form summaryForm = new SummaryForm();
                summaryForm.ShowDialog();
            }
        }
Пример #3
0
        private void btSubmit_Click(object sender, EventArgs e)
        {
            //get user input
            //add user data to linked list
            //open second form

            if (TaxpayerList.MainIndex < SIZE)
            {
                if (IsValidDataEmpty())
                {

                    //define local variables
                    string firstName = "", lastName = "", address = "", city = "", state = "", zipCode = "", ssn = "";
                    int numExem = 0;
                    decimal gross = 0m, fedTax = 0m, capital = 0m, realEstate = 0m, excise = 0m, medTax = 0m;

                    firstName = this.tfFirstName.Text;
                    lastName = this.tfLastName.Text;
                    address = this.tfAddress.Text;
                    city = this.tfCity.Text;
                    state = this.cbState.SelectedItem.ToString();
                    zipCode = this.tfZipCode.Text;
                    ssn = this.tfSSN.Text;

                    numExem = Convert.ToInt32(this.tfExemption.Text);

                    gross = Convert.ToDecimal(this.tfGrossEarnings.Text);
                    fedTax = Convert.ToDecimal(this.tfFedTax.Text);
                    capital = Convert.ToDecimal(this.tfCapital.Text);
                    realEstate = Convert.ToDecimal(this.tfRealEstate.Text);
                    excise = Convert.ToDecimal(this.tfExciseTax.Text);
                    medTax = Convert.ToDecimal(this.tfMedExpenses.Text);

                    //add data to object
                    TaxpayerData data = new TaxpayerData(firstName, lastName, address, city, state, zipCode,
                                             ssn, numExem, gross, fedTax, capital, realEstate, excise, medTax);
                    //add object to array list
                    TaxpayerList.setUserData(data);
                    clearFields();

                    //MessageBox.Show(this, data.GetDisplayText("\n"), "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.None);
                    
                    //increment index
                    TaxpayerList.MainIndex++;

                    if (TaxpayerList.MainIndex == SIZE) {
                        //open form #2
                        Form taxResultForm = new TaxResultForm();
                        taxResultForm.ShowDialog();
                    }
                }
                else
                {
                    //dispaly error msg
                    MessageBox.Show(this, "Your data is incorrect!\nPlease, correct ALL text fields with RED error-labels", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }else
            {
                //open form #2
                Form taxResultForm = new TaxResultForm();
                taxResultForm.ShowDialog();
            }
        }
Пример #4
0
 public static void setUserData(TaxpayerData data)
 {
     MainTaxpayerData.Add(data);
 }