コード例 #1
0
ファイル: CoinFlipMatch.cs プロジェクト: Zexuz/Steam-Betting
        private CoinFlipMatch
        (
            int lookUpId,
            string roundId,
            string hash,
            string salt,
            string percentage,
            MatchStatus status,
            List <CoinFlipBet> bets,
            DateTime?timerStarted,
            JackpotMatchSetting setting
        )
        {
            LookUpId     = lookUpId;
            RoundId      = roundId;
            Hash         = hash;
            _salt        = salt;
            _percentage  = percentage;
            Status       = status;
            TimerStarted = timerStarted;
            Setting      = setting;
            Bets         = bets;

            ReadableStatus = status.ToString();
        }
コード例 #2
0
        public void Preffered_Classification_Opposed_Type_Should_Return_Bad()
        {
            //arrange
            Person person = new Person("Dogs", preferredClassification: PetClassification.Mammal, opposedType: PetType.Dog);
            Pet    pet    = new Pet("Fido", classification: PetClassification.Mammal, type: PetType.Dog, weight: 100);

            //Act
            MatchStatus statusResult = Utils.GetMatchStatus(person, pet);

            //Assert
            MatchStatus expectedResult = MatchStatus.Bad;

            Assert.Equal(expectedResult.ToString(), statusResult.ToString());
        }
コード例 #3
0
        public void Match_Should_Return_Good()
        {
            //arrange
            Person person = new Person("Dogs", preferredType: PetType.Dog, opposedClassification: PetClassification.Mammal, opposedSize: PetSize.ExtraSmall);
            Pet    pet    = new Pet("Fido", classification: PetClassification.Mammal, type: PetType.Dog, weight: .01);

            //Act
            MatchStatus statusResult = Utils.GetMatchStatus(person, pet);

            //Assert
            MatchStatus expectedResult = MatchStatus.Good;

            Assert.Equal(expectedResult.ToString(), statusResult.ToString());
        }
コード例 #4
0
        public static string MatchStatusToString(this MatchStatus matchStatus)
        {
            switch (matchStatus)
            {
            case MatchStatus.Accepted: return("Naplánováno");

            case MatchStatus.Challanged: return("Vyzváno");

            case MatchStatus.WaitingForConfirmation: return("Čeká se na výsledek");

            case MatchStatus.Refused: return("Odmítnuto");

            default: return(matchStatus.ToString());
            }
        }
コード例 #5
0
ファイル: JackpotMatch.cs プロジェクト: Zexuz/Steam-Betting
        public JackpotMatch
        (
            string roundId,
            string hash,
            string salt,
            string percentage,
            MatchStatus status,
            List <Bet> bets,
            DateTime?timerStarted,
            JackpotMatchSetting setting
        )
        {
            RoundId      = roundId;
            Hash         = hash;
            _salt        = salt;
            _percentage  = percentage;
            Status       = status;
            TimerStarted = timerStarted;
            Setting      = setting;
            Bets         = bets;

            ReadableStatus = status.ToString();
        }
