コード例 #1
0
    //get the user info from database
    private void GetUserInfo()
    {
        //declare the ADO Entities
        ShowTrackerEntities stdbe = new ShowTrackerEntities();
        //query the fields
        var info = from i in stdbe.FanLogins
                   where i.FanLoginUserName.Equals(username)
                   select new { i.FanKey, i.FanLoginHashed, i.FanLoginRandom };//FanLoginRandom is the random number

        //loop through the results and assign the
        //values to the field variables
        foreach (var u in info)
        {
            seed   = u.FanLoginRandom;
            dbHash = u.FanLoginHashed;
            key    = (int)u.FanKey;//cast it to an int
        }
    }
コード例 #2
0
    private void GetUserInfo()
    {
        ShowTrackerEntities db = new ShowTrackerEntities();

        var info = from i in db.VenueLogins
                   where i.VenueLoginUserName.Equals(username)
                   select new { i.VenueLoginRandom, i.VenueLoginHashed, i.VenueLoginKey, i.VenueKey };

        foreach (var u in info)
        {
            seed   = (int)u.VenueLoginRandom;
            dbHash = u.VenueLoginHashed;
            if (u.VenueLoginKey != null)
            {
                key = (int)u.VenueKey;
            }
        }
    }
コード例 #3
0
    //gets the user info from the database
    private void GetUserInfo()
    {
        //declare the ADO Entities
        ShowTrackerEntities db = new ShowTrackerEntities();
        //query the fields
        var info = from i in db.FanLogins
                   where i.FanLoginUserName.Equals(username)
                   select new { i.FanKey, i.FanLoginHashed, i.FanLoginRandom };

        //loop through the results and assign the
        //values to the field variables
        foreach (var u in info)
        {
            seed = u.FanLoginRandom;
            dbhash = u.FanLoginHashed;
            key = (int)u.FanKey;
        }
    }
コード例 #4
0
    //gets the user info from the database
    private void GetUserInfo()
    {
        //declare the ADO Entities
        ShowTrackerEntities db = new ShowTrackerEntities();
        //query the fields
        var info = from i in db.VenueLogins
                   where i.VenueLoginUserName.Equals(username)
                   select new { i.VenueLoginKey, i.VenueLoginHashed, i.VenueLoginRandom };

        //loop through the results and assign the
        //values to the field variables
        foreach (var u in info)
        {
            seed   = u.VenueLoginRandom;
            dbhash = u.VenueLoginHashed;
            key    = (int)u.VenueLoginKey;
        }
    }
コード例 #5
0
    private void GetUserInfo()
    {
        ShowTrackerEntities db = new ShowTrackerEntities();

        var info = from f in db.FanLogins
                   where f.FanLoginUserName.Equals(username)
                   select new { f.FanLoginRandom, f.FanKey, f.FanLoginHashed };

        foreach (var u in info)
        {
            seed   = (int)u.FanLoginRandom;
            dbHash = u.FanLoginHashed;
            if (u.FanKey != null)
            {
                key = (int)u.FanKey;
            }
        }
    }
コード例 #6
0
ファイル: Registration.aspx.cs プロジェクト: jcrimp/ITC172-A3
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        //instatiate classes
        ShowTrackerEntities stdbe = new ShowTrackerEntities();
        KeyCode             k     = new KeyCode();
        int          seed         = k.GetKeyCode();//get the seed
        PasswordHash phash        = new PasswordHash();

        try//try code for errors
        {
            //get the hashed password
            byte[] pass = phash.HashIt(txtConfirm.Text, seed.ToString());

            //assign values from the text boxes to the fields of the Reviewer Class
            Fan      f  = new Fan();
            FanLogin fl = new FanLogin();

            f.FanName                = txtFirstName.Text + " " + txtLastName.Text;
            fl.FanLoginUserName      = txtUserName.Text;
            f.FanEmail               = txtEmail.Text;
            fl.FanLoginPasswordPlain = txtPassword.Text;
            fl.FanLoginRandom        = seed;//assign the random seed to FanLoginRandom
            fl.FanLoginPasswordPlain = txtConfirm.Text;
            fl.FanLoginHashed        = pass;
            fl.FanLoginDateAdded     = DateTime.Now;
            fl.Fan           = f;
            f.FanDateEntered = DateTime.Now;
            //save changes
            stdbe.Fans.Add(f);//Fans is a collection of Fan (once they are created)
            stdbe.FanLogins.Add(fl);

            stdbe.SaveChanges();
            //lblErrorSuccess.Text = "You were successfully registered";
            Response.Redirect("Default.aspx?msg='You were successfully registered'");
        }

        catch (Exception ex)
        {
            lblErrorSuccess.Text = ex.Message;
        }
    }
