Exemplo n.º 1
0
        public async Task <IActionResult> Create(int?Id, [Bind("HandicapId,GhinNumber,Date,HcpIndex")] Handicap handicap)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            var Member = _context.Member.SingleOrDefault(m => m.MemberId == Id);

            if (ModelState.IsValid)
            {
                _context.Add(handicap);

                if (handicap.Date >= _handicap.getCurrEffDate())
                {
                    Member.CurrHandicap = handicap.HcpIndex;
                    _context.Update(Member);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), "Handicap", new { id = Id }));
            }
            var model = new HandicapEditViewModel();

            model.Member      = Member;
            model.Date        = handicap.Date;
            model.ActiveDates = _handicap.getActiveDates(model.Date.ToShortDateString().ToString());
            model.HandicapId  = handicap.HandicapId;
            model.GhinNumber  = Member.GhinNumber;
            model.HcpIndex    = handicap.HcpIndex;

            return(View(model));
        }
Exemplo n.º 2
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 23, Configuration.FieldSeparator),
                       Id,
                       LivingDependency != null ? string.Join(Configuration.FieldRepeatSeparator, LivingDependency.Select(x => x.ToDelimitedString())) : null,
                       LivingArrangement?.ToDelimitedString(),
                       PatientPrimaryFacility != null ? string.Join(Configuration.FieldRepeatSeparator, PatientPrimaryFacility.Select(x => x.ToDelimitedString())) : null,
                       PatientPrimaryCareProviderNameIdNo != null ? string.Join(Configuration.FieldRepeatSeparator, PatientPrimaryCareProviderNameIdNo.Select(x => x.ToDelimitedString())) : null,
                       StudentIndicator?.ToDelimitedString(),
                       Handicap?.ToDelimitedString(),
                       LivingWillCode?.ToDelimitedString(),
                       OrganDonorCode?.ToDelimitedString(),
                       SeparateBill,
                       DuplicatePatient != null ? string.Join(Configuration.FieldRepeatSeparator, DuplicatePatient.Select(x => x.ToDelimitedString())) : null,
                       PublicityCode?.ToDelimitedString(),
                       ProtectionIndicator,
                       ProtectionIndicatorEffectiveDate.HasValue ? ProtectionIndicatorEffectiveDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       PlaceOfWorship != null ? string.Join(Configuration.FieldRepeatSeparator, PlaceOfWorship.Select(x => x.ToDelimitedString())) : null,
                       AdvanceDirectiveCode != null ? string.Join(Configuration.FieldRepeatSeparator, AdvanceDirectiveCode.Select(x => x.ToDelimitedString())) : null,
                       ImmunizationRegistryStatus?.ToDelimitedString(),
                       ImmunizationRegistryStatusEffectiveDate.HasValue ? ImmunizationRegistryStatusEffectiveDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       PublicityCodeEffectiveDate.HasValue ? PublicityCodeEffectiveDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       MilitaryBranch?.ToDelimitedString(),
                       MilitaryRankGrade?.ToDelimitedString(),
                       MilitaryStatus?.ToDelimitedString(),
                       AdvanceDirectiveLastVerifiedDate.HasValue ? AdvanceDirectiveLastVerifiedDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
        public async Task TestCreateWithHandicap()
        {
            var testPlayer = new Player()
            {
                UserId    = new Guid("00000000-0000-0000-0002-000000000000"),
                FirstName = "Michael",
                LastName  = "Nelmes",
                Handicap  = new Decimal(23.4),
                Created   = _createdAt,
                Modified  = _modifiedAt
            };

            var testHandicap = new Handicap()
            {
                Id              = new Guid("00000000-0000-0000-0000-000000000001"),
                PlayerId        = new Guid("00000000-0000-0000-0000-000000000001"),
                CurrentHandicap = new Decimal(23.4),
                Value           = new Decimal(23.4),
                Date            = _createdAt.AddDays(2)
            };

            _mockHandicapAccessLayer.Setup(x => x.AddHandicap(It.IsAny <Handicap>())).ReturnsAsync(true);
            _mockPlayerAccessLayer.Setup(x => x.AddPlayer(testPlayer)).ReturnsAsync(new Guid("00000000-0000-0000-0000-000000000002"));


            var expected = new Guid("00000000-0000-0000-0000-000000000002");

            var actual = await _sut.Create(testPlayer) as ObjectResult;

            actual.StatusCode.Should().Be(200);
            actual.Value.Should().BeEquivalentTo(expected);
        }
