/* * Method : Page_Load * Description : Receives session Variables, authenticates credentials if they are not good redirects to login page */ protected void Page_Load(object sender, EventArgs e) { //reciveing session parameters userName = (string)(Session["UserName"]); key = (string)(Session["key"]); try { if (!this.IsPostBack) { //Testing Class for function BlackJack LoadText = new BlackJack(); deck = new List<int>(LoadText.Shuffle()); if(DB.Authenticate(userName, key) != -1) //Set for debug independent of DB { Session["status"] = "Invalid Login"; Response.Redirect("LogIn.aspx"); Card.Text = DB.Authenticate(userName, key).ToString(); } } } catch (SoapException er) { this.Card.Text = er.ToString(); } catch (Exception ex) { this.Card.Text = ex.Message; } Session["UserName"] = userName.ToString(); Session["Key"] = key.ToString(); }
/* * Method : HitMe * Returns : void * Parameters : Event handlers * Description : Pseudo takes a card off the top of the deck... not yet */ protected void HitMe(object sender, EventArgs e) { BlackJack Test = new BlackJack(); int card; double currency; card = Test.Deal(); try { currency = DB.CurrencyAmount(userName); this.Account.Text = currency.ToString(); this.Card.Text = card.ToString(); } catch (Exception ex) { this.Card.Text = ex.Message; } }