protected void btn_play_Click(object sender, EventArgs e)
    {
        using (var context = new Testdata1Entities())
        {
            string username = Session["username"].ToString();
            var    a        = from u in context.accountdetails
                              where u.user_name == username
                              select u;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                if (b.balance != "0")
                {
                    Response.Redirect("~/BlackJack.aspx");
                }
                else
                {
                    lbl_err.Text = "Your wallet is empty. Please add cash to your profile before proceeding.";
                }
            }

            else
            {
                lbl_err.Text = "You wallet is empty. Please add cash to your profile";
            }
        }
    }
예제 #2
0
    public void updatescore(string val)
    {
        int    betamount = Convert.ToInt32(Session["bet"].ToString());
        string username  = Session["username"].ToString();

        using (var context = new Testdata1Entities())
        {
            var newa = from u in context.accountdetails
                       where u.user_name == username
                       select u;
            var newb = newa.FirstOrDefault();
            int bal  = Convert.ToInt32(newb.balance);
            if (val == "dealer")
            {
                bal = bal - 0;
            }
            else if (val == "player")
            {
                bal = bal + 2 * betamount;
            }
            else
            {
                bal = bal + betamount;
            }
            string final = Convert.ToString(bal);
            lbl_cashavail.Text      = String.Format("Wallet - $ {0}", final);
            lbl_cashavail.ForeColor = System.Drawing.Color.Red;
            newb.balance            = final;
            context.SaveChanges();

            enable("play");
        }
    }
예제 #3
0
    protected void Loginbtn_Click(object sender, EventArgs e)
    {
        string username = Usertxt.Text;
        string password = Pwdtxt.Text;

        if (username == "" || Pwdtxt.Text == "")
        {
            Errmsg.ForeColor = Color.Red;
            Errmsg.Text      = "Invalid Username or password";
        }
        using (var context = new Testdata1Entities())
        {
            var a = from u in context.users
                    where u.user_name == username && u.password == password
                    select u;
            var b = a.FirstOrDefault();
            if (b == null)
            {
                Errmsg.ForeColor = Color.Red;
                Errmsg.Text      = "Password is mismatching";
            }
            else
            {
                Session["username"] = username;
                Response.Redirect("~/AfterLogin.aspx");
            }
        }
    }
    protected void Registerbtn_Click(object sender, EventArgs e)
    {
        string username = Usertxt.Text;
        string pwd1     = Pwd1txt.Text;
        string pwd2     = Pwd2txt.Text;

        if (username != "")
        {
            if (pwd1 != pwd2 || pwd1 == "" || pwd2 == "")
            {
                ErrMsg.Visible   = true;
                ErrMsg.ForeColor = Color.Red;
                ErrMsg.Text      = "Password Mismatch or No password. Try again";
                return;
            }
            using (var context = new Testdata1Entities())
            {
                var check = from u in context.users
                            where u.user_name == username
                            select u;
                var b = check.FirstOrDefault();
                if (b == null)
                {
                    #region Insert UserName
                    user a = new user();
                    a.user_name = username;
                    a.password  = pwd1;
                    context.users.Add(a);
                    context.SaveChanges();
                    Regislabel.Text      = "Registration Completed succesfully";
                    Regislabel.ForeColor = Color.Green;
                    Response.Redirect("~/Login.aspx");
                    #endregion Insert UserName
                }
                else
                {
                    #region UserName already exists
                    ErrMsg.Visible   = true;
                    ErrMsg.ForeColor = Color.Red;
                    ErrMsg.Text      = "User Name already exists.";
                    return;

                    #endregion UserName already exists
                }
            }
            ErrMsg.Visible = false;
        }
        else
        {
            #region Invalid Password
            ErrMsg.Visible   = true;
            ErrMsg.ForeColor = Color.Red;
            ErrMsg.Text      = "Please enter a valid Password";
            #endregion Invalid Password
        }
    }