Exemplo n.º 4
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        lblUpdateCount.Text      = " ";
        lblUpdateCount.ForeColor = System.Drawing.Color.Green;
        // load handicaps.txt file from host server in handicap list
        int updateCount    = 0;
        int countOfPlayers = 0;

        // MrResources mr = new MrResources();
        // path = Server.MapPath(mr.Root);
        try
        {
            hcpDate = Convert.ToDateTime(tbHcpDate.Text);

            List <Handicap> hc = Handicap.LoadHandicaps(filename, hcpDate);

            // update sql Players with handicaps from text file
            string    MRMISGADBConn = ConfigurationManager.ConnectionStrings["MRMISGADBConnect"].ToString();
            MRMISGADB db            = new MRMISGADB(MRMISGADBConn);
            MRParams  entry         = db.MRParams.FirstOrDefault(p => p.Key == "Players");
            if (entry == null)
            {
                PlayersCount = 0;
            }
            else
            {
                PlayersCount = Convert.ToInt32(entry.Value);
                for (int i = 0; i <= PlayersCount; ++i)
                {
                    var m = db.Players.FirstOrDefault(h => h.PlayerID == i);
                    if (m != null)
                    {
                        countOfPlayers++;
                        foreach (var hcp in hc)
                        {
                            if (m.MemberID.Trim() == hcp.ID.Trim())
                            {
                                m.Hcp   = hcp.Index;
                                m.HDate = hcp.Date;
                                db.SubmitChanges();
                                updateCount++;
                            }
                        }
                    }
                }
            }
            ShowMembers();
            lblUpdateCount.Text = string.Format("{0} of {1} Handicaps Updated", updateCount, countOfPlayers);
        }
        catch (FormatException)
        {
            lblUpdateCount.Text      = "Invalid Handicap Date";
            lblUpdateCount.ForeColor = System.Drawing.Color.Red;
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// 先後の判定
        /// </summary>
        /// <param name="handicap"></param>
        /// <returns></returns>
        public static bool IsSenGo(this Handicap handicap)
        {
            bool ret = false;

            if (handicap == Handicap.HIRATE || handicap == Handicap.OTHER)
            {
                ret = true;
            }

            return(ret);
        }
Exemplo n.º 6
0
    void Start()
    {
        rigidbody             = GetComponent <Rigidbody2D>();
        rigidbody.constraints = RigidbodyConstraints2D.FreezeRotation;

        handicap    = GetComponent <Handicap>();
        audioSource = GetComponent <AudioSource>();
        health      = GetComponent <Health>();

        SetWeapon(defaultWeapon);
    }
Exemplo n.º 7
0
        public static string ToKifuString(this Handicap handicap)
        {
            foreach (DictionaryEntry de in HandicapHash)
            {
                if ((Handicap)de.Value == handicap)
                {
                    return((string)de.Key);
                }
            }

            return(string.Empty);
        }
Exemplo n.º 8
0

        
        public async Task <Boolean> AddHandicap(Handicap handicap)
        {
            try
            {
                await _context.Handicaps.AddAsync(handicap);

                return(0 < await _context.SaveChangesAsync());
            }
            catch
            {
                throw new Exception("Could not add Handicap");
            }
        }
Exemplo n.º 10
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 42, Configuration.FieldSeparator),
                       Id,
                       SetIdNk1.HasValue ? SetIdNk1.Value.ToString(culture) : null,
                       Name != null ? string.Join(Configuration.FieldRepeatSeparator, Name.Select(x => x.ToDelimitedString())) : null,
                       Relationship?.ToDelimitedString(),
                       Address != null ? string.Join(Configuration.FieldRepeatSeparator, Address.Select(x => x.ToDelimitedString())) : null,
                       PhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, PhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       BusinessPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, BusinessPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       ContactRole?.ToDelimitedString(),
                       StartDate.HasValue ? StartDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       EndDate.HasValue ? EndDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       NextOfKinAssociatedPartiesJobTitle,
                       NextOfKinAssociatedPartiesJobCodeClass?.ToDelimitedString(),
                       NextOfKinAssociatedPartiesEmployeeNumber?.ToDelimitedString(),
                       OrganizationNameNk1 != null ? string.Join(Configuration.FieldRepeatSeparator, OrganizationNameNk1.Select(x => x.ToDelimitedString())) : null,
                       MaritalStatus?.ToDelimitedString(),
                       AdministrativeSex?.ToDelimitedString(),
                       DateTimeOfBirth.HasValue ? DateTimeOfBirth.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       LivingDependency != null ? string.Join(Configuration.FieldRepeatSeparator, LivingDependency.Select(x => x.ToDelimitedString())) : null,
                       AmbulatoryStatus != null ? string.Join(Configuration.FieldRepeatSeparator, AmbulatoryStatus.Select(x => x.ToDelimitedString())) : null,
                       Citizenship != null ? string.Join(Configuration.FieldRepeatSeparator, Citizenship.Select(x => x.ToDelimitedString())) : null,
                       PrimaryLanguage?.ToDelimitedString(),
                       LivingArrangement?.ToDelimitedString(),
                       PublicityCode?.ToDelimitedString(),
                       ProtectionIndicator,
                       StudentIndicator?.ToDelimitedString(),
                       Religion?.ToDelimitedString(),
                       MothersMaidenName != null ? string.Join(Configuration.FieldRepeatSeparator, MothersMaidenName.Select(x => x.ToDelimitedString())) : null,
                       Nationality?.ToDelimitedString(),
                       EthnicGroup != null ? string.Join(Configuration.FieldRepeatSeparator, EthnicGroup.Select(x => x.ToDelimitedString())) : null,
                       ContactReason != null ? string.Join(Configuration.FieldRepeatSeparator, ContactReason.Select(x => x.ToDelimitedString())) : null,
                       ContactPersonsName != null ? string.Join(Configuration.FieldRepeatSeparator, ContactPersonsName.Select(x => x.ToDelimitedString())) : null,
                       ContactPersonsTelephoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, ContactPersonsTelephoneNumber.Select(x => x.ToDelimitedString())) : null,
                       ContactPersonsAddress != null ? string.Join(Configuration.FieldRepeatSeparator, ContactPersonsAddress.Select(x => x.ToDelimitedString())) : null,
                       NextOfKinAssociatedPartysIdentifiers != null ? string.Join(Configuration.FieldRepeatSeparator, NextOfKinAssociatedPartysIdentifiers.Select(x => x.ToDelimitedString())) : null,
                       JobStatus?.ToDelimitedString(),
                       Race != null ? string.Join(Configuration.FieldRepeatSeparator, Race.Select(x => x.ToDelimitedString())) : null,
                       Handicap?.ToDelimitedString(),
                       ContactPersonSocialSecurityNumber,
                       NextOfKinBirthPlace,
                       VipIndicator?.ToDelimitedString(),
                       NextOfKinTelecommunicationInformation?.ToDelimitedString(),
                       ContactPersonsTelecommunicationInformation?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Exemplo n.º 11
