private void ActionSubmitLabel(object sender, EventArgs e) { if ((tb_name.TextLength * tb_email.TextLength * tb_pwd.TextLength * tb_cfm.TextLength * tb_addr.TextLength * tb_tel.TextLength) == 0) { MessageBox.Show("Please fill out the forms", "Warning!"); return; } if (IsDupEmail()) { MessageBox.Show("이미 회원입니다.", "가입 실패!"); return; } /* Create User Account */ NewAccount newAccount = new NewAccount() { Name = tb_name.Text, Email = tb_email.Text, RawPassword = tb_pwd.Text, RawConfirmPassword = tb_cfm.Text, Birth = de_birth.DateTime.ToString("yyMMdd"), Address = tb_addr.Text, Telephone = tb_tel.Text }; if (!newAccount.IsPasswordMatching()) { MessageBox.Show("Password mismatch"); return; } DataRow dataRow = newAccount.CreateDataRow(customersTable); customersTable.Rows.Add(dataRow); try { int ret = customersTableAdapter1.Update(customersTable); if (ret > 0) { MessageBox.Show("Update successful"); this.Close(); } else { throw new Exception(); } } catch (Exception) { MessageBox.Show("Update failed"); } }
bool CheckCustomerPassword() { customersTableAdapter1.Fill(dataSet11.CUSTOMERS); DataSet1.CUSTOMERSDataTable customerDataTable = (DataSet1.CUSTOMERSDataTable)dataSet11.Tables["CUSTOMERS"]; string email = tb_email.Text; string password = tb_password.Text; if (email.Length * password.Length < 1) { return(false); } foreach (DataRow data in customerDataTable.Rows) { if (data["c_email"].ToString() == email) { if (data["c_pwd"].ToString() == NewAccount.EncryptMD5(password + data["c_birth"].ToString())) { return(true); } } } return(false); }