Ejemplo n.º 1
0
        private MemberDetails FindRecord()
        {
            var cmd = DbConnection.CreateCommand();

            cmd.CommandText = "select memberid, fname, lname, joindate from MEMBER where memberid = @id and PasswordHash = @hash";
            cmd.Parameters.AddWithValue("id", txtAccountId.Text);
            cmd.Parameters.AddWithValue("hash", PasswordHasher.ToHash(txtPassword.Text));

            MemberDetails info = null;

            using (var reader = cmd.ExecuteReader())
            {
                if (reader.Read())
                {
                    info = new MemberDetails()
                    {
                        MemberId  = reader.GetInt32(0).ToString(),
                        Firstname = reader.GetString(1),
                        Lastname  = reader.GetString(2),
                        JoinDate  = reader.GetDateTime(3)
                    };
                }
            }

            return(info);
        }
Ejemplo n.º 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            ResetErrorMessages();

            if (txtAccountId.Text.Length == 0)
            {
                setAccountIdError("value required");
            }
            else if (txtPassword.Text.Length == 0)
            {
                setPasswordError("value required");
            }
            else
            {
                var record = FindRecord();

                if (record == null)
                {
                    setAccountIdError("Record not found, please verify your credentials");
                }
                else
                {
                    MemberDetails = record;

                    DialogResult = DialogResult.OK;
                    Close();
                }
            }
        }
Ejemplo n.º 3
0
 private void btnLogout_Click(object sender, EventArgs e)
 {
     memberDetails = null;
     groupButtonsNoLogin.Show();
     groupButtonLoggedIn.Hide();
     groupMemberInfo.Hide();
 }
Ejemplo n.º 4
0
            internal void Reset()
            {
                Member  = new MemberDetails();
                DueDate = DateTime.Now;

                Selections.Clear();
                SelectedItems.Rows.Clear();
            }
Ejemplo n.º 5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            using (var form = new MemberLoginView())
            {
                form.DbConnection = DbConnection;

                var result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    memberDetails = form.MemberDetails;

                    PopulateGroupMemberInfo();

                    groupButtonsNoLogin.Hide();
                    groupButtonLoggedIn.Show();
                    groupMemberInfo.Show();
                }
            }
        }
Ejemplo n.º 6
0
        private void btnMemberLookup_Click(object sender, EventArgs e)
        {
            ClearMemberSearchErrorMessages();

            if (ValidateLoginInfo())
            {
                MemberDetails matchedAccount = SearchForMember();

                if (matchedAccount == null)
                {
                    errorMemberId.SetError(txtMemberId, Properties.Resources.MEMBER_NOT_FOUND);
                }
                else
                {
                    checkoutInfo.Member = matchedAccount;
                    ResetBookSelection();

                    TransitionToBookInput();
                }
            }
        }