protected void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         BookReviewDbEntities db = new BookReviewDbEntities();
         RandomSeed rs = new RandomSeed();
         int seed = rs.GetSeed();
         PasswordHash ph = new PasswordHash();
         Byte[] hashed = ph.HashIt(txtPassword.Text, seed.ToString());
         Reviewer rev = new Reviewer();
         rev.ReviewerFirstName = txtFirstName.Text;
         rev.ReviewerUserName = txtUserName.Text;
         rev.ReviewerLastName = txtLastName.Text;
         rev.ReviewerEmail = txtEmail.Text;
         rev.ReviewerDateEntered = DateTime.Now;
         rev.ReviewPlainPassword = txtPassword.Text;
         rev.ReviewerKeyCode = seed;
         rev.ReviewerHashedPass = hashed;
         db.Reviewers.Add(rev);
         db.SaveChanges();
         lblErrorSuccess.Text = "Reviewer Saved";
     }
     catch(Exception ex)
     {
         lblErrorSuccess.Text = ex.Message;
     }
 }
 protected void btnRegister_Click(object sender, EventArgs e)
 {
     try
     {
         BookReviewDbEntities db = new BookReviewDbEntities();
         RandomSeed           rs = new RandomSeed();
         int          seed       = rs.GetSeed();
         PasswordHash ph         = new PasswordHash();
         Byte[]       hashed     = ph.HashIt(txtPassword.Text, seed.ToString());
         Reviewer     rev        = new Reviewer();
         rev.ReviewerFirstName   = txtFirstName.Text;
         rev.ReviewerUserName    = txtUserName.Text;
         rev.ReviewerLastName    = txtLastName.Text;
         rev.ReviewerEmail       = txtEmail.Text;
         rev.ReviewerDateEntered = DateTime.Now;
         rev.ReviewPlainPassword = txtPassword.Text;
         rev.ReviewerKeyCode     = seed;
         rev.ReviewerHashedPass  = hashed;
         db.Reviewers.Add(rev);
         db.SaveChanges();
         lblErrorSuccess.Text = "Reviewer Saved";
     }
     catch (Exception ex)
     {
         lblErrorSuccess.Text = ex.Message;
     }
 }
示例#3
0
        public override void AttackTick()
        {
            var shootPosition = playerTransform.position + new Vector3(0, 1.4f, 0);
            var shootDir      = playerTransform.forward;

            int   damage   = shootDamage;
            float distance = shootDistance;
            float offset   = isAim ? shootAimOffset : shootOffset;

            Random.InitState(RandomSeed.GetSeed());
            float angle = Random.Range(-offset, offset);
            var   qa    = Quaternion.AngleAxis(angle, Vector3.up);

            shootDir = qa * shootDir;

            bool isHit = Physics.Raycast(shootPosition, shootDir, out RaycastHit shootResult, distance, (1 << 9 | 1 << 10));

            if (isHit)
            {
                var t = shootResult.transform.GetComponent <IDestructible>();
                if (t != null)
                {
                    AttackInfo attackInfo = new AttackInfo();
                    attackInfo.damage = damage;
                    t.Attack(attackInfo);
                }
                linerPool.CreatLiner(shootPosition, shootResult.point, playerTransform.rotation);
            }
            else
            {
                Vector3 end = shootPosition + shootDir * distance;
                linerPool.CreatLiner(shootPosition, end, playerTransform.rotation);
            }
            RemainBullet--;
        }