Ejemplo n.º 1
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            Employee emp = new Employee(NameTB.Text, dateHiredPicker.Value,dateFiredPicker.Text);
            emp.addToTable(ResultGV);

            //MessageBox.Show(emp.showName() + " worked " + emp.showExp());
        }
Ejemplo n.º 2
0
        public void readData(DataGridView data,string period)
        {
            try
            {
                string[] lines = File.ReadAllLines("database");
                foreach (string line in lines) {
                    String[] cells = line.Split(new Char[] { '|' });

                    Employee emp = new Employee(cells[0], DateTime.Parse(cells[1]),cells[2]);
                    Employee temp = new Employee(cells[0], DateTime.Parse(cells[1]),period);

                    if (emp.getAdd() < temp.getAdd())
                    {
                        emp.addToTable(data);
                    }
                }
            }
            catch (IOException e) {

                MessageBox.Show(e.ToString() + "\n read error@!");
            }
        }
Ejemplo n.º 3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            double hourlyrate = 10;

            // Make sure the feedback label is cleared from any previous attempts
            lblFeedback.Text = "";

            /************************* FORM VALIDATION *************************/
            bool isValid = true;

            // First Name Form Validation
            if (ValidationLibrary.IsItFilledIn(txtFName.Text, 1) == false)
            {
                lblFeedback.Text += "ERROR: Please fill in a First Name.\n";
                isValid           = false;
            }

            // Last Name Form Validation
            if (ValidationLibrary.IsItFilledIn(txtLName.Text, 1) == false)
            {
                lblFeedback.Text += "ERROR: Please fill in a Last Name.\n";
                isValid           = false;
            }

            // State Form Validation
            if (ValidationLibrary.IsItFilledIn(txtState.Text, 2) == false)
            {
                lblFeedback.Text += "ERROR: Please fill in a 2-digit State abbreviation.\n";
                isValid           = false;
            }
            else if (ValidationLibrary.IsValidLength(txtState.Text, 2) == false)
            {
                lblFeedback.Text += "ERROR: Please make sure State abbreviation is exactly 2-digits.\n";
                isValid           = false;
            }
            else if (txtState.Text.All(Char.IsLetter) == false)
            {
                lblFeedback.Text += "ERROR: Please make sure State abbreviation only contains letters.\n";
                isValid           = false;
            }

            // Zip Code Form Validation
            if (ValidationLibrary.IsItFilledIn(txtZipCode.Text, 5) == false)
            {
                lblFeedback.Text += "ERROR: Please fill in a 5-digit Zip Code.\n";
                isValid           = false;
            }
            else if (ValidationLibrary.IsAllDigits(txtZipCode.Text) == false)
            {
                lblFeedback.Text += "ERROR: Please make sure Zip Code contains numbers only.\n";
                isValid           = false;
            }

            // Email Form Validation
            if (ValidationLibrary.IsItFilledIn(txtEmail.Text) == false)
            {
                lblFeedback.Text += "ERROR: Please fill in a valid Email address.\n";
                isValid           = false;
            }
            else if (ValidationLibrary.IsValidEmail(txtEmail.Text) == false)
            {
                lblFeedback.Text += "ERROR: Please fill in a valid Email address.\n";
                isValid           = false;
            }

            if (chkEmployee.Checked == true)
            {
                // Employee ID Form Validation
                if (ValidationLibrary.IsItFilledIn(txtEmployeeID.Text, 1) == false)
                {
                    lblFeedback.Text += "ERROR: Please fill in an Employee ID...Numbers Only!\n";
                    isValid           = false;
                }
                else if (txtEmployeeID.Text.All(Char.IsNumber) == false)
                {
                    lblFeedback.Text += "ERROR: Please make sure Employee ID contains numbers only.\n";
                    isValid           = false;
                }

                // Hourly Rate Form Validation
                if (txtHourlyRate.Text.Length < 2)
                {
                    lblFeedback.Text += "ERROR: Please fill in an Hourly Wage greate than or equal to 10.\n";
                    isValid           = false;
                }
                else
                {
                    bool isNum = double.TryParse(txtHourlyRate.Text, out hourlyrate) == true;

                    if (isNum == true)
                    {
                    }
                    else
                    {
                        lblFeedback.Text += "ERROR: Please make sure that Hourly Wage is greater than or equal to 10.\n";
                        isValid           = false;
                    }
                }
            }

            if (isValid)
            {
                // Create instance of Employee class called temp
                Employee temp = new Employee();

                // Fill in from Form Data
                temp.FName      = txtFName.Text;
                temp.MName      = txtMName.Text;
                temp.LName      = txtLName.Text;
                temp.Street1    = txtStreet1.Text;
                temp.Street2    = txtStreet2.Text;
                temp.City       = txtCity.Text;
                temp.State      = txtState.Text;
                temp.Zipcode    = txtZipCode.Text;
                temp.Country    = txtCountry.Text;
                temp.Phone      = txtPhone.Text;
                temp.Email      = txtEmail.Text;
                temp.Employed   = workstatus;
                temp.EmployeeID = txtEmployeeID.Text;
                temp.HourlyRate = double.Parse(txtHourlyRate.Text);

                // Display Errors or Results in Feedback Label
                if (temp.Feedback.Contains("ERROR:"))
                {
                    lblFeedback.Text = temp.Feedback;
                }
                else if (chkEmployee.Checked == true)
                {
                    lblFeedback.Text = temp.AddEmployee();
                }
                else
                {
                    lblFeedback.Text = temp.AddPerson();
                }
            }
        }
Ejemplo n.º 4
0
 public frmGMTicketDetails(Employee emp)
 {
     InitializeComponent();
     // TODO: Complete member initialization
     this.emp = emp;
 }