0
        private Forecast forecast(Player player, IEnumerable <int> scores, Course course, int lowestPossibleScore, int highestPossibleScore)
        {
            int     numberofRoundsPlayed = scores.Count();
            Decimal averageScore         = 0;
            Decimal personalBestScore    = 0;
            Decimal highestScore         = 0;

            if (numberofRoundsPlayed > 0)
            {
                averageScore      = (decimal)scores.Average(s => s);
                personalBestScore = scores.Min(s => s);
                highestScore      = scores.Max(s => s);
            }
            var     highestPlayedTo = _handicapAccessLayer.GetHighestPlayedTo(player.Id).Value;
            Decimal toLowerScore    = (highestPlayedTo / (Decimal.Parse("113") / course.Slope * Decimal.Parse("0.93"))) + course.ScratchRating;
            var     playedToinHandicapsTargetScore = _handicapAccessLayer.GetPlayedTos(player.Id);
            int     numberOfHandicapsConsidered    = 8;

            if (numberofRoundsPlayed < 6)
            {
                numberOfHandicapsConsidered = 1;
            }
            else if (numberofRoundsPlayed > 5 && numberofRoundsPlayed < 19)
            {
                numberOfHandicapsConsidered = (int)Math.Floor((double)(numberofRoundsPlayed / 2)) - 1;
            }
            Dictionary <int, Decimal> rangeOfPredictedHandicaps = new Dictionary <int, Decimal>();

            for (int expectedScore = lowestPossibleScore; expectedScore < highestPossibleScore; expectedScore++)
            {
                var      expectedPlayedTo = (expectedScore - course.ScratchRating) * Decimal.Parse("113") / course.Slope * Decimal.Parse("0.93");
                Handicap handicap         = new Handicap {
                    Value = expectedPlayedTo
                };
                playedToinHandicapsTargetScore.Add(handicap);
                var expectedHandicap = Math.Round(playedToinHandicapsTargetScore.OrderBy(h => h.Value).Take(numberOfHandicapsConsidered).Average(h => h.Value), 2);
                playedToinHandicapsTargetScore.Remove(handicap);
                rangeOfPredictedHandicaps.Add(expectedScore, expectedHandicap);
            }


            return(new Forecast
            {
                Player = player,
                Average = averageScore,
                PB = personalBestScore,
                HS = highestScore,
                ToLowerHandicap = Math.Floor(toLowerScore),
                RangeOfPredictedHandicaps = rangeOfPredictedHandicaps,
            });
        }
Exemplo n.º 12
0
        public string ToTable()
        {
            var dataTable = new DataTable();

            dataTable.Columns.Add("Key", typeof(string));
            dataTable.Columns.Add("Value", typeof(string));

            var row = dataTable.NewRow();

            row[0] = nameof(Name);
            row[1] = Name;
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(ExactName);
            row[1] = ExactName;
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(Rate);
            row[1] = Rate.ToString();
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(Snaps);
            row[1] = Snaps.ToString();
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(Handicap);
            row[1] = Handicap.ToString();
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(TimeNudge);
            row[1] = TimeNudge.ToString();
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(DiscordId);
            row[1] = DiscordId;
            dataTable.Rows.Add(row);

            row    = dataTable.NewRow();
            row[0] = nameof(Guid);
            row[1] = Guid;
            dataTable.Rows.Add(row);

            return(AsciiTableGenerator.CreateAsciiTableFromDataTable(dataTable)?.ToString());
        }
Exemplo n.º 13
0
    public List <Handicap> GetHandicapByMemberAndDate(int MemberID, DateTime Date)
    {
        SqlConnection dbConnection = new SqlConnection();

        //School
        //dbConnection.ConnectionString = "Persist Security Info=false;Integrated Security=true;Server=(LocalDb)\\MSSQLLocalDB;Database=ClubBaist;";
        //home
        dbConnection.ConnectionString = "Persist Security Info=false;Integrated Security=true;Server=.;Database=ClubBaist;";
        dbConnection.Open();

        SqlCommand getTeeTimesCommand = new SqlCommand();

        getTeeTimesCommand.Connection  = dbConnection;
        getTeeTimesCommand.CommandText = "GetScoresByDateAndMember";
        getTeeTimesCommand.CommandType = CommandType.StoredProcedure;

        SqlParameter memberParam = new SqlParameter();

        memberParam.SqlDbType     = SqlDbType.Int;
        memberParam.SqlValue      = MemberID;
        memberParam.ParameterName = "@MemberID";

        SqlParameter dayParam = new SqlParameter();

        dayParam.SqlDbType     = SqlDbType.Date;
        dayParam.SqlValue      = Date;
        dayParam.ParameterName = "@Date";

        getTeeTimesCommand.Parameters.Add(memberParam);
        getTeeTimesCommand.Parameters.Add(dayParam);

        SqlDataReader dbReader = getTeeTimesCommand.ExecuteReader();

        List <Handicap> handicaps = new List <Handicap>();

        if (dbReader.HasRows)
        {
            while (dbReader.Read())
            {
                string   date    = dbReader["DatePlayed"].ToString();
                Handicap teeTime = new Handicap();
                teeTime.DatePlayed     = Convert.ToDateTime(date);
                teeTime.PlayerHandicap = float.Parse(dbReader["Handicap"].ToString());
                handicaps.Add(teeTime);
            }
        }

        dbConnection.Close();
        return(handicaps);
    }
Exemplo n.º 14
0
 public override void Clear()
 {
     foreach (var serverPlayer in Players())
     {
         serverPlayer.Item = null;                  // Break the link from the serverPlayer to its ListViewItem, since we're about to throw away the ListViewItem.
     }
     Items.Clear();
     score      = 0;
     Rank       = 0;
     LeagueTeam = null;
     GameTeam   = new GameTeam();
     handicap   = new Handicap();
     ListView.Columns[1].Text = "Players";
     ListView.Columns[2].Text = "Score";
 }