예제 #5
0
    public void pontstable(string val, string val1)
    {
        string username = Session["username"].ToString();

        using (var context = new Testdata1Entities())
        {
            var prof = new profile();
            prof.user_name = username;
            prof.played    = true;
            if (val == "dealer")
            {
                prof.won       = false;
                prof.lost      = true;
                prof.blackjack = false;
                prof.push      = false;
            }
            else if (val == "player")
            {
                prof.won  = true;
                prof.lost = true;
                if (val1 == "blackjack")
                {
                    prof.blackjack = true;
                }
                else
                {
                    prof.blackjack = false;
                }
                prof.push = false;
            }
            else if (val == "push")
            {
                prof.won       = false;
                prof.lost      = false;
                prof.blackjack = false;
                prof.push      = true;
            }
            context.profiles.Add(prof);
            context.SaveChanges();
        }
        using (var context1 = new Testdata1Entities())
        {
            user_scores user = new user_scores();
            user.user_name = username;
            user.score     = Convert.ToInt32(hdn_point_player.Value.ToString());
            context1.user_scores.Add(user);
            context1.SaveChanges();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
     }
     lbl.Text = Session["username"].ToString() + ", you have logged in successfully.";
     using (var context = new Testdata1Entities())
     {
         var a = (from u in context.user_scores
                  orderby u.score descending
                  select u).Take(10).ToList();
         ScoreGrid.DataSource = a;
         ScoreGrid.DataBind();
     }
 }
예제 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string username = Session["username"].ToString(); //  "Mukesh"; //
         using (var context = new Testdata1Entities())
         {
             var a = from u in context.accountdetails
                     where u.user_name == username
                     select u;
             var b = a.FirstOrDefault();
             lbl_cashavail.Text = String.Format("Wallet - $ {0}", b.balance);;
         }
     }
 }
