Beispiel #1
0
        public void AddNewEmployeeTest()
        {
            BazaarManagment bm = new BazaarManagment();

            bm.AddNewEmployee("John", "Doe", Gender.MALE, Position.EMPLOYEE, Department.DEPOT, DateTime.Today, "Netherlands", "Eindhoven", "5612JC", "JohannesWaalsweg", "*****@*****.**", "Dutch", "Dutch", 123, DateTime.Today, 40);
            bm.AddNewEmployee("Jane", "Doe", Gender.FEMALE, Position.MANAGER, Department.HUMANRESOURCES, DateTime.Today, "Netherlandsa", "Eindhovena", "5612JaC", "JohannesWaalswega", "*****@*****.**", "Dutch", "Dutch", 1234, DateTime.Today, 43);
            Employee e  = new Employee("John", "Doe", Gender.MALE, Position.EMPLOYEE, Department.DEPOT, DateTime.Today, "Netherlands", "Eindhoven", "5612JC", "JohannesWaalsweg", "*****@*****.**", "Dutch", "Dutch", 123, DateTime.Today, 40);
            Employee em = new Employee("Jane", "Doe", Gender.FEMALE, Position.MANAGER, Department.HUMANRESOURCES, DateTime.Today, "Netherlandsa", "Eindhovena", "5612JaC", "JohannesWaalswega", "*****@*****.**", "Dutch", "Dutch", 1234, DateTime.Today, 43);

            CollectionAssert.AreEquivalent(new Employee[] { e, em }, bm.newEmployeesList);
        }
Beispiel #2
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            string     firstName;
            string     lastName;
            int        bsn = 0;
            Gender     gender;
            Position   position   = Position.EMPLOYEE;
            Department department = Department.SALES;
            DateTime   birthDate  = dtpicker.Value;
            string     birthPlace;
            string     adress;
            string     city;
            string     zipcode;
            string     email;
            string     nationality;
            string     languages;
            DateTime   ContractEnd;
            double     FTE = Convert.ToDouble(nudFTE.Value);

            foreach (Employee em in managment.GetAllEmployees())
            {
                if (em.Positions == "MANAGER")
                {
                    department = em.Department;
                }
            }
            try { bsn = Convert.ToInt32(tbxBSN.Text); }
            catch (System.FormatException) { MessageBox.Show("Please enter a valid BSN number"); return; }

            if (string.IsNullOrWhiteSpace(tbxFName.Text))
            {
                MessageBox.Show("Please fill in both names");
                return;
            }
            else
            {
                firstName = tbxFName.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxLName.Text))
            {
                MessageBox.Show("Please fill in both names");
                return;
            }
            else
            {
                lastName = tbxLName.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxBirthplace.Text))
            {
                MessageBox.Show("Please enter place of birth");
                return;
            }
            else
            {
                birthPlace = tbxBirthplace.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxAddress.Text))
            {
                MessageBox.Show("Please enter a home address");
                return;
            }
            else
            {
                adress = tbxAddress.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxEmail.Text))
            {
                MessageBox.Show("Please enter an E-mail adress");
                return;
            }
            else
            {
                email = tbxEmail.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxNationality.Text))
            {
                MessageBox.Show("Please enter a nationality");
                return;
            }
            else
            {
                nationality = tbxNationality.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxLanguage.Text))
            {
                MessageBox.Show("Please enter languages");
                return;
            }
            else
            {
                languages = tbxLanguage.Text;
            }
            if (string.IsNullOrWhiteSpace(cbxGender.Text))
            {
                MessageBox.Show("Please enter the gender of your future employee");
                return;
            }
            else
            {
                gender = (Gender)cbxGender.SelectedIndex;
            }
            if (string.IsNullOrWhiteSpace(cbxDepartment.Text) && lblDepartment.Visible == true)
            {
                MessageBox.Show("Please enter a department for your future employee");
                return;
            }
            else
            {
                department = (Department)cbxDepartment.SelectedIndex;
            }
            if (string.IsNullOrWhiteSpace(tbxCity.Text))
            {
                MessageBox.Show("Please enter a city name");
                return;
            }
            else
            {
                city = tbxCity.Text;
            }
            if (string.IsNullOrWhiteSpace(tbxZipcode.Text))
            {
                MessageBox.Show("Please enter a zipcode");
                return;
            }
            else
            {
                zipcode = tbxZipcode.Text;
            }
            if (rbtnOneYear.Checked)
            {
                ContractEnd = DateTime.Now;
                contractEnd = ContractEnd.AddYears(1);
            }
            if (rbtnTwoYears.Checked)
            {
                ContractEnd = DateTime.Now;
                contractEnd = ContractEnd.AddYears(2);
            }
            if (rbtnOneYear.Visible = false && rbtnTwoYears.Visible == false)
            {
                contractEnd = dateTimePicker1.Value;
            }

            managment.AddNewEmployee(firstName, lastName, gender, position, department, birthDate, birthPlace, city, zipcode, adress, email, nationality, languages, bsn, contractEnd, FTE);
            MessageBox.Show("Success");
        }