示例#1
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            equinox_data_access accessinfo = new equinox_data_access("1", "A", this.textBox1.Text, this.textBox2.Text, "", "", "", "", "", "", "");

            hashem        comparemeplease = new hashem();
            SqlDataReader rdr             = null;

            String ConnectionString;
            String sqlcommand;

            ConnectionString = "data source=localhost;uid=sa;password=;database=equinox";
            SqlConnection cn = new SqlConnection(ConnectionString);

            cn.Open();

            SqlCommand mySqlCommand = cn.CreateCommand();

            // find user
            sqlcommand = "select * from e_customers where customerid=@customerid and fi=@fi";

            mySqlCommand.CommandText = sqlcommand;
            // build
            mySqlCommand.Parameters.Add("@fi", SqlDbType.VarChar, 10);
            mySqlCommand.Parameters.Add("@customerid", SqlDbType.VarChar, 50);
            mySqlCommand.Parameters.Add("@pin", SqlDbType.VarChar, 128);
            //assign data
            mySqlCommand.Parameters["@fi"].Value         = 1;
            mySqlCommand.Parameters["@customerid"].Value = this.textBox1.Text;
            mySqlCommand.Parameters["@pin"].Value        = comparemeplease.makeHash(this.textBox2.Text);

            rdr = mySqlCommand.ExecuteReader();

            while (rdr.Read())
            {
                tbFirstName.Text      = rdr["firstName"].ToString();
                tbLastName.Text       = rdr["lastname"].ToString();
                tbMiddleName.Text     = rdr["middlename"].ToString();
                tbStreetAddress1.Text = rdr["streetaddress1"].ToString();
                tbStreetAddress2.Text = rdr["streetaddress2"].ToString();
                tbSuffix.Text         = rdr["suffix"].ToString();
                tbCity.Text           = rdr["city"].ToString();
                tbState.Text          = rdr["state"].ToString();
                tbZipCode.Text        = rdr["zipcode"].ToString();
                tbHomePhone.Text      = rdr["homephone"].ToString();
                tbWorkPhone.Text      = rdr["workphone"].ToString();
                tbCellPhone.Text      = rdr["cellphone"].ToString();
                tbEmail.Text          = rdr["email"].ToString();
                textBox2.Text         = rdr["pin"].ToString();
            }
        }
示例#2
0
        private void authenticate_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "institution")
            {
                institution institutionNew = new institution();
                logEm(this.textBox1.Text + " jump to institution screen", this.textBox1.Text);
                institutionNew.Show();
            }

            if (this.textBox1.Text == "mail")
            {
                mailsimple mailNew = new mailsimple();
                logEm(this.textBox1.Text + " jump to institution screen", this.textBox1.Text);
                mailNew.Show();
            }

            if (this.textBox1.Text == "admin")
            {
                admin adminActive = new admin();
                logEm(this.textBox1.Text + " jump to admin screen", this.textBox1.Text);
                adminActive.Show();
            }
            else
            {
                equinox_data_access maintaindata = new equinox_data_access();
                string outcome = maintaindata.e_customer_authenticate("1", "A", this.textBox1.Text, this.textBox2.Text);

                if (outcome == "True")
                {
                    logEm(this.textBox1.Text + " has successfully logged in", this.textBox1.Text);
                    Acct acctActive = new Acct(this.textBox1.Text); //pass username to fill the following form!
                    acctActive.Show();
                }
                if (outcome == "False")
                {
                    this.textBox1.Text = "Try Again";
                    this.textBox2.Text = "";
                }
                if (outcome == "ToMany")
                {
                    this.textBox1.Text = "To Many";
                    this.textBox2.Text = "";
                }
            }
        }