예제 #8
0
 protected void btn_bet_Click(object sender, EventArgs e)
 {
     if (!txt_bet.Visible)
     {
         txt_bet.Visible = true;
         txt_bet.Focus();
     }
     else
     {
         string username = Session["username"].ToString(); // "Mukesh"; //"Mukesh"; //
         if (txt_bet.Text == "" || txt_bet.Text == "0" || txt_bet.Text.Contains("-") || txt_bet.Text.Contains("."))
         {
             lbl_caution.Text      = "Please enter a valid amount to bet";
             lbl_caution.BackColor = System.Drawing.Color.Red;
             lbl_caution.Font.Bold = true;
         }
         else
         {
             lbl_caution.Text = "";
             int amount = Convert.ToInt32(txt_bet.Text);
             Session["bet"] = txt_bet.Text;
             using (var context = new Testdata1Entities())
             {
                 var a = from u in context.accountdetails
                         where u.user_name == username
                         select u;
                 var b          = a.FirstOrDefault();
                 int cashinhand = Convert.ToInt32(b.balance);
                 int newbet     = cashinhand - amount;
                 if (newbet >= 0)
                 {
                     b.balance = Convert.ToString(newbet);
                     context.SaveChanges();
                     lbl_raisebet.Text  = "Bet $ " + amount;
                     lbl_cashavail.Text = String.Format("Wallet - $ {0}", newbet);
                     enable("bet");
                 }
                 else
                 {
                     lbl_caution.Text      = String.Format("Sorry, you cant bet above your wallet limit. Your bet limit is $ {0}", b.balance);
                     lbl_caution.BackColor = System.Drawing.Color.Red;
                 }
             }
         }
     }
 }
    public void scorecard()
    {
        tbl_sc.Visible = true;
        tbl_cp.Visible = false;
        string username  = Session["username"].ToString();
        int    played    = 0;
        int    won       = 0;
        int    blackjack = 0;
        int    lost      = 0;
        int    push      = 0;

        using (var context = new Testdata1Entities())
        {
            var a = (from u in context.profiles
                     where u.user_name == username
                     select u).ToList();

            foreach (var c in a)
            {
                if (c.won)
                {
                    won++;
                }
                if (c.blackjack)
                {
                    blackjack++;
                }
                if (c.push == true)
                {
                    push++;
                }
                played++;
            }
        }
        lost              = played - won - push;
        playedlbl.Text    = played + "";
        wonlbl.Text       = won + "";
        lostlbl.Text      = lost + "";
        blackjacklbl.Text = blackjack + "";
        usernamelbl.Text  = username;
        puslbl.Text       = push + "";
    }
    protected void changepwdbtn_Click(object sender, EventArgs e)
    {
        string oldpwd   = oldpwdtxt.Text;
        string newpwd   = newpwdtxt.Text;
        string renewpwd = repwdtxt.Text;
        string username = Session["username"].ToString();

        if (oldpwd == "" || newpwd == "" || renewpwd == "")
        {
            msglbl.Text      = "Password cannot be empty";
            msglbl.BackColor = System.Drawing.Color.Red;
            return;
        }
        using (var context = new Testdata1Entities())
        {
            var a = from u in context.users
                    where u.password == oldpwd && u.user_name == username
                    select u;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                if (newpwd == renewpwd)
                {
                    b.password = newpwd;
                    context.SaveChanges();
                    msglbl.Text      = "Your password has been changed.";
                    msglbl.BackColor = System.Drawing.Color.Red;
                }
                else
                {
                    msglbl.Text      = "Password mismatch.";
                    msglbl.BackColor = System.Drawing.Color.Red;
                }
            }
            else if (b == null)
            {
                msglbl.Text      = "Incorrect existing password.";
                msglbl.BackColor = System.Drawing.Color.Red;
            }
        }
    }
    public void Paymentclick(string val)
    {
        string username = Session["username"].ToString();

        tbl_bal.Visible = true;
        tbl_cp.Visible  = false;
        tbl_sc.Visible  = false;

        using (var context = new Testdata1Entities())
        {
            var a = from u in context.accountdetails
                    where u.user_name == username
                    select u;
            lbl_username.Text = username;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                string c = "";
                if (val == "button")
                {
                    bal_lbl.Text = b.balance;
                }
                else if (val == "Reload")
                {
                    c            = Session["amount"].ToString();
                    bal_lbl.Text = c;
                }
            }
            else
            {
                bal_lbl.Text      = "0";
                bal_lbl.BackColor = System.Drawing.Color.Red;
                err_lbl.Text      = "You dont have adequate fund to continue playing.Please load your wallet instantly";
            }
        }
    }
예제 #12
0
    protected void Proceedbtn_Click(object sender, EventArgs e)
    {
        #region Error-Validation
        if (cardnotxt.Text.Length != 16)
        {
            cautionlbl.Text      = "Invalid card number.Please enter the 16 digit card number again.";
            cautionlbl.ForeColor = Color.Red;
            return;
        }
        if (cvvtxt.Text.Length != 3)
        {
            cautionlbl.Text      = "Invalid cvv number.Please enter the 3 digit cvv number again.";
            cautionlbl.ForeColor = Color.Red;
            return;
        }
        if (nametxt.Text.Length == 0)
        {
            cautionlbl.Text      = "Please enter a valid name.";
            cautionlbl.ForeColor = Color.Red;
            return;
        }

        char[] cardno = cardnotxt.Text.ToCharArray();
        int    length = cardno.Length;
        for (int i = 0; i < length; i++)
        {
            if (!char.IsDigit(cardno[i]))
            {
                cautionlbl.Text      = "Only number is allowed in card number.";
                cautionlbl.ForeColor = Color.Red;
                return;
            }
        }
        #endregion

        #region logica-part
        int    amount   = Convert.ToInt32(Session["amount"].ToString());
        string username = Session["username"].ToString();
        using (var context = new Testdata1Entities())
        {
            string cash = "";
            var    a    = from u in context.accountdetails
                          where u.user_name == username
                          select u;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                cash      = (Convert.ToInt32(b.balance) + amount).ToString();
                b.balance = cash;

                context.SaveChanges();
                Session["amount"] = cash;
            }
            else
            {
                cash = amount.ToString();
                accountdetail d = new accountdetail();
                d.balance   = cash;
                d.user_name = username;
                context.accountdetails.Add(d);
                context.SaveChanges();
            }
        }
        Session["redirect"] = "success";
        Response.Write("<script>");
        Response.Write("window.open('UserProfile.aspx','_parent')");
        Response.Write("</script>");
        #endregion
    }