コード例 #7
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        ShowTrackerEntities db = new ShowTrackerEntities();
        KeyCode             k  = new KeyCode();
        int          seed      = k.GetKeyCode();
        PasswordHash phash     = new PasswordHash();

        try
        {
            byte[] pass = phash.HashIt(txtConfirm.Text, seed.ToString());

            Fan f = new Fan();
            f.FanName  = txtName.Text;
            f.FanEmail = txtEmail.Text;
            db.Fans.Add(f);
            db.SaveChanges();

            //Select FanKey in order to tie two tables together
            var fanKey = (from ff in db.Fans
                          where ff.FanName == txtName.Text
                          select ff.FanKey).First();

            FanLogin fl = new FanLogin();
            fl.FanLoginUserName      = txtUserName.Text;
            fl.FanLoginRandom        = seed;
            fl.FanLoginPasswordPlain = txtConfirm.Text;
            fl.FanLoginHashed        = pass;
            fl.FanLoginDateAdded     = DateTime.Now;
            fl.FanKey = Convert.ToInt32(fanKey);

            db.FanLogins.Add(fl);
            db.SaveChanges();
            lblErrorSuccess.Text = "You were successfully registered.";
        }
        catch (Exception ex)
        {
            lblErrorSuccess.Text = ex.Message;
        }
    }
コード例 #8
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        try
        {
            ShowTrackerEntities db = new ShowTrackerEntities();
            Fan      f             = new Fan();
            FanLogin fl            = new FanLogin();
            fl.Fan = f;

            f.FanName        = txtFirstName.Text + " " + txtLastName.Text;
            f.FanEmail       = txtEmail.Text;
            f.FanDateEntered = DateTime.Now;

            fl.FanLoginUserName      = txtUserName.Text;
            fl.FanLoginDateAdded     = DateTime.Now;
            fl.FanLoginPasswordPlain = txtPassword.Text;

            KeyCode kc   = new KeyCode();
            int     code = kc.GetKeyCode();

            PasswordHash ph     = new PasswordHash();
            Byte[]       hashed = ph.HashIt(txtPassword.Text, code.ToString());

            fl.FanLoginRandom = code;
            fl.FanLoginHashed = hashed;

            db.Fans.Add(f);

            fl.Fan = f;
            db.FanLogins.Add(fl);

            db.SaveChanges();
            lblErrorSuccess.Text = "Reviewer Saved";
        }
        catch (Exception ex)
        {
            lblErrorSuccess.Text = ex.Message;
        }
    }
コード例 #9
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        try
        {
            ShowTrackerEntities db = new ShowTrackerEntities();
            Fan f = new Fan();
            FanLogin fl = new FanLogin();
            fl.Fan = f;

            f.FanName = txtFirstName.Text + " " + txtLastName.Text;
            f.FanEmail = txtEmail.Text;
            f.FanDateEntered = DateTime.Now;

            fl.FanLoginUserName = txtUserName.Text;
            fl.FanLoginDateAdded = DateTime.Now;
            fl.FanLoginPasswordPlain = txtPassword.Text;

            KeyCode kc = new KeyCode();
            int code = kc.GetKeyCode();

            PasswordHash ph = new PasswordHash();
            Byte[] hashed = ph.HashIt(txtPassword.Text, code.ToString());

            fl.FanLoginRandom = code;
            fl.FanLoginHashed = hashed;

            db.Fans.Add(f);

            fl.Fan = f;
            db.FanLogins.Add(fl);

            db.SaveChanges();
            lblErrorSuccess.Text = "Reviewer Saved";
        }
        catch (Exception ex)
        {
            lblErrorSuccess.Text = ex.Message;
        }
    }
コード例 #10
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        ShowTrackerEntities brde = new ShowTrackerEntities();
        KeyCode             k    = new KeyCode();
        int          seed        = k.GetKeyCode();
        PasswordHash phash       = new PasswordHash();

        /*    try
         *  { */
        byte[] pass = phash.HashIt(txtConfirm.Text, seed.ToString());

        FanLogin fnl = new FanLogin();
        Fan      fn  = new Fan();

        fn.FanName           = txtFanName.Text;
        fn.FanEmail          = txtEmail.Text;
        fnl.FanLoginUserName = txtUserName.Text;
        fnl.Fan = fn;
        fnl.FanLoginPasswordPlain = txtConfirm.Text;
        fnl.FanLoginRandom        = seed;
        fnl.FanLoginHashed        = pass;


        brde.Fans.Add(fn);
        brde.FanLogins.Add(fnl);

        brde.SaveChanges();

        lblErrorSuccess.Text = "You were successfully registered";



        //}

        /*   catch (Exception ex)
         * {
         *     lblErrorSuccess.Text = ex.Message;
         * }*/
    }