// 로그인 버튼 클릭 시 private void Btn_Login_Click(object sender, RoutedEventArgs e) { if (login.txtID.Text.Length == 0 || login.txtID.Text.Equals("아이디")) { MessageBox.Show("아이디를 입력해주세요."); return; } if (login.txtPW.Password.Length == 0) { MessageBox.Show("비밀번호를 입력해주세요."); return; } Data.MemberVO member = DB.Login(login.txtID.Text, login.txtPW.Password); if (member == null) { MessageBox.Show("아이디 또는 비밀번호를 확인해주세요."); } else { main = new MainScreen(member); main.Btn_logout.Click += Btn_logout_Click; main.Btn_modify.Click += Btn_modify_Click; IDfindingPassword = login.txtID.Text; MainGrid.Children.Clear(); MainGrid.Children.Add(main); } }
public MemberVO Login(string id, string password) { string query = "SELECT * FROM member WHERE id = '" + id + "' AND password = '******';"; reader = SelectQuery(query); MemberVO member = null; while (reader.Read()) { member = new MemberVO(); member.ID = reader["id"].ToString(); member.Password = reader["password"].ToString(); member.Name = reader["name"].ToString(); member.Sex = int.Parse(reader["sex"].ToString()); member.Birth = reader["birth"].ToString(); member.Mail = reader["mail"].ToString(); member.PhoneNumber = reader["phonenumber"].ToString(); member.Address = reader["address"].ToString(); } reader.Close(); return(member); }
public MainScreen(Data.MemberVO member) { InitializeComponent(); this.member = member; label_welcome.Content = member.Name + "님 환영합니다!"; }