예제 #1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (UserID.Equals("") || UserName.Equals("") || Address.Equals("") || Phone.Equals("") || Password.Equals("") || Email.Equals(""))
            {
                MessageBox.Show("Please fill all blank");
            }
            else
            {
                string err = "";
                if (!vl.checkID(UserID))
                {
                    err += "Wrong ID format\n";
                }
                if (!vl.checkString(UserName, 50))
                {
                    err += "Name length <= 50\n";
                }

                if (!vl.checkString(Address, 200))
                {
                    err += "Address length <= 200\n";
                }
                if (!vl.CheckPhone(Phone))
                {
                    err += "Phone is a string has 10 number.\n";
                }
                if (!vl.checkString(Password, 50))
                {
                    err += "Password length <= 50\n";
                }
                if (!vl.checkEmail(Email))
                {
                    err += "Wrong email format\n";
                }
                if (err.Equals(""))
                {
                    if (userPresenter.InsertEmployee())
                    {
                        this.Hide();
                        ManageEmployee manageEmployee = new ManageEmployee();
                        manageEmployee.Show();
                        MessageBox.Show("Add Employee Successful!");
                    }
                    else
                    {
                        MessageBox.Show("Add Employee Failed!");
                    }
                }
                else
                {
                    MessageBox.Show(err);
                }
            }
        }
예제 #2
0
        private void btnManageEmployee_Click(object sender, EventArgs e)
        {
            ManageEmployee manageEmployee = new ManageEmployee();

            manageEmployee.Show();
        }