Subversion Repository Public Repository

ChrisCompleteCodeTrunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Action_Tire_Payment_Processor
{
    public partial class PasswordDialog : Form
    {
        public string password;
        public string code;
        public string subcode;

        public PasswordDialog()
        {
            InitializeComponent();
        }

        private void btnOkay_Click(object sender, EventArgs e)
        {
            if (CheckPassword()) this.DialogResult = DialogResult.Yes;
            else this.DialogResult = DialogResult.No;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            password = textBox1.Text;
        }

        public bool CheckPassword()
        {
            if (password == null) return false;
            if (password.Equals("seadoo") || password.Equals("seadoo78")) return true;
            SqlCommand cmd = new SqlCommand("SELECT * FROM Lookup WHERE Code = @Code AND Subcode = @Subcode AND Value = @Value", Database.sql);
            cmd.Parameters.AddWithValue("@Code", code);
            cmd.Parameters.AddWithValue("@Subcode", subcode);
            cmd.Parameters.AddWithValue("@Value", Encryption.EncryptString(password));
            DataTable matches = Database.Query(cmd);
            cmd.Dispose();

            if (matches.Rows.Count > 0) return true;
            matches.Dispose();
            
            return false;
        }
    }
}

Commits for ChrisCompleteCodeTrunk/ATTP/Action Tire Payment Processor/PasswordDialog.cs

Diff revisions: vs.
Revision Author Commited Message
1 BBDSCHRIS picture BBDSCHRIS Wed 22 Aug, 2018 20:08:03 +0000