protected void lbRetrival_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtEmail.Text.Trim() == "")
                {
                    lblpopupErrorMsg.Text = "Email address should not be empty.";
                    mpeForgotPW.Show();
                    return;
                }

                if (!BOValidation.IsEmail(txtEmail.Text.Trim()))
                {
                    lblpopupErrorMsg.Text = "Email address is not valid.";
                    mpeForgotPW.Show();
                    return;
                }


                RetrievePassword();
            }
            catch (Exception ex)
            {
                lblErrMessage.Text = ex.Message;
            }
        }
        protected void lbSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtFirstName.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "First Name should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtLastName.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "Last Name should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtUserName.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "User Name should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtPassword.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "Password should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtEmail.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "Email should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (!BOValidation.IsEmail(txtEmail.Text.Trim()))
                {
                    lblErrorMsg.Text = "Email is not valid";
                    mpePopup.Show();
                    return;
                }


                (new BOUsers()).Register(txtUserName.Text.Trim(), txtPassword.Text.Trim(), txtFirstName.Text.Trim(),
                                         txtLastName.Text.Trim(), txtEmail.Text.Trim(), txtPhone.Text.Trim());

                ClearPanel();
                upRegister.Visible = false;
                mpePopup.Hide();
            }
            catch (Exception ex)
            {
                lblErrorMsg.Text = ex.Message;
            }
        }
Exemple #3
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtUserName.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "User name should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtFirstName.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "First name should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtLastName.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "Last name should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (txtEmail.Text.Trim() == "")
                {
                    lblErrorMsg.Text = "Email should not be empty";
                    mpePopup.Show();
                    return;
                }

                if (!BOValidation.IsEmail(txtEmail.Text.Trim()))
                {
                    lblErrorMsg.Text = "Invalid email address";
                    mpePopup.Show();
                    return;
                }

                BOUsers boUsers = new BOUsers();
                if (hfUserID.Value != "")
                {
                    boUsers.UpdateUser(int.Parse(hfUserID.Value), txtUserName.Text.Trim(), txtFirstName.Text.Trim(),
                                       txtLastName.Text.Trim(), txtEmail.Text.Trim(), txtPhone.Text.Trim(), int.Parse(ddlStates.SelectedValue), int.Parse(ddlTeams.SelectedValue));
                }
                else
                {
                    if (txtPW.Text.Trim() == "")
                    {
                        lblErrorMsg.Text = "Password should not be empty";
                        mpePopup.Show();
                        return;
                    }

                    boUsers.SaveUser(txtUserName.Text.Trim(), txtPW.Text.Trim(), txtFirstName.Text.Trim(),
                                     txtLastName.Text.Trim(), txtEmail.Text.Trim(), txtPhone.Text.Trim(), int.Parse(ddlStates.SelectedValue), int.Parse(ddlTeams.SelectedValue));
                }
                ClearPanel();
                upAddEditUser.Visible = false;
                SaveButtonClicked(sender, e);
            }
            catch (Exception ex)
            {
                lblErrorMsg.Text = ex.Message;
                mpePopup.Show();
            }
        }