public string FuehreAus(Scorecard scorecard) { scorecard.ErhoeheAnzahlSchlaege(); return string.Format("Du hast {0} {1}.", new Schlagausgabe().FuehreAus(scorecard), new Lochausgabe().FuehreAus(scorecard)); }
void SetPlayerNumber(int id) { Color c = playerMaterials [id - 1].color; playerID = id; myStats = new Scorecard(id); if (nametag == null) { nametag = transform.FindChild("Nametag").GetComponent <TextMesh> (); //change player to dif color //body transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer> ().material = playerMaterials[id - 1]; //5 for (int i = 0; i < 5; ++i) { transform.GetChild(0).GetChild(0).GetChild(i).GetComponent <SpriteRenderer> ().material = playerMaterials[id - 1]; if (i != 4) { transform.GetChild(0).GetChild(0).GetChild(i).GetChild(0).GetComponent <SpriteRenderer> ().material = playerMaterials[id - 1]; transform.GetChild(0).GetChild(0).GetChild(i).GetChild(0).GetChild(0).GetComponent <SpriteRenderer> ().material = playerMaterials[id - 1]; } } nametag.color = c; nametag.text = "P" + id.ToString(); } GameObject.FindObjectOfType <GameCamera> ().playerList.Add(this); }
public ActionResult PostScorecard([Bind(Exclude = "RoundDetailId")] Scorecard scorecard) { if (ModelState.IsValid) { int totalScore = 0; for (int i = 0; i < scorecard.Details.Count; i++) { var detail = new RoundDetail(); detail.RoundDetailId = db.RoundDetails.Max(x => x.RoundDetailId) + 1; detail.RoundId = scorecard.Round.RoundId; detail.HoleId = scorecard.Holes[i].HoleId; detail.Score = scorecard.Details[i].Score; detail.Putts = scorecard.Details[i].Putts; detail.GIR = scorecard.Details[i].GIR; detail.FIR = scorecard.Details[i].FIR; totalScore += Convert.ToInt32(detail.Score); db.RoundDetails.Add(detail); db.SaveChanges(); } Round round = db.Rounds.Find(scorecard.Round.RoundId); round.RoundId = round.RoundId; round.TotalScore = totalScore; db.SaveChanges(); return(RedirectToAction("Index", "RoundDetails")); } return(View(scorecard)); }
public string FuehreAus(Scorecard scorecard) { var hilfstexte = new AlleBefehle().Befehle().ConvertAll(HilfstextFuer); return "Ich helfe dir beim Fuehren der Scorecard. Ich reagiere auf folgende Befehle: " + string.Join(System.Environment.NewLine, hilfstexte) + "."; }
public bool AddPlayerScores(Scorecard submittedScoreCard) { var success = 0; foreach (var round in submittedScoreCard.Rounds) { using var connection = new SqlConnection(ConnectionString); using var command = new SqlCommand("RecordGolferScore", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@golferId", SqlDbType.NVarChar).Value = submittedScoreCard.Golfer.Id; command.Parameters.Add("@courseName", SqlDbType.NVarChar).Value = submittedScoreCard.Course; command.Parameters.Add("@date", SqlDbType.Date).Value = submittedScoreCard.Date.Date; command.Parameters.Add("@hole", SqlDbType.Int).Value = round.Hole; command.Parameters.Add("@score", SqlDbType.Int).Value = round.Score; command.Parameters.Add("@rating", SqlDbType.Decimal).Value = round.Rating; command.Parameters.Add("@slope", SqlDbType.Decimal).Value = round.Slope; //Open the connection and execute the reader connection.Open(); success = command.ExecuteNonQuery(); connection.Close(); } return(success != 0); }
public void LOCAL_SetPlayerNumber(int id) { Color c = playerMaterials [id - 1].color; playercolor = c; playerID = id; myStats = new Scorecard(id); XBox = new Xbox360Controller(id); if (nametag == null) { nametag = transform.FindChild("Nametag").GetComponent <TextMesh> (); //change player to dif color //body //transform.GetChild (0).GetChild (0).GetComponent<SpriteRenderer> ().material = playerMaterials[id - 1]; //5 for (int i = 0; i < 5; ++i) { //transform.GetChild (0).GetChild (0).GetChild (i).GetComponent<SpriteRenderer> ().material = playerMaterials[id - 1]; if (i != 4) { //transform.GetChild (0).GetChild (0).GetChild (i).GetChild(0).GetComponent<SpriteRenderer> ().material = playerMaterials[id - 1]; //transform.GetChild (0).GetChild (0).GetChild (i).GetChild(0).GetChild(0).GetComponent<SpriteRenderer> ().material = playerMaterials[id - 1]; } } //nametag.color = c; nametag.text = "P" + id.ToString(); AI = GetComponent <AIComponent>(); if (AI != null) { nametag.text = "CP" + id.ToString(); } } }
public async Task <DIBZ.Common.Model.Swap> CreateDeal(int id) { var counterOffer = await Db.GetObjectById <DIBZ.Common.Model.CounterOffer>(id); Scorecard offerCreaterSC = await Db.GetObjectById <DIBZ.Common.Model.Scorecard>(counterOffer.Offer.ApplicationUserId); if (offerCreaterSC == null) { offerCreaterSC = new Scorecard(); offerCreaterSC.ApplicationUserId = counterOffer.Offer.ApplicationUserId; offerCreaterSC.Proposals += 1; Db.Add(offerCreaterSC); } else { offerCreaterSC.ApplicationUserId = counterOffer.Offer.ApplicationUserId; offerCreaterSC.Proposals += 1; } Scorecard offerWantSC = await Db.GetObjectById <DIBZ.Common.Model.Scorecard>(counterOffer.CounterOfferPersonId); if (offerWantSC == null) { offerWantSC = new Scorecard(); offerWantSC.ApplicationUserId = counterOffer.CounterOfferPersonId; offerWantSC.Proposals += 1; Db.Add(offerWantSC); } else { offerWantSC.ApplicationUserId = counterOffer.CounterOfferPersonId; offerWantSC.Proposals += 1; } DIBZ.Common.Model.Swap swap = new DIBZ.Common.Model.Swap(); swap.OfferId = counterOffer.OfferId; swap.IsActive = true; swap.IsDeleted = false; swap.GameSwapPsersonId = counterOffer.CounterOfferPersonId; swap.GameSwapWithId = counterOffer.GameCounterOfferWithId; swap.SwapStatus = SwapStatus.Accepted; Db.Add(swap); var offer = await Db.GetObjectById <DIBZ.Common.Model.Offer>(counterOffer.OfferId); offer.OfferStatus = OfferStatus.Accept; await Db.SaveAsync(); await MarkOtherOffersNotAvailable(offer); //handling impact await HandlingOfferedImpact(counterOffer); return(swap); }
public void BindDropDown() { CurrentCard = null; //add visibility check if (!Page.IsCallback && !IsPostBack) { gridScorecardWidget.Visible = false; } if (ItemChanged == true) { //rebind cards dropdown List <Scorecard> ItemScoreCards = rc_services.GetScorecards(ScorecardItemKey); comboCards.DataSource = ItemScoreCards; comboCards.DataBind(); //Get all of the scorecardinfo through by finfing the scorecard object in the list foreach (Scorecard x in ItemScoreCards) { if (x.CardId == ScorecardKey) { CurrentCard = x; } } //check to see if previous scorecard is also available for the new item, if so, select that one in dropdown and set ScorecardKey //if (CurrentCard != null) //{ // for (int i = 0; i == comboCards.Items.Count - 1; i++) // { // if (comboCards.Items[i].Value.ToString() == CurrentCard.CardId) { comboCards.Value = CurrentCard.CardId; } // } //} if (CurrentCard == null && comboCards.Items.Count > 0 && comboCards.Items[0].Text != String.Empty) { comboCards.SelectedIndex = 0; ScorecardKey = comboCards.Value.ToString(); foreach (Scorecard x in ItemScoreCards) { if (x.CardId == ScorecardKey) { CurrentCard = x; } } } if (CurrentCard != null) { comboCards.Text = CurrentCard.CardName; paramScorecard.Set("CardName", CurrentCard.CardName); } //ItemChanged = false; ScorecardChanged = true; } }
public ScorecardDocument(Scorecard scorecard) { CourseId = scorecard.CourseId; Date = scorecard.Date; Id = scorecard.Id; PlayerId = scorecard.PlayerId; ScorecardData = JsonConvert.SerializeObject(scorecard); }
public ActionResult DeleteConfirmed(int id) { Scorecard scorecard = db.Scorecards.Find(id); db.Scorecards.Remove(scorecard); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// GetCalibrationQueue calibration layer /// </summary> /// <param name="appName"></param> /// <returns></returns> public List <CalibrationsPendingInfo> GetCalibrationQueue(string appName) { using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString)) { string userName = ""; if (HttpContext.Current.Request.UrlReferrer.Host.Contains("localhost") && HttpContext.Current.Request.UrlReferrer.Port == 51268) { userName = "******";// HttpContext.Current.User.Identity.Name; } else { userName = HttpContext.Current.User.Identity.Name; } SqlCommand sqlComm = new SqlCommand(); sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "getCaliQueue"; sqlComm.Parameters.AddWithValue("@username", userName); sqlComm.Parameters.AddWithValue("@appname", appName); sqlComm.Connection = sqlCon; var calibrationsPendingInfoList = new List <CalibrationsPendingInfo>(); try { sqlCon.Open(); SqlDataReader reader = sqlComm.ExecuteReader(); while (reader.Read()) { try { Scorecard scorecard = new Scorecard() { scorecardName = reader.GetValue(reader.GetOrdinal("scorecard_name")).ToString(), scorecardId = int.Parse(reader.GetValue(reader.GetOrdinal("scorecardId")).ToString()) }; calibrationsPendingInfoList.Add(new CalibrationsPendingInfo { pendingCalibrations = int.Parse(reader.GetValue(reader.GetOrdinal("Pending_Calibs")).ToString()), oldestCall = DateTime.Parse(reader.GetValue(reader.GetOrdinal("oldest_call")).ToString()), pendingReviewTime = decimal.Parse(reader.GetValue(reader.GetOrdinal("pending_review_time")).ToString()), scorecard = scorecard }); } catch (Exception ex) { throw ex; } } ; return(calibrationsPendingInfoList); } catch (Exception ex) { throw ex; } } }
public void Player1HasWon() { var scorecard = new Scorecard(); scorecard.PlayerOne.HasWon = true; var hasAdvantage = scorecard.GetCurrentGamePoints(); Assert.AreEqual("Player1 has won", hasAdvantage); }
public void Scorecard_Add_LeavesPreviousScoreWhenScoreDecreasesToZero_AndLastDartIsNotDoubleNorInnerBullsEye() { _throwResult[0].SetupGet(r => r.TotalPoints).Returns(60); _throwResult[1].SetupGet(r => r.TotalPoints).Returns(60); var scorecard = new Scorecard(120); scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object); Assert.AreEqual(120, scorecard.Score); }
public void TestMethod1() { var scorecard = new Scorecard(); scorecard.PlayerOne.Points = 15; scorecard.PlayerTwo.Points = 30; string points = scorecard.GetCurrentGamePoints(); Assert.AreEqual("15:30", points); }
public void ShallGamePointBeLoveFifteen() { var playerA = new Player(); var playerB = new Player(); var scorecard = new Scorecard(playerA, playerB); scorecard.AwardPointToPlayer(playerB); Assert.AreEqual("Love - Fifteen", scorecard.GetCurrentGamePoints()); }
public void Scorecard_Add_LeavesPreviousScoreWhenTotalPointsAreBigger() { _throwResult[0].SetupGet(r => r.TotalPoints).Returns(60); _throwResult[1].SetupGet(r => r.TotalPoints).Returns(60); _throwResult[2].SetupGet(r => r.TotalPoints).Returns(60); var scorecard = new Scorecard(179); scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object); Assert.AreEqual(179, scorecard.Score); }
public void Scorecard_Add_LeavesPreviousScoreWhenScoreDecreasesToOne() { _throwResult[0].SetupGet(r => r.TotalPoints).Returns(60); _throwResult[1].SetupGet(r => r.TotalPoints).Returns(60); _throwResult[2].SetupGet(r => r.TotalPoints).Returns(60); var scorecard = new Scorecard(181); scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object); Assert.AreEqual(181, scorecard.Score); }
public ActionResult Edit([Bind(Include = "Id,PlayerId,MatchId")] Scorecard scorecard) { if (ModelState.IsValid) { db.Entry(scorecard).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MatchId = new SelectList(db.Matches, "Id", "Description", scorecard.MatchId); ViewBag.PlayerId = new SelectList(db.Players, "Id", "Name", scorecard.PlayerId); return(View(scorecard)); }
public void Scorecard_Add_UpdatesScoreWithAllThePoints() { _throwResult[0].SetupGet(r => r.TotalPoints).Returns(50); _throwResult[1].SetupGet(r => r.TotalPoints).Returns(25); _throwResult[2].SetupGet(r => r.TotalPoints).Returns(15); var scorecard = new Scorecard(150); scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object); Assert.AreEqual(60, scorecard.Score); }
public void TestMethod1() { Scorecard scorcard = new Scorecard(); scorcard.Add("player1", 10); scorcard.Add("player2", 15); int expectedScore = 15; int actualScore = scorcard["player2"]; Assert.AreEqual(expectedScore, actualScore); }
public override void SetUp() { base.SetUp(); firstScorecard = Presto.Persist <Scorecard>(); firstTenant = firstScorecard.Tenant; secondScorecard = Presto.Persist <Scorecard>(); secondTenant = secondScorecard.Tenant; ClarityDB.Instance.SaveChanges(); ClarityDB.CreateInstance(firstTenant.Users.First()); }
public void Scorecard_Add_SetsScoreAsZero_WhenNewScoreIsZero_AndLastDartIsInnerBullseye() { _throwResult[0].SetupGet(r => r.TotalPoints).Returns(20); _throwResult[1].SetupGet(r => r.TotalPoints).Returns(20); _throwResult[2].SetupGet(r => r.TotalPoints).Returns(50); _throwResult[2].SetupGet(r => r.IsInnerBullseye).Returns(true); var scorecard = new Scorecard(90); scorecard.Add(_throwResult[0].Object, _throwResult[1].Object, _throwResult[2].Object); Assert.AreEqual(0, scorecard.Score); }
private void OnPlayerJoined(PlayerMessage message) { var score = new Scorecard() { PlayerId = Guid.NewGuid(), PlayerName = message.PlayerName, AnswerStatus = AnswerState.Unanswered, TotalScore = 0, TotalCorrectAnswers = 0, TotalTime = TimeSpan.Zero }; Scorecards.Add(score); }
// GET: /Scorecard/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Scorecard scorecard = db.Scorecards.Find(id); if (scorecard == null) { return(HttpNotFound()); } return(View(scorecard)); }
public void ShallPlayerWinTheGameWhenSheWinsTheBallAtFourtyAndOtherPlayerHasLessThanFourty() { var playerA = new Player(); var playerB = new Player(); var scorecard = new Scorecard(playerA, playerB); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerB); Assert.AreEqual("Player B wins", scorecard.GetCurrentGamePoints()); }
public dynamic GetNotificationCallss([FromBody] GetNCallsRequestData noti_post) { GetNotificationCallsResponseData noti_response = new GetNotificationCallsResponseData(); string userName; if (HttpContext.Current.Request.UrlReferrer.Host.Contains("localhost") && HttpContext.Current.Request.UrlReferrer.Port == 51268) { userName = "******";// HttpContext.Current.User.Identity.Name; } else { userName = HttpContext.Current.User.Identity.Name; } using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString)) { SqlCommand sq = new NotificationLayer().PrepareParams("[getNotificationsReportByScorecard]", userName, noti_post); sq.CommandType = CommandType.StoredProcedure; sq.CommandTimeout = int.MaxValue; sq.Connection = sqlCon; SqlDataAdapter adapter = new SqlDataAdapter(sq); DataSet ds = new DataSet(); adapter.Fill(ds); List <NotificationByScorecard> scnot = new List <NotificationByScorecard>(); foreach (DataRow dr in ds.Tables[0].Rows) { NotificationByScorecard not = new NotificationByScorecard(); Scorecard sc = new Scorecard(); UserApp app = new UserApp(); sc.scorecardId = dr.Field <int>("scorecard"); sc.scorecardName = dr.Field <string>("scorecardName").ToString(); not.scorecard = sc; not.app = app; not.totalCount = dr.Field <int>("totalNotifications"); not.openedByCC = dr.Field <int>("openNotificationsByCC"); not.openedByClient = dr.Field <int>("openNotificationsByClient"); not.closedWithDisp = dr.Field <int>("closedWithDisp"); not.closedWithoutDisp = dr.Field <int>("closedWithoutDisp"); not.nonbillableTime = dr.Field <int>("nonbillableTime"); not.billableTime = dr.Field <int>("billableTime"); not.avgDaysOpen = dr.Field <int>("avgDaysOpen"); scnot.Add(not); } return(scnot); } }
// GET: /Scorecard/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Scorecard scorecard = db.Scorecards.Find(id); if (scorecard == null) { return(HttpNotFound()); } ViewBag.MatchId = new SelectList(db.Matches, "Id", "Description", scorecard.MatchId); ViewBag.PlayerId = new SelectList(db.Players, "Id", "Name", scorecard.PlayerId); return(View(scorecard)); }
public void BothPlayersAreAtDeuceWhenTheyHaveFourtyPoints() { var playerA = new Player(); var playerB = new Player(); var scorecard = new Scorecard(playerA, playerB); scorecard.AwardPointToPlayer(playerA); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerA); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerA); scorecard.AwardPointToPlayer(playerB); Assert.AreEqual("Deuce", scorecard.GetCurrentGamePoints()); }
public void ShallPlayerHaveAdvantageWhenSheWinsTheBallAtFourtyAndOtherPlayerHasFourty() { var playerA = new Player(); var playerB = new Player(); var scorecard = new Scorecard(playerA, playerB); scorecard.AwardPointToPlayer(playerA); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerA); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerA); scorecard.AwardPointToPlayer(playerB); scorecard.AwardPointToPlayer(playerB); Assert.AreEqual("Advantage Player B", scorecard.GetCurrentGamePoints()); }
/// <summary> /// Retrieve graph data of the primary metric of all KPIs in a scorecard /// for a month in an year /// </summary> /// <param name="scorecardId">Scorecard Id</param> /// <param name="yearId">Identifier of the year</param> /// <param name="month">Month</param> /// <returns>Graph data</returns> public IEnumerable <KPIGraphData> GetScorecardGraphData(int scorecardId, int yearId, int month) { List <KPIGraphData> scorecardKPIsGraphData = new List <KPIGraphData>(); Scorecard scorecard = scorecardRepository.Get(scorecardId); if (scorecard != null) { foreach (var kpi in scorecard.KPIs) { KPIGraphData kpiGraphData = GetScorecardKPIGraphData(scorecardId, kpi.Id, yearId, month); scorecardKPIsGraphData.Add(kpiGraphData); } } return(scorecardKPIsGraphData); }
public async Task <ActionResult <Scorecard> > UpdateScorecardAsync(Guid id, [FromBody] Scorecard scorecard) { if (id == Guid.Empty || scorecard == null || id != scorecard.Id) { return(BadRequest()); } var validationResult = await _validator.ValidateAsync(scorecard); if (!validationResult.IsValid) { return(BadRequest(validationResult.Errors)); } var command = new UpdateScorecard(scorecard); await _messenger.SendAsync(new UpdateScorecard(scorecard)); return(Accepted(command)); }
public double?GetNumberOfDaysWithOutRecordables(Scorecard scorecard) { bool isNumberOfDaysWithOutRecordablesEnabled = Convert.ToBoolean( ConfigurationManager.AppSettings[AppSettingsKeys. EnableNumberOfDaysWithoutRecordables]); if (isNumberOfDaysWithOutRecordablesEnabled && scorecard.Recordables != null && scorecard.Recordables.Any(x => x.IsActive)) { Recordable recordable = scorecard.Recordables.Where(x => x.IsActive) .OrderByDescending(x => x.RecordableDate).First(); DateTime currentDate = TimeZoneUtility.GetCurrentTimestamp().Date; double numberofDaysWithoutRecordables = (currentDate - recordable.RecordableDate).TotalDays; return(numberofDaysWithoutRecordables); } return(null); }
public string FuehreAus(Scorecard scorecard) { var schlagnomen = scorecard.AnzahlSchlaege == 1 ? "Schlag" : "Schlaege"; return string.Format("{0} {1}", scorecard.AnzahlSchlaege, schlagnomen); }
public string FuehreAus(Scorecard scorecard) { return $"Du hast {scorecard.AnzahlSchlaege} Schlag {_folgeOperation.FuehreAus(scorecard)}"; }
public string FuehreAus(Scorecard scorecard) { scorecard.SchliesseLochAb(); return new Lochbegruessung().FuehreAus(scorecard); }
public string FuehreAus(Scorecard scorecard) { return string.Format("Du bist jetzt {0}.", new Lochausgabe().FuehreAus(scorecard)); }
public Round(int number, int par, Scorecard scorecard) { Number = number; Par = par; Scorecard = scorecard; }
public string FuehreAus(Scorecard scorecard) { return string.Format("Du hast {0} Schlag {1}", scorecard.AnzahlSchlaege, _folgeOperation.FuehreAus(scorecard)); }
public string FuehreAus(Scorecard scorecard) { return $"Du bist jetzt {_folgeOperation.FuehreAus(scorecard)}"; }
public string FuehreAus(Scorecard scorecard) { return string.Format("auf dem {0}.Loch", scorecard.Lochnummer); }
public Tracker(Interpreter interpreter, Operation startoperation) { _interpreter = interpreter; _startoperation = startoperation; _scorecard = new EinfacheScorecard(); }
public string FuehreAus(Scorecard scorecard) { scorecard.SchliesseLochAb(); return _folgeOperation.FuehreAus(scorecard); }
public void InitialisiereScorecard() { _scorecard = new EinfacheScorecard(); }
public string FuehreAus(Scorecard scorecard) { return $"auf dem {scorecard.Lochnummer}.Loch."; }
public string FuehreAus(Scorecard scorecard) { scorecard.ErhoeheAnzahlSchlaege(); return _folgeOperation.FuehreAus(scorecard); }
public Tracker(Interpreter interpreter, Scorecard scorecard, Operation startoperation) { _interpreter = interpreter; _scorecard = scorecard; _startoperation = startoperation; }
public string FuehreAus(Scorecard scorecard) { return string.Format("Du bist jetzt {0}", _folgeOperation.FuehreAus(scorecard)); }
public string FuehreAus(Scorecard scorecard) { return string.Format("{0} Schlag", scorecard.AnzahlSchlaege); }