Esempio n. 1
0
 public int playerGetsHowMuchCash(bool gaveUp)
 {
     if (questionCounter == 1)
     {
         return(0);
     }
     if (gaveUp)
     {
         return(int.Parse(Enumerators.GetEnumDescription((Cash)(questionCounter - 1))));
     }
     else
     {
         if (questionCounter - 1 < 5)
         {
             return(0);
         }
         else if (questionCounter - 1 >= 5 && questionCounter - 1 < 10)
         {
             return(int.Parse(Enumerators.GetEnumDescription(Cash.Answer5)));
         }
         else
         {
             return(int.Parse(Enumerators.GetEnumDescription(Cash.Answer10)));
         }
     }
 }
Esempio n. 2
0
    private void CatForumGrouping()
    {
        if (grdSubs.Controls.Count == 0)
        {
            return;
        }
        const int catColumnIndex   = 0;
        const int forumColumnIndex = 1;

        // Reference the Table the GridView has been rendered into
        var gridTable = (Table)grdSubs.Controls[0];
        // Enumerate each TableRow, adding a sorting UI header if
        // the sorted value has changed
        string lastCat   = string.Empty;
        string lastForum = string.Empty;

        foreach (GridViewRow gvr in grdSubs.Rows)
        {
            string currentCat   = gvr.Cells[catColumnIndex].Text.Replace("&nbsp;", "");
            string currentForum = gvr.Cells[forumColumnIndex].Text.Replace("&nbsp;", "");

            if (lastCat.CompareTo(currentCat) != 0 && !String.IsNullOrEmpty(currentCat))
            {
                CategoryInfo category      = Categories.GetCategoryByName(currentCat).First();
                var          subscriptions =
                    Enumerators.GetEnumDescription((Enumerators.CategorySubscription)category.SubscriptionLevel);
                string catLink = String.Format("{0} ({1})", category.Name,
                                               subscriptions);

                // there's been a change in value in the category column
                int rowIndex = gridTable.Rows.GetRowIndex(gvr);
                // Add a new category header row
                var sortRow  = new GridViewRow(rowIndex, rowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);
                var sortCell = new TableCell
                {
                    Text     = catLink,
                    CssClass = "tableheader"
                };
                sortCell.ColumnSpan = grdSubs.Columns.Count;
                sortRow.Cells.Add(sortCell);
                gridTable.Controls.AddAt(rowIndex, sortRow);
                // Update lastValue
                lastCat = currentCat;
            }
            if (lastForum.CompareTo(currentForum) != 0 && !String.IsNullOrEmpty(currentForum))
            {
                ForumInfo forum         = Forums.GetForumBySubject(currentForum.Trim()).First();
                var       subscriptions =
                    Enumerators.GetEnumDescription((Enumerators.Subscription)forum.SubscriptionLevel);
                string forumLink = String.Format("{0} ({1})", forum.Subject, subscriptions);
                // there's been a change in value in the forum column
                int rowIndex = gridTable.Rows.GetRowIndex(gvr);
                // Add a new forum header row
                var sortRow = new GridViewRow(rowIndex, rowIndex, DataControlRowType.DataRow, DataControlRowState.Normal);

                var sortCell = new TableCell
                {
                    Text     = forumLink,
                    CssClass = "ForumHeaderRow"
                };
                sortCell.ColumnSpan = grdSubs.Columns.Count;
                //sortRow.Cells.Add(spacer);
                sortRow.Cells.Add(sortCell);
                gridTable.Controls.AddAt(rowIndex, sortRow);
                // Update lastValue
                lastForum = currentForum;
            }

            gvr.Cells.RemoveAt(1);
            gvr.Cells.RemoveAt(0);
            gvr.Cells[0].ColumnSpan = 3;
        }
    }
Esempio n. 3
0
 public int getCurrentCash()
 {
     return(int.Parse(Enumerators.GetEnumDescription((Cash)(questionCounter))));
 }