Exemplo n.º 15
0
        public void TestGetLatestHandicap(string id)
        {
            var expected = new Handicap()
            {
                Id              = new Guid("00000000-0000-0000-0000-000000000003"),
                PlayerId        = new Guid("00000000-0000-0000-0001-000000000000"),
                CurrentHandicap = 20,
                Value           = 15,
                Date            = _createdAt.AddDays(1)
            };

            var actual = _sut.GetLatestHandicap(new Guid(id));

            actual.Should().BeEquivalentTo(expected);
        }
Exemplo n.º 16
0
        private async Task <Boolean> RecalculateHandicap(Handicap handicap)
        {
            IEnumerable <Handicap> allHandicaps = _handicapAccessLayer.GetOrderedHandicaps(handicap.PlayerId);
            var handicapsList = allHandicaps.Take(19).ToList();

            handicapsList.Add(handicap);
            handicapsList = handicapsList.OrderBy(h => h.Value).ToList();
            int     roundsPlayed = handicapsList.Count();
            Decimal newHandicap;

            if (roundsPlayed >= 19)
            {
                newHandicap = handicapsList.Take(8).Sum(h => h.Value) / 8;
            }
            else if (roundsPlayed >= 17)
            {
                newHandicap = handicapsList.Take(7).Sum(h => h.Value) / 7;
            }
            else if (roundsPlayed >= 15)
            {
                newHandicap = handicapsList.Take(6).Sum(h => h.Value) / 6;
            }
            else if (roundsPlayed >= 13)
            {
                newHandicap = handicapsList.Take(5).Sum(h => h.Value) / 5;
            }
            else if (roundsPlayed >= 11)
            {
                newHandicap = handicapsList.Take(4).Sum(h => h.Value) / 4;
            }
            else if (roundsPlayed >= 9)
            {
                newHandicap = handicapsList.Take(3).Sum(h => h.Value) / 3;
            }
            else if (roundsPlayed >= 7)
            {
                newHandicap = handicapsList.Take(2).Sum(h => h.Value) / 2;
            }
            else
            {
                newHandicap = handicapsList.Take(1).Sum(h => h.Value) / 1;
            }
            handicap.CurrentHandicap = newHandicap;
            await AddHandicap(handicap);

            return(await Edit(handicap.PlayerId, newHandicap));
        }