コード例 #6
0
        public static void PopulateAirport(Control plc, airport ap, MatchStatus ms, airport aicBase)
        {
            if (ap == null)
            {
                return;
            }

            if (plc == null)
            {
                throw new ArgumentNullException(nameof(plc));
            }

            Panel p = new Panel();

            plc.Controls.Add(p);
            Label lbl = new Label();

            p.Controls.Add(lbl);
            lbl.Text = ap.ToString();
            p.Controls.Add(new LiteralControl("<br />"));
            if (!StatusIsOK(ms))
            {
                p.CssClass = "notOK";
                Label lblStatus = new Label();
                p.Controls.Add(lblStatus);
                lblStatus.Text      = String.Format(CultureInfo.CurrentCulture, Resources.Admin.ImportAirportStatusTemplate, ms.ToString());
                lblStatus.ForeColor = System.Drawing.Color.Red;
                if (aicBase != null && ap.LatLong != null && aicBase.LatLong != null)
                {
                    Label lblDist = new Label();
                    p.Controls.Add(lblDist);
                    lblDist.Text = String.Format(CultureInfo.CurrentCulture, Resources.Admin.ImportAirportDistanceTemplate, aicBase.DistanceFromAirport(ap));
                }
            }
            HyperLink h = new HyperLink();

            p.Controls.Add(h);
            h.Text        = ap.LatLong.ToDegMinSecString();
            h.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "javascript:updateForAirport({0});", JsonConvert.SerializeObject(ap, new JsonSerializerSettings()
            {
                DefaultValueHandling = DefaultValueHandling.Ignore
            }));
            if (!String.IsNullOrEmpty(ap.UserName))
            {
                p.Controls.Add(new LiteralControl(String.Format(CultureInfo.InvariantCulture, "{0}<br />", ap.UserName)));
            }
        }
コード例 #7
0
 /// <summary>
 /// Declares the match status for the current person the specified search result entry from <see cref="P:Results.Entries"/>.
 /// </summary>
 /// <param name="entry">The search result entry (from <see cref="P:Results.Entries"/>) to have the match status updated.</param>
 /// <param name="status">The new status to apply to the specified search result entry from <see cref="P:Results.Entries"/>.</param>
 /// <param name="options">The options to apply before executing the REST API call.</param>
 /// <returns>
 /// A <see cref="PersonMatchResultsState"/> instance containing the REST API response.
 /// </returns>
 public PersonMatchResultsState UpdateMatchStatus(Gx.Atom.Entry entry, MatchStatus status, params IStateTransitionOption[] options)
 {
     String updateStatusUri = GetSelfUri().SetQueryParam(FamilySearchOptions.STATUS, status.ToString().ToLower()).ToString();
     IRestRequest request = CreateAuthenticatedRequest().ContentType(MediaTypes.GEDCOMX_JSON_MEDIA_TYPE)
       .SetEntity(new Gx.Gedcomx() { Persons = new List<Person>() { new Person() { Identifiers = new List<Identifier>() { new Identifier() { KnownType = IdentifierType.Persistent, Value = entry.Id } } } } })
       .Build(updateStatusUri, Method.POST);
     return ((FamilySearchStateFactory)this.stateFactory).NewPersonMatchResultsState(request, Invoke(request, options), this.Client, this.CurrentAccessToken);
 }
コード例 #8
0
        /// <summary>
        /// Declares the match status for the current person the specified search result entry from <see cref="P:Results.Entries"/>.
        /// </summary>
        /// <param name="entry">The search result entry (from <see cref="P:Results.Entries"/>) to have the match status updated.</param>
        /// <param name="status">The new status to apply to the specified search result entry from <see cref="P:Results.Entries"/>.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="PersonMatchResultsState"/> instance containing the REST API response.
        /// </returns>
        public PersonMatchResultsState UpdateMatchStatus(Gx.Atom.Entry entry, MatchStatus status, params IStateTransitionOption[] options)
        {
            String       updateStatusUri = GetSelfUri().SetQueryParam(FamilySearchOptions.STATUS, status.ToString().ToLower()).ToString();
            IRestRequest request         = CreateAuthenticatedRequest().ContentType(MediaTypes.GEDCOMX_JSON_MEDIA_TYPE)
                                           .SetEntity(new Gx.Gedcomx()
            {
                Persons = new List <Person>()
                {
                    new Person()
                    {
                        Identifiers = new List <Identifier>()
                        {
                            new Identifier()
                            {
                                KnownType = IdentifierType.Persistent, Value = entry.Id
                            }
                        }
                    }
                }
            })
                                           .Build(updateStatusUri, Method.POST);

            return(((FamilySearchStateFactory)this.stateFactory).NewPersonMatchResultsState(request, Invoke(request, options), this.Client, this.CurrentAccessToken));
        }