private void Button_Click(object sender, RoutedEventArgs e) { string msg = string.Empty; if (!ValidatorHelper.IsValidEmail(xx.TheUser.Email)) { msg += "Email Is Not Valid\n"; } if (!ValidatorHelper.IsValidPassword(xx.TheUser.Password)) { msg += "Password Is Not Valid\n"; } if (!ValidatorHelper.IsValidPhone(xx.TheUser.Phone)) { msg += "Phone Number Is Not Valid"; } if (msg != string.Empty) { MessageBox.Show(msg); return; } ImageUtils.SendImage(xx.TheImage); xx.TheUser.Image = xx.TheImage; xx.TheUser.Sex = SexBox.SelectedItem as Sex; xx.TheUser.Preference = PreferenceBox.SelectedItem as Preference; sr.RegiserUser(xx.TheUser); //admin.ForceRefresh(); this.Close(); }
private string ValidateRegister() { string msg = string.Empty; if (!ValidatorHelper.IsValidEmail(dc.TheUser.Email)) { msg += "Email Is Not Valid\n"; } if (!ValidatorHelper.IsValidPassword(dc.TheUser.Password)) { msg += "Password Is Not Valid\n"; } if (!ValidatorHelper.IsValidPhone(dc.TheUser.Phone)) { msg += "Phone Number Is Not Valid\n"; } if (dc.TheUser.Fname == null || dc.TheUser.Fname.Length <= 1 || ValidatorHelper.HasComma(dc.TheUser.Fname)) { msg += "First Name Is Not Valid!\n"; } if (dc.TheUser.Lname == null || dc.TheUser.Lname.Length <= 1 || ValidatorHelper.HasComma(dc.TheUser.Lname)) { msg += "Last Name Is Not Valid!\n"; } if (dc.TheUser.Info == null || dc.TheUser.Info.Length <= 1 || ValidatorHelper.HasComma(dc.TheUser.Info)) { msg += "Info Is Not Valid!\n"; } if (dc.TheUser.Sex == null) { msg += "Sex Is Not Valid!\n"; } if (dc.TheUser.Preference == null) { msg += "Preference Is Not Valid!\n"; } if (dc.TheUser.AreaCode == null) { msg += "Area Code Is Not Valid!\n"; } if (dc.TheUser.Image == null || dc.TheUser.Image.Length <= 1) { msg += "Image Is Not Valid"; } return(msg); }