Exemplo n.º 17
0
        public List <Handicap> GetHandicaps(HtmlNode node, string eventId)
        {
            List <Handicap> handicaps = new List <Handicap>();

            try
            {
                foreach (HtmlNode htmlNode in node.ChildNodes)
                {
                    if (htmlNode.OriginalName == "div" && this.GetAtributeValueByName(htmlNode, "id").StartsWith(eventId) == true)
                    {
                        HtmlNodeCollection htmlNodes = htmlNode.ChildNodes;

                        foreach (HtmlNode nodeLineWrapper in htmlNodes)
                        {
                            if (nodeLineWrapper.OriginalName == "div" && this.GetAtributeValueByName(nodeLineWrapper, "class") == "lineWrapper")
                            {
                                Handicap handicap = new Handicap();
                                var      result   = this._htmlOddsParse.GetLineTwo(nodeLineWrapper);

                                if (result.name1 != null)
                                {
                                    handicap.HDPHOME = this.GetMarketValue(result.name1);
                                    handicap.HOME    = result.k1;
                                    handicap.AWAY    = result.k2;
                                }
                                if (result.name2 != null)
                                {
                                    handicap.HDPAWAY = this.GetMarketValue(result.name2);
                                    handicap.HOME    = result.k1;
                                    handicap.AWAY    = result.k2;
                                }

                                handicaps.Add(handicap);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(null);
            }



            return(handicaps);
        }
Exemplo n.º 18
0
        public void TestHandicap()
        {
            var h = Handicap.Parse("100%");

            Assert.AreEqual(100, h.Value, "handicap is 100");
            Assert.That(h.IsZero(), "handicap is 100%");

            h = Handicap.Parse("+0");
            Assert.AreEqual(0, h.Value, "handicap is 0");
            Assert.That(h.IsZero(), "handicap is +0");

            h = Handicap.Parse("-0");
            Assert.That(h.IsZero(), "handicap is -0");

            h = Handicap.Parse("0");
            Assert.AreEqual(0, h.Value, "handicap is still 0");
        }
Exemplo n.º 19
0
        public async Task <IActionResult> Edit(int id, [Bind("HandicapId,GhinNumber,Date,HcpIndex")] Handicap handicap)
        {
            if (id != handicap.HandicapId)
            {
                return(NotFound());
            }
            var Member = _context.Member
                         .SingleOrDefault(m => m.GhinNumber == handicap.GhinNumber);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(handicap);
                    if (handicap.Date >= _handicap.getCurrEffDate())
                    {
                        Member.CurrHandicap = handicap.HcpIndex;
                        _context.Update(Member);
                    }
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HandicapExists(handicap.HandicapId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index), "Handicap", new { id = Member.MemberId }));
            }
            var model = new HandicapEditViewModel();

            model.Member      = Member;
            model.Date        = handicap.Date;
            model.ActiveDates = _handicap.getActiveDates(model.Date.ToShortDateString().ToString());
            model.HandicapId  = handicap.HandicapId;
            model.GhinNumber  = Member.GhinNumber;
            model.HcpIndex    = handicap.HcpIndex;

            return(View(model));
        }
Exemplo n.º 20
0
        public IEnumerable <HandicapInfo> getAllForDate(DateTime Date)
        {
            IEnumerable <Member> Members = _context.Member.Where(r => r.RecordStatus == RecordState.Active &&
                                                                 (r.MemberType == MemberType.Member || r.MemberType == MemberType.Junior || r.MemberType == MemberType.Guest)).OrderBy(r => r.LastName).ThenBy(r => r.FirstName);
            List <HandicapInfo> HandicapInfos = new List <HandicapInfo>();

            foreach (Member Member in Members)
            {
                Handicap Handicap = getHandicapForDate(Member.MemberId, Date);
                if (Handicap != null)
                {
                    HandicapInfo HandicapInfo = new HandicapInfo();
                    HandicapInfo.Member   = Member;
                    HandicapInfo.Handicap = Handicap;
                    HandicapInfos.Add(HandicapInfo);
                }
            }
            return(HandicapInfos);
        }
Exemplo n.º 21
0
        private async Task <Boolean> CalculateHandicap(DateTime date, Score score, Guid courseId)
        {
            Course   course   = _courseAccessLayer.GetCourse(courseId);
            Handicap handicap = new Handicap
            {
                Date     = date,
                PlayerId = score.PlayerId
            };

            int     holesMultiplier = course.Holes.Contains("-") ? 2 : 1;
            Decimal currentHandicap = _handicapAccessLayer.GetLatestHandicap(score.PlayerId).CurrentHandicap;

            decimal dailyHandicap = Math.Floor(currentHandicap * course.Slope / Decimal.Parse("113")
                                               + (course.ScratchRating - course.Par) * (decimal)(holesMultiplier * 0.93));

            handicap.Value = (36 - score.Value + dailyHandicap + course.Par - course.ScratchRating) *
                             (Decimal.Parse("113") / course.Slope);

            return(await RecalculateHandicap(handicap));
        }
Exemplo n.º 22
0
        public Handicap getHandicapForDate(int MemberId, DateTime ScoreDate)
        {
            Member Member = (Member)_context.Member.Where(r => r.MemberId == MemberId).FirstOrDefault();

            if (Member.GhinNumber > 0)
            {
                var Handicap = _context.Handicap.Where(r => r.GhinNumber == Member.GhinNumber && r.Date <= ScoreDate).OrderByDescending(r => r.Date).FirstOrDefault();
                return(Handicap);
            }
            else
            {
                if (Member.CurrHandicap > 0.0F)
                {
                    var Handicap = new Handicap();
                    Handicap.HcpIndex = Member.CurrHandicap;
                    return(Handicap);
                }
            }
            return(null);
        }
Exemplo n.º 23
0
    public static List <Handicap> LoadHandicaps(string fileName, DateTime hcpDate)
    {
        _filename = fileName;
        _hcpDate  = hcpDate;

        List <Handicap> target = new List <Handicap>();

//            _hcpDate = System.IO.File.GetLastWriteTime(fileName);

        string[] lines = System.IO.File.ReadAllLines(_filename);
        string   prev  = "";

        foreach (String line in lines)
        {
            if (line.Length > 0)
            {
                string[] fields = line.Split(delimiterChars);
                if (fields.Length > 7)
                {
                    if (fields[4] != prev)
                    {
                        if (fields[8].Trim() != "CourseName1")
                        {
                            prev = fields[4];
                            Handicap e = new Handicap()
                            {
                                ID   = fields[4],
                                Name = fields[6] + ", " + fields[7],
                                Date = _hcpDate
                            };
                            //                               e.Index = "NONE";
                            e.Index = ToHcp(fields[8].Trim());

                            target.Add(e);
                        }
                    }
                }
            }
        }
        return(target);
    }
Exemplo n.º 24
0
        /// <summary>
        /// Инициализирует имеющиеся гандикапы для события
        /// </summary>
        /// <param name="oddEvent"></param>
        private void SetHandicapsForEvent(OddEvent oddEvent)
        {
            OddPeriod         oddPeriod = oddEvent.Periods[0];
            List <OddsSpread> spreads   = oddPeriod.Spreads;

            oddPeriod.Handicaps = new List <Handicap>();


            foreach (OddsSpread spread in spreads)
            {
                if (spread.Hdp <= 3.5M && spread.Hdp >= -3.5M)
                {
                    Handicap handicap = new Handicap()
                    {
                        HDPHOME = spread.Hdp, HDPAWAY = spread.Hdp * (-1), HOME = spread.Home, AWAY = spread.Away
                    };

                    oddPeriod.Handicaps.Add(handicap);
                }
            }
        }
Exemplo n.º 25
0
        public Level1(Character p1, Character p2, Character p3, Character p4, Handicap h1, Handicap h2, Handicap h3, Handicap h4, int numberPlaying,
                        float s1, float s2, float s3, float s4)
        {
            PlayerCharacters[0] = p1;
            PlayerCharacters[1] = p2;
            PlayerCharacters[2] = p3;
            PlayerCharacters[3] = p4;
            PlayerHandicaps[0] = h1;
            PlayerHandicaps[1] = h2;
            PlayerHandicaps[2] = h3;
            PlayerHandicaps[3] = h4;

            sen[0] = s1;
            sen[1] = s2;
            sen[2] = s3;
            sen[3] = s4;

            NumberOfPlayers = numberPlaying;
            NumberOfPlayersLeft = NumberOfPlayers;
            //the transition time to fade in...
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            //and off the screen...
            TransitionOffTime = TimeSpan.FromSeconds(0.5);
        }
Exemplo n.º 26
0
        void HandicapMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            //Did you select the HandicapMenuEntry?
            if (e.PlayerIndex == PlayerIndex.One)
            {
                //Your handicap now has changed...
                handicapP1++;
                //if (Guide.IsTrialMode)
                //{
                //    handicapP1--;
                //}
                if (handicapP1 > Handicap.VeryHard)
                {
                    handicapP1 = 0;
                }
            }

            #region OtherPlayers
            if (e.PlayerIndex == PlayerIndex.Two)
            {
                handicapP2++;

                if (handicapP2 > Handicap.VeryHard)
                {
                    handicapP2 = 0;
                }
            }
            if (e.PlayerIndex == PlayerIndex.Three)
            {
                handicapP3++;

                if (handicapP3 > Handicap.VeryHard)
                {
                    handicapP3 = 0;
                }
            }
            if (e.PlayerIndex == PlayerIndex.Four)
            {
                handicapP4++;

                if (handicapP4 > Handicap.VeryHard)
                {
                    handicapP4 = 0;
                }
            }
            SetMenuEntryText();
            #endregion
        }