예제 #13
0
    protected void btn_deal_Click(object sender, EventArgs e)
    {
        #region valiidation
        string username = Session["username"].ToString();// "Mukesh;"//
        using (var context = new Testdata1Entities())
        {
            var a = from u in context.accountdetails
                    where u.user_name == username
                    select u;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                //  lbl_cash.Text = b.balance;
                // lbl_cash.ForeColor = System.Drawing.Color.Green;
            }
        }
        int betamount   = Convert.ToInt32(txt_bet.Text);
        int dealerpoint = Convert.ToInt32(hdn_point_dealer.Value);
        int playerpoint = Convert.ToInt32(hdn_point_player.Value);
        #endregion

        #region random logic
        var    handcard = new List <CardInfo>();
        Random random   = new Random();
        using (var context = new Testdata1Entities())
        {
            for (int i = 0; i < 4; i++)
            {
                var a = (from u in context.CardInfoes
                         select u).ToList();
                int index = random.Next(1, a.Count());
                //int[] index = {1, 13};
                if (hdn_dealer_check.Value == "0" && i % 2 == 0)
                {
                    hdn_dealer_check.Value = hdn_dealer_check.Value.ToString() + Convert.ToString(a[index].CardInfoId);
                }

                else if (i % 2 == 0)
                {
                    hdn_dealer_check.Value = hdn_dealer_check.Value.ToString() + "," + Convert.ToString(a[index].CardInfoId);
                }
                if (hdn_card.Value == "" && i % 2 == 1)
                {
                    hdn_card.Value = hdn_card.Value.ToString() + Convert.ToString(a[index].CardInfoId);
                }
                else if (i % 2 == 1)
                {
                    hdn_card.Value = hdn_card.Value.ToString() + "," + Convert.ToString(a[index].CardInfoId);
                }

                var cardrandom = a[index]; // getting the random no n storing the particular card with that random no
                handcard.Add(cardrandom);  // adding it to the handcard
                a.Remove(cardrandom);      // removing the card from the card list so that card wont repeat again

                #endregion

                #region dealer
                if (i % 2 == 0)
                {
                    if (handcard[i].CardInfoId % 13 == 0 || handcard[i].CardInfoId % 13 > 10)
                    {
                        dealerpoint += 10;
                    }
                    else
                    {
                        dealerpoint += handcard[i].CardInfoId % 13;
                    }
                    if (i == 2)
                    {
                        // checking if first card is face card and the 2nd card is A and also the vice versa.
                        if (((handcard[0].CardInfoId % 13 == 0 || handcard[0].CardInfoId % 13 > 10) && handcard[2].CardInfoId % 13 == 1) ||
                            ((handcard[2].CardInfoId % 13 == 0 || handcard[2].CardInfoId % 13 > 10) && handcard[0].CardInfoId % 13 == 1))
                        {
                            lbl_msg.Text = "Dealer has hit BlackJack";
                            updatescore("dealer");
                            pontstable("dealer", "");
                        }
                    }
                    // adding points depending on the card

                    // if less than 21 we will check for A and add 10 to the points if possible ... note we will add ten only if the point doesnt go over 21
                    if (dealerpoint < 22)
                    {
                        for (int j = 0; j < handcard.Count(); j = j + 2)
                        {
                            if (handcard[j].CardInfoId % 13 == 1 && dealerpoint + 10 < 21)
                            {
                                dealerpoint += 10;
                            }
                        }
                    }
                    else
                    {
                        lbl_msg.Text = "Dealer has been busted";
                        updatescore("player");
                        pontstable("player", "");
                    }
                }
                #endregion

                #region Player
                if (i % 2 == 1)
                {
                    if (handcard[i].CardInfoId % 13 == 0 || handcard[i].CardInfoId % 13 > 10)
                    {
                        playerpoint += 10;
                    }
                    else
                    {
                        playerpoint += handcard[i].CardInfoId % 13;
                    }
                    // adding points depending on the card
                    if (handcard.Count == 4 && i == 3)
                    {
                        // checking if first card is face card and the 2nd card is A and also the vice versa.
                        if (((handcard[1].CardInfoId % 13 == 0 || handcard[1].CardInfoId % 13 > 10) && handcard[3].CardInfoId % 13 == 1) ||
                            ((handcard[3].CardInfoId % 13 == 0 || handcard[3].CardInfoId % 13 > 10) && handcard[1].CardInfoId % 13 == 1))
                        {
                            lbl_msg.Text = "Player has hit BlackJack";
                            updatescore("player");
                            pontstable("player", "blackjack");
                        }
                    }
                    // if less than 21 we will check for A and add 10 to the points if possible ... note we will add ten only if the point doesnt go over 21

                    if (playerpoint < 22)
                    {
                        for (int j = 1; j < handcard.Count(); j = j + 2)
                        {
                            if (handcard[j].CardInfoId % 13 == 1 && playerpoint + 10 < 21)
                            {
                                playerpoint += 10;
                            }
                        }
                    }

                    //else
                    //{
                    //    lbl_msg.Text = "Player has been busted";
                    //    updatescore("dealer");
                    //    pontstable("dealer", "");
                    //}
                }
                #endregion

                hdn_point_dealer.Value = Convert.ToString(dealerpoint);
                lbl_dealerscore.Text   = Convert.ToString(dealerpoint);
                hdn_point_player.Value = Convert.ToString(playerpoint);
                lbl_playerscore.Text   = String.Format("PlayerScore {0}", playerpoint);
                if (i == 3)
                {
                    imagedisplay("dealers");
                    imagedisplay("player");
                }
            }
        }
        enable("Deal");
    }
