public void employeeAdd(String email, String password, String name, String address, String dateOfBirth, String gender, String role)

        {
            Console.WriteLine(email);
            DateTime dt = DateTime.Now;

            dateOfBirth = dt.ToString();
            if (email == "")
            {
                throw new Exception("email is empty");
            }
            if (password == "")
            {
                throw new Exception("password is empty");
            }
            if (name == "")
            {
                throw new Exception("name is empty");
            }
            if (address == "")
            {
                throw new Exception("address is empty");
            }

            /*if (dateOfBirth == "")
             * {
             *  throw new Exception("dateOfBirth is empty");
             *
             * }*/
            if (gender == "")
            {
                throw new Exception("gender is empty");
            }
            if (role == "")
            {
                throw new Exception("email is empty");
            }

            Models.Employee       emp       = new Models.Employee(email, password, name, address, dateOfBirth, gender, role);
            Dal.DatabaseConnector connector = new Dal.DatabaseConnector();

            try
            {
                connector.addEmployee(emp);
            }
            catch (Exception excp)
            {
                throw excp;
            }
        }
示例#2
0
        public void userAdd(String email, String password, String name, String address, String dateOfBirth, String gender)

        {
            Console.WriteLine(email);
            if (email == "")
            {
                throw new Exception("email is empty");
            }
            if (password == "")
            {
                throw new Exception("password is empty");
            }
            if (name == "")
            {
                throw new Exception("name is empty");
            }
            if (address == "")
            {
                throw new Exception("address is empty");
            }
            if (dateOfBirth == "")
            {
                throw new Exception("dateOfBirth is empty");
            }
            if (gender == "")
            {
                throw new Exception("gender is empty");
            }

            Models.User           user      = new Models.User(email, password, name, address, dateOfBirth, gender);
            Dal.DatabaseConnector connector = new Dal.DatabaseConnector();

            try
            {
                connector.addUser(user);
            }
            catch (Exception excp)
            {
                throw excp;
            }
        }