Exemplo n.º 27
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 58, Configuration.FieldSeparator),
                       Id,
                       SetIdGt1.HasValue ? SetIdGt1.Value.ToString(culture) : null,
                       GuarantorNumber != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorNumber.Select(x => x.ToDelimitedString())) : null,
                       GuarantorName != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorName.Select(x => x.ToDelimitedString())) : null,
                       GuarantorSpouseName != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorSpouseName.Select(x => x.ToDelimitedString())) : null,
                       GuarantorAddress != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorAddress.Select(x => x.ToDelimitedString())) : null,
                       GuarantorPhNumHome != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorPhNumHome.Select(x => x.ToDelimitedString())) : null,
                       GuarantorPhNumBusiness != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorPhNumBusiness.Select(x => x.ToDelimitedString())) : null,
                       GuarantorDateTimeOfBirth.HasValue ? GuarantorDateTimeOfBirth.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       GuarantorAdministrativeSex?.ToDelimitedString(),
                       GuarantorType?.ToDelimitedString(),
                       GuarantorRelationship?.ToDelimitedString(),
                       GuarantorSsn,
                       GuarantorDateBegin.HasValue ? GuarantorDateBegin.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       GuarantorDateEnd.HasValue ? GuarantorDateEnd.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       GuarantorPriority.HasValue ? GuarantorPriority.Value.ToString(Consts.NumericFormat, culture) : null,
                       GuarantorEmployerName != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorEmployerName.Select(x => x.ToDelimitedString())) : null,
                       GuarantorEmployerAddress != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorEmployerAddress.Select(x => x.ToDelimitedString())) : null,
                       GuarantorEmployerPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorEmployerPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       GuarantorEmployeeIdNumber != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorEmployeeIdNumber.Select(x => x.ToDelimitedString())) : null,
                       GuarantorEmploymentStatus?.ToDelimitedString(),
                       GuarantorOrganizationName != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorOrganizationName.Select(x => x.ToDelimitedString())) : null,
                       GuarantorBillingHoldFlag,
                       GuarantorCreditRatingCode?.ToDelimitedString(),
                       GuarantorDeathDateAndTime.HasValue ? GuarantorDeathDateAndTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       GuarantorDeathFlag,
                       GuarantorChargeAdjustmentCode?.ToDelimitedString(),
                       GuarantorHouseholdAnnualIncome?.ToDelimitedString(),
                       GuarantorHouseholdSize.HasValue ? GuarantorHouseholdSize.Value.ToString(Consts.NumericFormat, culture) : null,
                       GuarantorEmployerIdNumber != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorEmployerIdNumber.Select(x => x.ToDelimitedString())) : null,
                       GuarantorMaritalStatusCode?.ToDelimitedString(),
                       GuarantorHireEffectiveDate.HasValue ? GuarantorHireEffectiveDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       EmploymentStopDate.HasValue ? EmploymentStopDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       LivingDependency?.ToDelimitedString(),
                       AmbulatoryStatus != null ? string.Join(Configuration.FieldRepeatSeparator, AmbulatoryStatus.Select(x => x.ToDelimitedString())) : null,
                       Citizenship != null ? string.Join(Configuration.FieldRepeatSeparator, Citizenship.Select(x => x.ToDelimitedString())) : null,
                       PrimaryLanguage?.ToDelimitedString(),
                       LivingArrangement?.ToDelimitedString(),
                       PublicityCode?.ToDelimitedString(),
                       ProtectionIndicator,
                       StudentIndicator?.ToDelimitedString(),
                       Religion?.ToDelimitedString(),
                       MothersMaidenName != null ? string.Join(Configuration.FieldRepeatSeparator, MothersMaidenName.Select(x => x.ToDelimitedString())) : null,
                       Nationality?.ToDelimitedString(),
                       EthnicGroup != null ? string.Join(Configuration.FieldRepeatSeparator, EthnicGroup.Select(x => x.ToDelimitedString())) : null,
                       ContactPersonsName != null ? string.Join(Configuration.FieldRepeatSeparator, ContactPersonsName.Select(x => x.ToDelimitedString())) : null,
                       ContactPersonsTelephoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, ContactPersonsTelephoneNumber.Select(x => x.ToDelimitedString())) : null,
                       ContactReason?.ToDelimitedString(),
                       ContactRelationship?.ToDelimitedString(),
                       JobTitle,
                       JobCodeClass?.ToDelimitedString(),
                       GuarantorEmployersOrganizationName != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorEmployersOrganizationName.Select(x => x.ToDelimitedString())) : null,
                       Handicap?.ToDelimitedString(),
                       JobStatus?.ToDelimitedString(),
                       GuarantorFinancialClass?.ToDelimitedString(),
                       GuarantorRace != null ? string.Join(Configuration.FieldRepeatSeparator, GuarantorRace.Select(x => x.ToDelimitedString())) : null,
                       GuarantorBirthPlace,
                       VipIndicator?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Exemplo n.º 28
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 56, Configuration.FieldSeparator),
                       Id,
                       SetIdIn1.HasValue ? SetIdIn1.Value.ToString(culture) : null,
                       HealthPlanId?.ToDelimitedString(),
                       InsuranceCompanyId != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCompanyId.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCompanyName != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCompanyName.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCompanyAddress != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCompanyAddress.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCoContactPerson != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCoContactPerson.Select(x => x.ToDelimitedString())) : null,
                       InsuranceCoPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, InsuranceCoPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       GroupNumber,
                       GroupName != null ? string.Join(Configuration.FieldRepeatSeparator, GroupName.Select(x => x.ToDelimitedString())) : null,
                       InsuredsGroupEmpId != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsGroupEmpId.Select(x => x.ToDelimitedString())) : null,
                       InsuredsGroupEmpName != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsGroupEmpName.Select(x => x.ToDelimitedString())) : null,
                       PlanEffectiveDate.HasValue ? PlanEffectiveDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       PlanExpirationDate.HasValue ? PlanExpirationDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       AuthorizationInformation?.ToDelimitedString(),
                       PlanType?.ToDelimitedString(),
                       NameOfInsured != null ? string.Join(Configuration.FieldRepeatSeparator, NameOfInsured.Select(x => x.ToDelimitedString())) : null,
                       InsuredsRelationshipToPatient?.ToDelimitedString(),
                       InsuredsDateOfBirth.HasValue ? InsuredsDateOfBirth.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       InsuredsAddress != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsAddress.Select(x => x.ToDelimitedString())) : null,
                       AssignmentOfBenefits?.ToDelimitedString(),
                       CoordinationOfBenefits?.ToDelimitedString(),
                       CoordOfBenPriority,
                       NoticeOfAdmissionFlag,
                       NoticeOfAdmissionDate.HasValue ? NoticeOfAdmissionDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReportOfEligibilityFlag,
                       ReportOfEligibilityDate.HasValue ? ReportOfEligibilityDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ReleaseInformationCode?.ToDelimitedString(),
                       PreAdmitCertPac,
                       VerificationDateTime.HasValue ? VerificationDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       VerificationBy != null ? string.Join(Configuration.FieldRepeatSeparator, VerificationBy.Select(x => x.ToDelimitedString())) : null,
                       TypeOfAgreementCode?.ToDelimitedString(),
                       BillingStatus?.ToDelimitedString(),
                       LifetimeReserveDays.HasValue ? LifetimeReserveDays.Value.ToString(Consts.NumericFormat, culture) : null,
                       DelayBeforeLRDay.HasValue ? DelayBeforeLRDay.Value.ToString(Consts.NumericFormat, culture) : null,
                       CompanyPlanCode?.ToDelimitedString(),
                       PolicyNumber,
                       PolicyDeductible?.ToDelimitedString(),
                       PolicyLimitAmount,
                       PolicyLimitDays.HasValue ? PolicyLimitDays.Value.ToString(Consts.NumericFormat, culture) : null,
                       RoomRateSemiPrivate,
                       RoomRatePrivate,
                       InsuredsEmploymentStatus?.ToDelimitedString(),
                       InsuredsAdministrativeSex?.ToDelimitedString(),
                       InsuredsEmployersAddress != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsEmployersAddress.Select(x => x.ToDelimitedString())) : null,
                       VerificationStatus,
                       PriorInsurancePlanId?.ToDelimitedString(),
                       CoverageType?.ToDelimitedString(),
                       Handicap?.ToDelimitedString(),
                       InsuredsIdNumber != null ? string.Join(Configuration.FieldRepeatSeparator, InsuredsIdNumber.Select(x => x.ToDelimitedString())) : null,
                       SignatureCode?.ToDelimitedString(),
                       SignatureCodeDate.HasValue ? SignatureCodeDate.Value.ToString(Consts.DateFormatPrecisionDay, culture) : null,
                       InsuredsBirthPlace,
                       VipIndicator?.ToDelimitedString(),
                       ExternalHealthPlanIdentifiers != null ? string.Join(Configuration.FieldRepeatSeparator, ExternalHealthPlanIdentifiers.Select(x => x.ToDelimitedString())) : null,
                       InsuranceActionCode
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Exemplo n.º 29
0
        public static string HandicapFilename(Handicap h)
        {
            string filename = "";

            switch (h)
            {
            case Handicap.GreenMateria:
                filename = "MagicMateriaIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.RedMateria:
                filename = "SummonMateriaIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.BlueMateria:
                filename = "SupportMateriaIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.PurpleMateria:
                filename = "IndependentMateriaIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.YellowMateria:
                filename = "CommandMateriaIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.AllMateria:
                filename = "AllMateriaIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.Accessory:
                filename = "AccessoryIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.Item:
                filename = "ItemCommandIsSealed-ffvii-BSreel.png";
                break;

            case Handicap.Armor:
                filename = "ArmorIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.Weapon:
                filename = "WeaponIsBroken-ffvii-BSreel.png";
                break;

            case Handicap.Speed:
                filename = "1-2Speed-ffvii-BSreel.png";
                break;

            case Handicap.Mini:
                filename = "Minimum-ffvii-BSreel.png";
                break;

            case Handicap.Poison:
                filename = "Poison-ffvii-BSreel.png";
                break;

            case Handicap.Toad:
                filename = "Toad-ffvii-BSreel.png";
                break;

            case Handicap.TimeDamage:
                filename = "TimeX30Damage-ffvii-BSreel.png";
                break;

            case Handicap.FiveLevels:
                filename = "Down5Levels-ffvii-BSreel.png";
                break;

            case Handicap.TenLevels:
                filename = "Down10Levels-ffvii-BSreel.png";
                break;

            case Handicap.HP:
                filename = "1-2HP-ffvii-BSreel.png";
                break;

            case Handicap.MP:
                filename = "1-2MP-ffvii-BSreel.png";
                break;

            case Handicap.HPMP:
                filename = "1-2HP&MP-ffvii-BSreel.png";
                break;

            case Handicap.ZeroMP:
                filename = "ZeroMP-ffvii-BSreel.png";
                break;

            case Handicap.Lucky7:
                filename = "YesssNoHandicapp-ffvii-BSreel.png";
                break;

            case Handicap.Cure:
                filename = "HPRestored-ffvii-BSreel.png";
                break;
            }

            return(filename);
        }