예제 #14
0
 public void imagedisplay(string who)
 {
     lbl_dealer.Text = "Dealer";
     lbl_player.Text = "Player";
     if (who == "dealer")
     {
         string[] dealercard   = hdn_dealer_check.Value.ToString().Split(',');
         int[]    dealerinfoid = new int[dealercard.Length];
         for (int i = 0; i < dealercard.Length; i++)
         {
             dealerinfoid[i] = Convert.ToInt32(dealercard[i]);
         }
         using (var context = new Testdata1Entities())
         {
             for (int j = 0; j < dealerinfoid.Length; j++)
             {
                 int id = dealerinfoid[j];
                 var a  = from u in context.CardInfoes
                          where u.CardInfoId == id
                          select u;
                 var b   = a.FirstOrDefault();
                 var img = new Image();
                 img.ImageUrl = b.Image;
                 img.Height   = 150;
                 img.Width    = 75;
                 DealerPanel.Controls.Add(img);
             }
         }
     }
     else if (who == "dealers")
     {
         string[] dealercard   = hdn_dealer_check.Value.Split(',');
         int[]    dealerinfoid = new int[dealercard.Length];
         for (int i = 0; i < dealercard.Length; i++)
         {
             dealerinfoid[i] = Convert.ToInt32(dealercard[i]);
         }
         using (var context = new Testdata1Entities())
         {
             var img = new Image();
             img.ImageUrl = "~/Images/black_joker.svg";
             img.Height   = 150;
             img.Width    = 75;
             DealerPanel.Controls.Add(img);
             for (int j = 1; j < dealerinfoid.Length; j++)
             {
                 int id = dealerinfoid[j];
                 var a  = from u in context.CardInfoes
                          where u.CardInfoId == id
                          select u;
                 var b    = a.FirstOrDefault();
                 var img1 = new Image();
                 img1.ImageUrl = b.Image;
                 img1.Height   = 150;
                 img1.Width    = 75;
                 DealerPanel.Controls.Add(img1);
             }
         }
     }
     else if (who == "player")
     {
         string[] playercard   = hdn_card.Value.Split(',');
         int[]    playerinfoid = new int[playercard.Length];
         for (int i = 0; i < playercard.Length; i++)
         {
             playerinfoid[i] = Convert.ToInt32(playercard[i]);
         }
         using (var context = new Testdata1Entities())
         {
             for (int j = 0; j < playerinfoid.Length; j++)
             {
                 int id = playerinfoid[j];
                 var a  = from u in context.CardInfoes
                          where u.CardInfoId == id
                          select u;
                 var b   = a.FirstOrDefault();
                 var img = new Image();
                 img.ImageUrl = b.Image;
                 img.Height   = 150;
                 img.Width    = 75;
                 PlayerPanel.Controls.Add(img);
             }
         }
     }
 }
