Exemple #1
0
 protected void btnSignup_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txtFullName.Text) || string.IsNullOrWhiteSpace(txtUsername.Text) || string.IsNullOrWhiteSpace(txtPassword.Text))
     {
         litMessage.Text = "Name, Username and Password fields are mandatory.";
         divAlert.Attributes["class"] += " alert-danger";
         divAlert.Visible              = true;
     }
     else
     {
         bool inserted = UserDBHelper.InsertUser(txtFullName.Text, txtUsername.Text, txtPassword.Text, txtEmail.Text, txtMobile.Text);
         if (!inserted)
         {
             litMessage.Text = "Please choose another Username.";
             divAlert.Attributes["class"] += " alert-danger";
             divAlert.Visible              = true;
         }
         else
         {
             litMessage.Text = "Signup success for Username <strong>" + txtUsername.Text + "</strong>";
             divAlert.Attributes["class"] += " alert-success";
             divAlert.Visible              = true;
         }
     }
 }