Exemplo n.º 30
0
        public async Task <OlimpOddEvent> GetOddsByEventId(OlimpEvent olimpEvent)
        {
            string   url          = "/en/sports/match/" + olimpEvent.EventId;
            HtmlNode documentNode = this.GetDocumentNodeByUrl(url);

            if (documentNode != null)
            {
                HtmlNode oddsContainer = documentNode.QuerySelector(".coef");

                MoneyLine       moneyLine    = new MoneyLine();
                DoubleChance    doubleChance = new DoubleChance();
                List <Total>    totals       = new List <Total>();
                List <Handicap> handicaps    = new List <Handicap>();

                List <Total> homeTotals = new List <Total>();
                List <Total> awayTotals = new List <Total>();

                OlimpOddEvent olimpOddEvent = new OlimpOddEvent();



                try
                {
                    foreach (HtmlNode node in oddsContainer.ChildNodes)
                    {
                        if (node.OriginalName == "div" && this.GetAtributeValueByName(node, "class") == "")
                        {
                            foreach (HtmlNode htmlNode in node.ChildNodes)
                            {
                                if (htmlNode.OriginalName == "div" && this.GetAtributeValueByName(htmlNode, "class") == "livelineheader")
                                {
                                    string type = this.GetMarketTypeByLiveheaderNode(htmlNode);

                                    if (type == "FULL TIME RESULT")

                                    {
                                        moneyLine = this.getMoneylineFoEvent(node, olimpEvent.EventId);
                                    }


                                    if (type == "DOUBLE CHANCE")
                                    {
                                        doubleChance = this.getDoubleChanceFoEvent(node, olimpEvent.EventId);
                                    }
                                    if (type == "TOTAL GOALS")
                                    {
                                        Total t = this.GetTotalForEvent(node, olimpEvent.EventId);
                                        if (t != null)
                                        {
                                            totals.Add(t);
                                        }
                                    }

                                    if (type == "ALTERNATIVE TOTAL GOALS")
                                    {
                                        List <Total> totals2 = this.GetTotalGoals(node, olimpEvent.EventId);
                                        if (totals2 != null)
                                        {
                                            totals.AddRange(totals2);
                                        }
                                    }
                                    if (type == "HANDICAP RESULT")
                                    {
                                        Handicap h = this.GetHandicap(node, olimpEvent.EventId);
                                        if (h != null)
                                        {
                                            handicaps.Add(h);
                                        }
                                    }

                                    if (type == "ALTERNATIVE HANDICAP RESULT")
                                    {
                                        List <Handicap> hdps = this.GetHandicaps(node, olimpEvent.EventId);
                                        if (hdps != null)
                                        {
                                            handicaps.AddRange(hdps);
                                        }
                                    }


                                    if (type == "TEAM TOTAL")
                                    {
                                        var result = this.GetTeamTotals(node, olimpEvent);
                                        if (result.home != null)
                                        {
                                            awayTotals = result.away;
                                            homeTotals = result.home;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    return(null);
                }



                olimpOddEvent.moneyLine    = moneyLine;
                olimpOddEvent.doubleChance = doubleChance;
                olimpOddEvent.Totals       = totals;
                olimpOddEvent.Handicaps    = handicaps;
                olimpOddEvent.AwayTotals   = awayTotals;
                olimpOddEvent.HomeTotals   = homeTotals;


                olimpOddEvent.EventId    = olimpEvent.EventId;
                olimpOddEvent.HomeTeam   = olimpEvent.HomeTeam;
                olimpOddEvent.AwayTeam   = olimpEvent.AwayTeam;
                olimpOddEvent.LeagueName = olimpEvent.LeagueName;
                olimpOddEvent.StartDate  = olimpEvent.StartDate;
                olimpOddEvent.DateAdded  = DateTime.Now.ToString();

                return(olimpOddEvent);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 31
0
        private async Task GuardarDados()
        {
            //Validar dados atuais.
            if (!ValidarDados())
            {
                return;
            }

            //Se o jogador antes estava bloqueado, é necessário criar um model para o mesmo.
            if (_jogador.Bloqueado)
            {
                JogadorModel jogadorModel = new JogadorModel(Nome.Valor, Email.Valor, Genero.ObterModel(), Foto, Handicap.ObterModel(), Tee.ObterModel());
                _jogador.DefinirModel(jogadorModel);

                //Avisar que utilizador foi criado.
                MediadorMensagensService.Instancia.Avisar(MediadorMensagensService.ViewModelMensagens.JogadorAdicionado, _jogador);
            }
            else
            {
                //O modelo já está criado. Basta atualizar os valores do mesmo.
                _jogador.Nome     = Nome.Valor;
                _jogador.Email    = Email.Valor;
                _jogador.Foto     = Foto;
                _jogador.Foto     = Foto;
                _jogador.Genero   = Genero;
                _jogador.Tee      = Tee;
                _jogador.Handicap = Handicap;
            }

            //Fechar PopUp.
            await base.NavigationService.SairDeEditarJogador();

            LimparMemoria();
        }
Exemplo n.º 32
0
 private async Task <Boolean> AddHandicap(Handicap handicap)
 {
     return(await _handicapAccessLayer.AddHandicap(handicap));
 }