private void btnAdd_Click(object sender, EventArgs e)
        {
            if (validator1.Validate())
            {
                short userType = 0;
                string o = cbUserType.Text;
                if (o != null && o != "" && o != " ")
                {
                    if (o.Contains(BHConstant.USER_TYPE_NAME1))
                    {
                        userType = BHConstant.USER_TYPE_ID1;
                    }
                    else if (o.Contains(BHConstant.USER_TYPE_NAME2))
                    {
                        userType = BHConstant.USER_TYPE_ID2;
                    }
                    else if (o.Contains(BHConstant.USER_TYPE_NAME3))
                    {
                        userType = BHConstant.USER_TYPE_ID3;
                    }
                }
                if (systemUser != null)
                {
                    systemUser.FullName = txtName.Text;
                    if (txtPass.Text != "" && txtConfirmPass.Text != "" && txtPass.Text.Equals(txtConfirmPass.Text))
                    {
                        systemUser.Password = txtPass.Text;
                    }

                    systemUser.Type = userType;

                    SystemUserService systemUserService = new SystemUserService();
                    if (systemUserService.UpdateSystemUser(systemUser))
                    {
                        MessageBox.Show("Người dùng đã được cập nhật thành công");
                        ((SystemUserList)this.CallFromUserControll).loadSystemUserList();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Hiện tại hệ thống đang có lỗi. Vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    systemUser = new SystemUser
                    {
                        FullName = txtName.Text,
                        Password = txtPass.Text,
                        Type = userType,
                        Username = txtCode.Text
                    };
                    SystemUserService systemUserService = new SystemUserService();
                    if (systemUserService.AddPSystemUser(systemUser))
                    {
                        MessageBox.Show("Người dùng đã được tạo thành công");
                        ((SystemUserList)this.CallFromUserControll).loadSystemUserList();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Hiện tại hệ thống đang có lỗi. Vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (validator1.Validate())
            {
                short  userType = 0;
                string o        = cbUserType.Text;
                if (o != null && o != "" && o != " ")
                {
                    if (o.Contains(BHConstant.USER_TYPE_NAME1))
                    {
                        userType = BHConstant.USER_TYPE_ID1;
                    }
                    else if (o.Contains(BHConstant.USER_TYPE_NAME2))
                    {
                        userType = BHConstant.USER_TYPE_ID2;
                    }
                    else if (o.Contains(BHConstant.USER_TYPE_NAME3))
                    {
                        userType = BHConstant.USER_TYPE_ID3;
                    }
                }
                if (systemUser != null)
                {
                    systemUser.FullName = txtName.Text;
                    if (txtPass.Text != "" && txtConfirmPass.Text != "" && txtPass.Text.Equals(txtConfirmPass.Text))
                    {
                        systemUser.Password = txtPass.Text;
                    }

                    systemUser.Type = userType;

                    SystemUserService systemUserService = new SystemUserService();
                    if (systemUserService.UpdateSystemUser(systemUser))
                    {
                        MessageBox.Show("Người dùng đã được cập nhật thành công");
                        ((SystemUserList)this.CallFromUserControll).loadSystemUserList();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Hiện tại hệ thống đang có lỗi. Vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    systemUser = new SystemUser
                    {
                        FullName = txtName.Text,
                        Password = txtPass.Text,
                        Type     = userType,
                        Username = txtCode.Text
                    };
                    SystemUserService systemUserService = new SystemUserService();
                    if (systemUserService.AddPSystemUser(systemUser))
                    {
                        MessageBox.Show("Người dùng đã được tạo thành công");
                        ((SystemUserList)this.CallFromUserControll).loadSystemUserList();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Hiện tại hệ thống đang có lỗi. Vui lòng thử lại sau!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }