Ejemplo n.º 1
0
        protected void btnRiderRegister_Click(object sender, EventArgs e)
        {
            Boolean isFullTime;

            if (txtRName.Text.Length <= 0)
            {
                lblRNameMsg.Text = "Name cannot be blank";
            }

            if (txtRUserName.Text.Length <= 0)
            {
                lblRUsernameMsg.Text = "Username cannot be blank";
            }

            if (txtRPassword.Text.Length <= 0)
            {
                lblRPasswordMsg.Text = "Password cannot be blank";
            }

            if (chkBoxFullTime.Checked == true)
            {
                isFullTime = true;
            }

            else
            {
                isFullTime = false;
            }

            if (txtRName.Text.Length > 0 && txtRUserName.Text.Length > 0 && txtRPassword.Text.Length > 0)
            {
                UserAccountBLL uBLL          = new UserAccountBLL();
                int            checkUserName = uBLL.DoCheckUserNameExists(txtRUserName.Text);

                //If username exists
                if (checkUserName > 0)
                {
                    alertFailure.Visible = true;
                    lblAlertMsg.Text     = "Username Exists in Database. Please use another username";
                    ClearTextFieldAndMessages();
                }

                else
                {
                    int result = uBLL.DoCreateNewRider(txtRName.Text, txtRUserName.Text, txtRPassword.Text, isFullTime);

                    if (result > 0)
                    {
                        alertSuccess.Visible = true;
                    }

                    else
                    {
                        alertFailure.Visible = true;
                        lblAlertMsg.Text     = "Unable to create a new rider account";
                        ClearTextFieldAndMessages();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected void btn_CreateStaff_Click(object sender, EventArgs e)
        {
            if (txtStaffName.Text.Length <= 0)
            {
                lblStaffNameMsg.Text = "Staff Name Cannot Be Blank";
            }

            if (txtStaffUsername.Text.Length <= 0)
            {
                lblStaffUsernameMsg.Text = "Staff Username Cannot Be Blank";
            }

            if (txtStaffPassword.Text.Length <= 0)
            {
                lblStaffPasswordMsg.Text = "Staff Password Cannot Be Blank";
            }

            if (txtStaffName.Text.Length > 0 && txtStaffUsername.Text.Length > 0 && txtStaffPassword.Text.Length > 0)
            {
                UserAccountBLL uBLL          = new UserAccountBLL();
                int            checkUserName = uBLL.DoCheckUserNameExists(txtStaffUsername.Text);

                if (checkUserName > 0)
                {
                    alertFailure.Visible = true;
                    lblAlertMsg.Text     = "Staff Username has already existed";
                }

                else
                {
                    int result = uBLL.DoCreateNewStaff(txtStaffName.Text, txtStaffUsername.Text, txtStaffPassword.Text, Convert.ToInt32(txtRestId.Text));
                    if (result > 0)
                    {
                        alertSuccess.Visible = true;
                    }

                    else
                    {
                        alertFailure.Visible = true;
                        lblAlertMsg.Text     = "Unable to create a new staff account";
                        ClearTextFieldAndMessages();
                    }
                }
            }
        }