private void PassportSignInButton_Click(object sender, RoutedEventArgs e) { MemberLogin memberLogin = new MemberLogin { email = this.emailLogin.Text, password = this.passwordLogin.Password }; Dictionary <string, string> errors = memberLogin.ValidateData(); //validate if (errors != null) { if (memberSerice.Login(memberLogin) != null) { this.login_er.Visibility = Visibility.Collapsed; Naview.isUser = true; MemberServiceImp.isUSer(); } else { this.login_er.Text = "Wrong login information!"; this.login_er.Visibility = Visibility.Visible; } } else { if (errors.ContainsKey("introduction")) { this.emailLogin_er.Text = errors["introduction"]; this.emailLogin_er.Visibility = Visibility.Visible; } else { this.emailLogin_er.Visibility = Visibility.Collapsed; } if (errors.ContainsKey("introduction")) { this.passwordLogin_er.Text = errors["introduction"]; this.emailLogin_er.Visibility = Visibility.Visible; } else { this.passwordLogin_er.Text = ""; this.emailLogin_er.Visibility = Visibility.Collapsed; } } }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { var newMember = new Member() { firstName = this.firstname.Text, lastName = this.lastname.Text, avatar = this.imgUrl, phone = this.phone.Text, password = this.password.Password, address = this.address.Text, introduction = this.introduction.Text, birthday = this.Birthday.Date.ToString("yyyy-MM-dd"), email = this.email.Text, gender = this.gender, }; //validate Dictionary<string, string> errors = newMember.ValidateData(); if(errors.Count == 0) { memberService.logout(); var member = memberService.Register(newMember); if (member != null) { MemberServiceImp.isUSer(); } else { } } else { Debug.WriteLine("erroi register"); if (errors.ContainsKey("firstname")) { this.firstname_er.Text = errors["firstname"]; } else { this.firstname_er.Text = ""; } if (errors.ContainsKey("lastname")) { this.lastname_er.Text = errors["lastname"]; } else { this.lastname_er.Text = ""; } if (errors.ContainsKey("address")) { this.address_er.Text = errors["address"]; } else { this.address_er.Text = ""; } if (errors.ContainsKey("password")) { this.password_er.Text = errors["password"]; } else { this.password_er.Text = ""; } if (errors.ContainsKey("introduction")) { this.introduction_er.Text = errors["introduction"]; } else { this.introduction_er.Text = ""; } if (errors.ContainsKey("phone")) { this.phone_er.Text = errors["phone"]; } else { this.phone_er.Text = ""; } if (errors.ContainsKey("email")) { this.email_er.Text = errors["email"]; } else { this.email_er.Text = ""; } //this.birthday_er.Text = errors["birthday"]; //this.gender_er.Text = errors["gender"]; } }