예제 #15
0
    protected void btn_hit_Click(object sender, EventArgs e)
    {
        string username    = Session["username"].ToString();//"Mukesh"; //
        int    playerpoint = Convert.ToInt32(hdn_point_player.Value);

        using (var context = new Testdata1Entities())
        {
            var a = from u in context.accountdetails
                    where u.user_name == username
                    select u;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                //  lbl_cash.Text = b.balance;
                // lbl_cash.ForeColor = System.Drawing.Color.Green;
            }
        }
        var    handcard = new List <CardInfo>();
        Random random   = new Random();

        using (var context = new Testdata1Entities())
        {
            var a = (from u in context.CardInfoes
                     select u).ToList();
again:
            int index = random.Next(0, a.Count());

            var    cardrandom = a[index]; // getting the random no n storing the particular card with that random no
            string id         = Convert.ToString(a[index].CardInfoId);
            if (randomcard(id, hdn_card.Value) == false)
            {
                goto again;
            }
            hdn_card.Value = hdn_card.Value.ToString() + "," + a[index].CardInfoId; // adding image for that card
            handcard.Add(cardrandom);                                               // adding it to the handcard
            a.Remove(cardrandom);                                                   // removing the card from the card list so that card wont repeat again

            imagedisplay("player");

            // adding points depending on the card
            if (handcard[0].CardInfoId % 13 == 0 || handcard[0].CardInfoId % 13 > 10)
            {
                playerpoint += 10;
            }
            else
            {
                playerpoint += handcard[0].CardInfoId % 13;
            }
            // if less than 21 we will check for A and add 10 to the points if possible ... note we will add ten only if the point doesnt go over 21
            if (playerpoint < 21)
            {
                for (int j = 0; j < handcard.Count(); j = j + 2)
                {
                    if (handcard[j].CardInfoId % 13 == 1 && playerpoint + 10 < 21)
                    {
                        playerpoint += 10;
                    }
                }
                imagedisplay("dealers");
            }
            else
            {
                lbl_msg.Text = "Player has been busted";
                updatescore("dealer");
                imagedisplay("dealer");
                pontstable("dealer", "");
            }
            hdn_point_player.Value = Convert.ToString(playerpoint);
            lbl_playerscore.Text   = String.Format("PlayerScore {0}", playerpoint);
        }
    }
