Exemplo n.º 1
0
        public void validEmployer(Employer emp)
        {
            if (Legal.legalId(emp.idOrNumber) == false)
            {
                throw new Exception("Employer's ID is not legal!!");
            }

            if (Legal.isString(emp.city) == false)
            {
                throw new Exception("The address is not legal!!");
            }

            if (Legal.isTelPhone(emp.telNumber) == false)
            {
                throw new Exception("Employer's telephone number is not legal");
            }

            if (seniority(emp) == false)
            {
                throw new Exception("You can't have a contract because your company exists less than a year!!");
            }

            if (emp.budget < 0 || (0 < emp.budget && emp.budget < 1))
            {
                throw new Exception("Budget value is not valid !!!");
            }
        }
Exemplo n.º 2
0
        public void validEmployer(Employer emp)
        {
            String error = "";

            if (Legal.legalId(emp.idOrNumber) == false)
            {
                error += ("Employer's ID is not legal!!\n");
            }

            if (emp.company == true)
            {
                if (!Legal.isString(emp.CompanyName))
                {
                    error += "The company name is not legal!!!\n";
                }
            }
            else
            {
                if (emp.firstName == null || emp.lastName == null)
                {
                    error += ("Employer's name is empty!!\n");
                }

                else if (!Legal.isString(emp.firstName) || !Legal.isString(emp.lastName))
                {
                    error += ("Employer's Name is not legal!!\n");
                }
            }
            if (Legal.isString(emp.city) == false)
            {
                error += ("The address is not legal!!\n");
            }

            if (Legal.isTelPhone(emp.telNumber) == false)
            {
                error += ("Employer's telephone number is not legal\n");
            }

            if (seniority(emp) == false)
            {
                error += ("You can't have a contract because your company exists less than a year!!\n");
            }

            if (emp.budget < 0 || (0 < emp.budget && emp.budget < 1))
            {
                error += ("Budget value is not valid !!!\n");
            }

            if (error != "")
            {
                throw new Exception(error);
            }
        }
Exemplo n.º 3
0
        public void validEmployee(Employee em)
        {
            if (Legal.legalId(em.Id) == false)
            {
                throw new Exception("Employee's ID is not legal!!");
            }

            if (em.firstName.Length < 1 && em.lastName.Length < 1)
            {
                throw new Exception("Employee's name is not legal!!");
            }
            if (Legal.isString(em.city) == false)
            {
                throw new Exception("Employee's address is not legal!!");
            }

            if (Legal.isCellPhone(em.phoneNumber) == false)
            {
                throw new Exception("Employee phone number is not legal!!");
            }
            if (isAdult(em.dateBirth) == false)
            {
                throw new Exception("Employee is too young for working!!");
            }
            if (!bankAcount(em.details))
            {
                throw new Exception("Employee's Bank Acount details are incorrect!!");
            }
            if (em.experience < 1)
            {
                throw new Exception("experience value is not valid!!!");
            }
            else if (em.hoursPerMonth < 1)
            {
                throw new Exception("Number of hours is not valid!!!");
            }
        }
Exemplo n.º 4
0
        public void validEmployee(Employee em)
        {
            String error = "";

            if (em.d == 0)
            {
                error += ("ERROR: please choose degree!!! \n");
            }

            Specialization s = null;

            try
            {
                s = getSpecialization(em.SpecializationNumber);
            }
            catch (Exception e)
            {
                error += (e.Message + "\n");
            }

            if (Legal.legalId(em.Id) == false)
            {
                error += ("Employee's ID is not legal!!\n");
            }

            if (em.firstName == null || em.lastName == null)
            {
                error += ("Employee's name is empty!!\n");
            }

            else if (!Legal.isString(em.firstName) || !Legal.isString(em.lastName))
            {
                error += ("Employee's Name is not legal!!\n");
            }

            if (Legal.isString(em.city) == false)
            {
                error += ("Employee's address is not legal!!\n");
            }

            if (Legal.isCellPhone(em.phoneNumber) == false)
            {
                error += ("Employee phone number is not legal!!\n");
            }
            if (isAdult(em.dateBirth) == false)
            {
                error += ("Employee is too young for working!!\n");
            }
            //if (!bankAcount(em.details))
            //{
            //    error += ("Employee's Bank Acount details are incorrect!!\n");
            //}
            if (em.experience < 0)
            {
                error += ("experience value is not valid!!!\n");
            }
            if (em.hoursPerMonth < 1)
            {
                error += ("Number of hours is not valid!!!\n");
            }
            if (s == null)
            {
                error += ("The employee specialization does'nt exist!!!\n");
            }

            if (error != "")
            {
                throw new Exception(error);
            }
        }