예제 #16
0
    protected void Stand_Click(object sender, EventArgs e)
    {
        int playerpoint = Convert.ToInt32(hdn_point_player.Value);
        int dealerpoint = Convert.ToInt32(hdn_point_dealer.Value);

        imagedisplay("player");
start:
        if (dealerpoint == 21)
        {
            lbl_msg.Text = "Dealer has hit blackjack. You have lost.";
            updatescore("dealer");
            pontstable("dealer", "");
        }


        else if (playerpoint == 21)
        {
            lbl_msg.Text = "Congragulations!!!! You have hit BlackJack.";
            updatescore("player");
            pontstable("player", "blackjack");
        }
        else if (dealerpoint == playerpoint && dealerpoint < 22)
        {
            lbl_msg.Text = "Push";
            updatescore("push");
            pontstable("push", "");
        }
        else if (dealerpoint > playerpoint && dealerpoint < 22)
        {
            lbl_msg.Text = "Dealer has won. You have lost.";
            updatescore("dealer");
            pontstable("dealer", "");
        }
        else if (dealerpoint > 17 && playerpoint > dealerpoint && playerpoint < 22)
        {
            lbl_msg.Text = "You have won";
            updatescore("player");
            pontstable("player", "");
        }

        else if (dealerpoint < 17 && playerpoint > dealerpoint)
        {
            {
                var    handcard = new List <CardInfo>();
                Random random   = new Random();
                using (var context = new Testdata1Entities())
                {
                    var a = (from u in context.CardInfoes
                             select u).ToList();
again:
                    int index = random.Next(0, a.Count());
                    var    cardrandom = a[index]; // getting the random no n storing the particular card with that random no
                    string id         = Convert.ToString(a[index].CardInfoId);
                    if (randomcard(id, hdn_dealer_check.Value) == false)
                    {
                        goto again;
                    }
                    hdn_dealer_check.Value = hdn_dealer_check.Value.ToString() + "," + a[index].CardInfoId; // adding image for that card
                    handcard.Add(cardrandom);                                                               // adding it to the handcard
                    a.Remove(cardrandom);                                                                   // removing the card from the card list so that card wont repeat again
                    if (handcard[0].CardInfoId % 13 == 0 || handcard[0].CardInfoId % 13 > 10)
                    {
                        dealerpoint += 10;
                    }
                    else
                    {
                        dealerpoint += handcard[0].CardInfoId % 13;
                    }
                    // if less than 21 we will check for A and add 10 to the points if possible ... note we will add ten only if the point doesnt go over 21
                    if (dealerpoint < 22)
                    {
                        for (int j = 0; j < handcard.Count(); j = j + 2)
                        {
                            if (handcard[j].CardInfoId % 13 == 1 && dealerpoint + 10 < 21)
                            {
                                dealerpoint += 10;
                            }
                        }
                    }


                    if (dealerpoint < 17 && dealerpoint < playerpoint)
                    {
                        goto start;
                    }
                    if (dealerpoint > 21)
                    {
                        lbl_msg.Text = "You have won";
                        updatescore("player");
                        pontstable("player", "");
                    }
                    if (dealerpoint <= 17 && playerpoint > 17 && playerpoint < 22)
                    {
                        lbl_msg.Text = "You have won";
                        updatescore("player");
                        pontstable("player", "");
                    }

                    if (dealerpoint > 17 && dealerpoint < 22 && dealerpoint > playerpoint)
                    {
                        lbl_msg.Text = "Dealer has won";
                        updatescore("dealer");
                        pontstable("dealer", "");
                    }
                    if (dealerpoint > 22)
                    {
                        lbl_msg.Text = "You have won";
                        updatescore("player");
                        pontstable("player", "");
                    }
                    if (dealerpoint == playerpoint && playerpoint < 22)
                    {
                        lbl_msg.Text = "Push";
                        updatescore("push");
                        pontstable("push", "");
                    }
                }
            }
        }


        imagedisplay("dealer");
        enable("stand");
    }