/* G E N G A M E S T A T S */ /*---------------------------------------------------------------------------- %%Function: GameData %%Qualified: GenCount.CountsData:GameData.GameData %%Contact: rlittle ----------------------------------------------------------------------------*/ public GameData(StatusRpt srpt) { // m_sRoster = null; m_srpt = srpt; m_rst = new Roster(srpt); m_gms = new GameSlots(srpt); }
public void StudentShouldNotBeNull() { Roster r = new Roster(); Assert.IsNotNull(r.Students); }
public LeagueViewModel() { Roster briansRoster = new Roster("The Bombers", GetBomberPlayers()); BriansTeam = new RosterViewModel(briansRoster); Roster jimmysRoster = new Roster("The Amazins", GetAmazinPlayers()); JimmysTeam = new RosterViewModel(jimmysRoster); }
public RosterViewModel(Roster roster) { _roster = roster; Starters = new ObservableCollection<PlayerViewModel>(); Bench = new ObservableCollection<PlayerViewModel>(); TeamName = _roster.TeamName; UpdateRosters(); }
public IEnumerable<Roster> AddorUpdate(Roster rt, int[] orderID, int userID) { if (db == null) { db = new RouteOptimizationDBEntities(); } if (rt.RosterID > 0) { Roster roster; roster = GetById(rt.RosterID); db.Entry(roster).CurrentValues.SetValues(rt); } else { db.Rosters.Add(rt); } db.SaveChanges(); var id = rt.RosterID; RosterOrder ro = new RosterOrder(); for (int i = 0; i < orderID.Length; i++) { ro.RosterID = id; ro.OrderID = orderID[i]; db.RosterOrders.Add(ro); db.SaveChanges(); var res=(from order in db.Orders where order.OrderID == ro.OrderID select order).SingleOrDefault(); res.Status = "REC"; db.SaveChanges(); } var ua = (from user in db.UserAvailabilities where user.UserID == userID select user).SingleOrDefault(); ua.Status = "OC"; db.SaveChanges(); return db.Rosters.ToList(); }
/* L O A D R O S T E R */ /*---------------------------------------------------------------------------- %%Function: LoadRoster %%Qualified: GenCount.CountsData:GameData.LoadRoster %%Contact: rlittle ----------------------------------------------------------------------------*/ public bool FLoadRoster(string sRoster, int iMiscAffiliation) { m_rst = new Roster(m_srpt); bool f = m_rst.LoadRoster(sRoster, iMiscAffiliation); if (f) { m_gms.SetMiscHeadings(m_rst.PlsMiscHeadings); } return f; }
public MatchResult4(Roster roster, int teamScore, int opponentScore, int bitsMatchId) : this() { if (roster == null) throw new ArgumentNullException("roster"); if (roster.MatchResultId != null) throw new ApplicationException("Roster already has result registered"); VerifyScores(teamScore, opponentScore); ApplyChange( new MatchResult4Registered(roster.Id, roster.Players, teamScore, opponentScore, bitsMatchId)); }
public FriendsChatTabControl(Roster roster) { if (roster != null) { this.InitializeComponent(); this.roster = roster; this.rosterId = roster.Uid; this.ChatComponent.InitData(roster); this.ChatComponent.MsgRecordComp.Visibility = Visibility.Collapsed; } }
public void CanAddSpecialTeams() { var roster = new Roster(); var specialsToAdd = new List<SpecialTeamsPlayer> { new Kicker {FirstName = "Kai", LastName = "Forbath", TeamName = "Washington Redskins"}, new Punter {FirstName = "Sav", LastName = "Rocca", TeamName = "Washington Redskins"} }; roster.ChangeSpecialTeams(new SpecialTeamsPlayers(specialsToAdd)); }
//[HttpPost] public ActionResult Create(int[] selectOrder, int selectUser, string datepicker) { Roster roster = new Roster(); RosterDAL rd = new RosterDAL(); RosterViewModel rvm = new RosterViewModel(); roster.UserID = selectUser; roster.DeliveryStatus = "PE"; datepicker = datepicker + " 00:00:00"; roster.ActualDeliveryDate = Convert.ToDateTime(datepicker); rd.AddorUpdate(roster, selectOrder,selectUser); // Console.Write("hello"); // return View("Index",rvm); return RedirectToAction("Index"); }
//internal WrapPanel wrapPanel; //internal Canvas canvas; //internal TreeNodeStaffHead imgFace; //internal Image imgFaceForeground; //internal TextBlock txtName; //internal TextBlock txtSignagrue; ////private bool _contentLoaded; public TreeNodeRoster(Roster roster) { try { this.InitializeComponent(); this.roster = roster; this.status = roster.Status; this.UpdateInfo(); this.AddEventListenerHandler(); } catch (System.Exception ex) { System.Console.WriteLine(ex.ToString()); } }
public void AddRoster(Roster roster) { try { if (roster != null && this.FindRosterItem(roster.Uid) == null) { TreeNodeRoster node = new TreeNodeRoster(roster); node.DataContext = roster.Uid; this.RosterList.Items.Add(node); } } catch (System.Exception e) { System.Console.WriteLine(e.ToString()); } }
public void CanAddDefensiveBacks() { var roster = new Roster(); var dbs = new DefensiveBacks(new[] { new Cornerback{FirstName = "DeAngelo", LastName = "Hall", TeamName = "Washington Redskins"}, new Cornerback{FirstName = "David", LastName = "Amerson", TeamName = "Washington Redskins"}, new StrongSafety{FirstName = "Baccari", LastName = "Rambo", TeamName = "Washington Redskins"}, new DefensiveBack{FirstName = "E", LastName = "Biggers", TeamName = "Washington Redskins"}, }); roster.ChangeDefensiveBacks(dbs); Assert.AreEqual(dbs, roster.DefensiveBacks); }
public void CanAddQuarterbacks() { var roster = new Roster(); var qbsToAdd = new List<Quarterback> { new Quarterback {FirstName = "Robert", LastName = "Griffin", TeamName = "Washington Redskins"}, new Quarterback {FirstName = "Kirk", LastName = "Cousins", TeamName = "Washington Redskins"}, new Quarterback {FirstName = "Rex", LastName = "Grossman", TeamName = "Washington Redskins"}, new Quarterback {FirstName = "Pat", LastName = "White", TeamName = "Washington Redskins"} }; var quarterbacks = new Quarterbacks(qbsToAdd); roster.ChangeQuarterbacks(quarterbacks); Assert.AreEqual(quarterbacks, roster.Quarterbacks); }
static XmppGlobal() { jabber_client = new JabberClient (); roster_manager = new RosterManager (); roster_manager.Stream = jabber_client; presence_manager = new PresenceManager (); presence_manager.Stream = jabber_client; iq_tracker = new IQTracker (jabber_client); connection = new Connection (); debug = new Debug (); disco = new Disco (); presence = new Presence (); roster = new Roster (); queries = new Queries (); query_cache = new QueryCache (); messaging = new Messaging (); }
public RosterTab(Roster roster) { if (roster != null) { this.InitializeComponent(); this.roster = roster; this.TabHeader.Label = roster.Name; this.TabHeader.imgIcon.Source = roster.HeaderImage; base.Tag = new MenuItem { Icon = new Image { Source = roster.HeaderImage }, Header = roster.Name }; this.TabContent = new FriendsChatTabControl(roster); base.SetFocus2DesktopButton(); this.AddEventListenerHandler(); } }
public void Add_Adds_Student_To_Roster() { Roster r = new Roster(); Student s1 = new Student() { Name = "James", Gender = "Male" }; Student s2 = new Student() { Name = "Jane", Gender = "Female" }; Assert.AreEqual(0, r.Students.Count); r.Add(s1); Assert.AreEqual(1, r.Students.Count); }
public void AddPilotSkillModifier(IModifyPilotSkill modifier) { PilotSkillModifiers.Insert(0, modifier); Roster.UpdateShipStats(this); }
public void InitData(Roster roster) { this.roster = roster; this.InitService(); }
/// <summary> /// Thuc hien them moi roster /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gridRoster_RowInserting(object sender, ASPxDataInsertingEventArgs e) { try { // Validate user right for creating if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Create.Key, out _message)) { WebCommon.AlertGridView(sender, _message); e.Cancel = true; return; } var grid = sender as ASPxGridView; if (grid == null) { WebCommon.AlertGridView(sender, "Cannot find roster."); e.Cancel = true; return; } var fromTime = grid.FindEditFormTemplateControl("fromTime") as ASPxTimeEdit; var fromDate = grid.FindEditFormTemplateControl("fromDate") as ASPxDateEdit; var endTime = grid.FindEditFormTemplateControl("endTime") as ASPxTimeEdit; var endDate = grid.FindEditFormTemplateControl("endDate") as ASPxDateEdit; var doctor = grid.FindEditFormTemplateControl("cboDoctor") as ASPxComboBox; var rosterType = grid.FindEditFormTemplateControl("cboRosterType") as ASPxComboBox; if (fromTime == null || fromDate == null || endTime == null || endDate == null || doctor == null || rosterType == null) { WebCommon.AlertGridView(sender, "New form is error."); e.Cancel = true; return; } var chkIsRepeat = grid.FindEditFormTemplateControl("chkIsRepeat") as ASPxCheckBox; var chkWeekday = grid.FindEditFormTemplateControl("chkWeekday") as CheckBoxList; // Lay doctorUsername // Neu selected value la null thi mac dinh no bang empty var doctorUsername = string.Empty; if (doctor.SelectedItem != null) { doctorUsername = doctor.SelectedItem.Value.ToString(); } // Lay roster type // Neu selected value la null thi mac dinh no bang empty var rosterTypeId = string.Empty; if (rosterType.SelectedItem != null) { rosterTypeId = rosterType.SelectedItem.Value.ToString(); } // Validate empty field if (!WebCommon.ValidateEmpty("Doctor", doctorUsername, out _message) || !WebCommon.ValidateEmpty("Roster Type", rosterTypeId, out _message) || !WebCommon.ValidateEmpty("From Time", fromTime.Text, out _message) || !WebCommon.ValidateEmpty("From Date", fromDate.Text, out _message) || !WebCommon.ValidateEmpty("End Time", endTime.Text, out _message) || !WebCommon.ValidateEmpty("End Date", endDate.Text, out _message)) { WebCommon.AlertGridView(sender, _message); e.Cancel = true; return; } // Get date time DateTime dtStart = (DateTime)fromDate.Value, dtEnd = (DateTime)endDate.Value; DateTime timeStart = (DateTime)fromTime.Value, timeEnd = (DateTime)endTime.Value; dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, timeStart.Hour, timeStart.Minute, 0); dtEnd = new DateTime(dtEnd.Year, dtEnd.Month, dtEnd.Day, timeEnd.Hour, timeEnd.Minute, 0); // Declare list of roster in case repeat roster var lstRoster = new TList<Roster>(); // Lay du lieu duoc nhap vao var username = doctor.SelectedItem.Value.ToString(); int intRosterTypeId; var note = e.NewValues["Note"].ToString(); if (!Int32.TryParse(rosterType.SelectedItem.Value.ToString(), out intRosterTypeId)) { WebCommon.AlertGridView(sender, "Roster Type is invalid."); e.Cancel = true; return; } if (chkIsRepeat != null && chkIsRepeat.Checked && chkWeekday != null) { #region Validate Time // Set lai ngay cho endtime de so sanh timeEnd = new DateTime(timeStart.Year, timeStart.Month, timeStart.Day, timeEnd.Hour, timeEnd.Minute, 0); if (timeStart >= timeEnd) { WebCommon.AlertGridView(sender, "End time must be greater than start time."); e.Cancel = true; return; } if (dtStart >= dtEnd) { WebCommon.AlertGridView(sender, "To time must be greater than from date."); e.Cancel = true; return; } // If roster is created in a passed or current day DateTime dtNow = DateTime.Now; if (new DateTime(dtNow.Year, dtNow.Month, dtNow.Day) >= new DateTime(dtStart.Year, dtStart.Month, dtStart.Day)) { WebCommon.AlertGridView(sender, "You can not change roster to passed or current date."); e.Cancel = true; return; } #endregion // Get auto increasement id string perfix = ServiceFacade.SettingsHelper.RosterPrefix + DateTime.Now.ToString("yyMMdd"); int count; TList<Roster> objPo = DataRepository.RosterProvider.GetPaged("Id like '" + perfix + "' + '%'", "Id desc", 0, 1, out count); string number = count == 0 ? "001" : String.Format("{0:000}", int.Parse(objPo[0].Id.Substring(objPo[0].Id.Length - 3)) + 1); // Variable for error message if there is conflict roster string errorMessage = string.Empty; var repeatRoster = Guid.NewGuid(); // Set gia tri cho ngay dau tien // Se khong cho gia tri ngay dau tien vao vong lap e.NewValues["Id"] = perfix + number; e.NewValues["StartTime"] = dtStart; e.NewValues["EndTime"] = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, dtEnd.Hour, dtEnd.Minute, 0); ; e.NewValues["RepeatId"] = repeatRoster; e.NewValues["Username"] = username; e.NewValues["RosterTypeId"] = intRosterTypeId; e.NewValues["CreateUser"] = e.NewValues["UpdateUser"] = AccountSession.Session; e.NewValues["CreateDate"] = e.NewValues["UpdateDate"] = DateTime.Now; // Lay danh sach ngay duoc lap lai var weekday = (from ListItem item in chkWeekday.Items where item.Selected select item.Value).ToList(); while (dtStart <= dtEnd) { dtStart = dtStart.AddDays(1); if (weekday.Exists(x => x == dtStart.DayOfWeek.ToString())) { var dtTmpStart = dtStart; var dtTmpEnd = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, dtEnd.Hour, dtEnd.Minute, 0); // Check existed rosters string query = string.Format("Username = '******' AND IsDisabled = 'False' AND StartTime < '{1}' AND EndTime > '{2}'" , username, dtTmpEnd, dtTmpStart); DataRepository.RosterProvider.GetPaged(query, "Id desc", 0, ServiceFacade.SettingsHelper.GetPagedLength, out count); // If there is no roster -> insert new roster if (count > 0) { errorMessage += dtTmpStart.DayOfWeek.ToString() + " " + dtTmpStart.ToString("dd MMM yyyy") + ", "; continue; } number = String.Format("{0:000}", int.Parse(number) + 1); lstRoster.Add(new Roster { Id = perfix + number, Username = username, RosterTypeId = intRosterTypeId, StartTime = dtTmpStart, EndTime = dtTmpEnd, RepeatId = repeatRoster, Note = note, CreateUser = AccountSession.Session, UpdateUser = AccountSession.Session }); } } if (errorMessage.Length > 0) { WebCommon.AlertGridView(sender, String.Format("There are some rosters conflicted: {0}", errorMessage.Substring(0, errorMessage.Length - 1))); e.Cancel = true; return; } // Insert new rosters DataRepository.RosterProvider.Insert(lstRoster); } else { #region Validate Time if (dtStart >= dtEnd) { WebCommon.AlertGridView(sender, "To time must be greater than from date."); e.Cancel = true; return; } // If roster is created in a passed or current day DateTime dtNow = DateTime.Now; if (new DateTime(dtNow.Year, dtNow.Month, dtNow.Day) >= new DateTime(dtStart.Year, dtStart.Month, dtStart.Day)) { WebCommon.AlertGridView(sender, "You can not change roster to passed or current date."); e.Cancel = true; return; } #endregion var newObj = new Roster(); string perfix = ServiceFacade.SettingsHelper.RosterPrefix + DateTime.Now.ToString("yyMMdd"); int count; TList<Roster> objPo = DataRepository.RosterProvider.GetPaged("Id like '" + perfix + "' + '%'", "Id desc", 0, 1, out count); string id; if (count == 0) id = perfix + "001"; else { id = perfix + String.Format("{0:000}", int.Parse(objPo[0].Id.Substring(objPo[0].Id.Length - 3)) + 1); } // Check existed rosters string query = string.Format("Username = '******' AND IsDisabled = 'False' AND StartTime < '{1}' AND EndTime > '{2}'" , username, dtStart, dtEnd); DataRepository.RosterProvider.GetPaged(query, "Id desc", 0, ServiceFacade.SettingsHelper.GetPagedLength, out count); // If there is no roster -> insert new roster if (count > 0) { WebCommon.AlertGridView(sender, String.Format("There is roster conflicted: From {0} {1} to {2} {3}" , newObj.StartTime.DayOfWeek, newObj.StartTime.ToString("dd MMM yyyy HH:mm") , newObj.EndTime.DayOfWeek, newObj.EndTime.ToString("dd MMM yyyy HH:mm"))); e.Cancel = true; return; } // Set pure value e.NewValues["Id"] = id; e.NewValues["Username"] = username; e.NewValues["RosterTypeId"] = intRosterTypeId; e.NewValues["StartTime"] = dtStart; e.NewValues["EndTime"] = dtEnd; e.NewValues["CreateUser"] = e.NewValues["UpdateUser"] = AccountSession.Session; e.NewValues["CreateDate"] = e.NewValues["UpdateDate"] = DateTime.Now; } // Show message alert delete successfully WebCommon.AlertGridView(sender, "Roster is created successfully."); } catch (Exception ex) { LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient()); e.Cancel = true; WebCommon.AlertGridView(sender, "Cannot create new Roster. Please contact Administrator"); } }
public static void ResolveTriggers(TriggerTypes triggerType, Action callBack = null) { if (DebugManager.DebugTriggers) { Debug.Log("Triggers are resolved: " + triggerType); } if (triggerType == TriggerTypes.OnDamageIsDealt && callBack != null) { DamageNumbers.UpdateSavedHP(); } StackLevel currentLevel = GetCurrentLevel(); if (currentLevel == null || currentLevel.IsActive) { CreateNewLevelOfStack(callBack); currentLevel = GetCurrentLevel(); } if (!currentLevel.IsActive) { SetStackLevelCallBack(callBack); List <Trigger> currentTriggersList = currentLevel.GetTriggersByPlayer(Phases.PlayerWithInitiative); Players.PlayerNo currentPlayer = (currentTriggersList.Count > 0) ? Phases.PlayerWithInitiative : Roster.AnotherPlayer(Phases.PlayerWithInitiative); currentTriggersList = currentLevel.GetTriggersByPlayer(currentPlayer); if (currentTriggersList.Count != 0) { currentLevel.IsActive = true; if ((currentTriggersList.Count == 1) || (IsAllSkippable(currentTriggersList))) { FireTrigger(currentTriggersList[0]); } else { RunDecisionSubPhase(); } } else { if (triggerType == TriggerTypes.OnDamageIsDealt) { DamageNumbers.ShowChangedHP(); } DoCallBack(); } } }
public static void SetPlayerCustomization() { for (int i = 1; i < 3; i++) { GenericPlayer player = Roster.GetPlayer(i); int playerInfoSlot = (Network.IsNetworkGame && !Network.IsServer) ? Roster.AnotherPlayer(i) : i; player.PlayerInfoPanel = GameObject.Find("UI/PlayersPanel/Player" + playerInfoSlot + "Panel"); player.PlayerInfoPanel.transform.Find("PlayerAvatarImage").GetComponent <AvatarFromUpgrade>().Initialize(Roster.GetPlayer(i).Avatar); player.PlayerInfoPanel.transform.Find("PlayerNickName").GetComponent <Text>().text = Roster.GetPlayer(i).NickName; player.PlayerInfoPanel.transform.Find("PlayerTitle").GetComponent <Text>().text = Roster.GetPlayer(i).Title; } }
public void HighlightShipsToSelect() { ShowSubphaseDescription(DescriptionShort, DescriptionLong, ImageSource); Roster.HighlightShipsFiltered(FilterShipTargets); IsInitializationFinished = true; }
public void GenSiteRosterResport(string sReportFile, Roster rst, string[] rgsRosterFilter, DateTime dttmStart, DateTime dttmEnd) { m_gmd.GenSiteRosterReport(sReportFile, rst, rgsRosterFilter, dttmStart, dttmEnd); }
private static void DeselectShip(Ship.GenericShip ship) { ship.ToggleCollisionDetection(false); Roster.UnMarkShip(ship); ship.HighlightSelectedOff(); }
//=================Assigning Volunteer(Cleaners)================= public void Execute(IJobExecutionContext context) { ApplicationDbContext db = new ApplicationDbContext(); List <Roster> rst = new List <Roster>(); List <DateTime> dates = new List <DateTime>(); List <int> q = new List <int>(); int year = 2018; int month; var min = 0; int count = 1; //var count = 0; DayOfWeek day = DayOfWeek.Monday; TimeSpan timeS = new TimeSpan(0, 8, 0, 0, 0); TimeSpan timeE = new TimeSpan(0, 15, 0, 0, 0); for (month = 10; month <= 12; month++) { //Get sundays within the month System.Globalization.CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; for (int i = 1; i <= currentCulture.Calendar.GetDaysInMonth(year, month); i++) { DateTime d = new DateTime(year, month, i); if (d.DayOfWeek == day) { //store date on the queue //if (!(d < DateTime.Now)) dates.Add(d); } } } ; //looping through the list foreach (var emp in db.employees) { if (emp.typeCode == "P" && emp.deptCode == 1) { //store item on the queue q.Add(emp.queue); } } //min in the queue min = q.Min(); for (int i = 0; i < 4; i++) { //assigning employees to the roster foreach (var emp in db.employees) { //break the loop if (emp.queue == 4) { break; } Roster r = new Roster(); if (count != 6) { if (emp.status == "Available" && emp.deptCode == 1 && emp.typeCode == "P" && emp.queue == min) { r.Date = dates[min - 1]; r.startTime = timeS; r.endTime = timeE; r.EmpNum = emp.EmpNum; r.deptCode = 1; emp.queue += 1; rst.Add(r); db.rosters.Add(r); count++; } } //min++; } //foreach loop end count = 0; } //for loop end db.SaveChanges(); Debug.WriteLine("roster added at " + DateTime.Now.ToString()); }
public static void ResolveTriggers(TriggerTypes triggerType, Action callBack = null) { if (callBack != null) { Console.Write(triggerType.ToString(), LogTypes.Triggers, true, "yellow"); } else { Console.Write(triggerType + " is resolved again", LogTypes.Triggers, false, "yellow"); } if (triggerType == TriggerTypes.OnDamageIsDealt && callBack != null) { DamageNumbers.UpdateSavedHP(); } StackLevel currentLevel = GetCurrentLevel(); if (currentLevel == null || currentLevel.IsActive) { CreateNewLevelOfStack(triggerType, callBack); currentLevel = GetCurrentLevel(); } if (!currentLevel.IsActive) { SetStackLevelCallBack(callBack); List <Trigger> currentTriggersList = currentLevel.GetTriggersByPlayer(Phases.PlayerWithInitiative); Players.PlayerNo currentPlayer = (currentTriggersList.Count > 0) ? Phases.PlayerWithInitiative : Roster.AnotherPlayer(Phases.PlayerWithInitiative); currentTriggersList = currentLevel.GetTriggersByPlayer(currentPlayer); if (currentTriggersList.Count != 0) { currentLevel.IsActive = true; if ((currentTriggersList.Count == 1) || (IsAllSkippable(currentTriggersList))) { FireTrigger(currentTriggersList[0]); } else { RunDecisionSubPhase(); } } else { if (triggerType == TriggerTypes.OnDamageIsDealt) { DamageNumbers.ShowChangedHP(); } DoCallBack(); } } }
public void PrepareConfirmation() { Roster.GetPlayer(Selection.ActiveShip.Owner.PlayerNo).ConfirmDiceCheck(); }
private static void ReGenerateListOfButtons(DiceModificationTimingType timingType) { ShowDiceModificationButtons(timingType, true); Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).UseDiceModifications(timingType); }
public static void ShowDiceModificationButtons(DiceModificationTimingType type, bool isForced = false) { HideDiceModificationButtons(); UnityAction CloseButtonEffect = null; switch (type) { case DiceModificationTimingType.Opposite: Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Defender : Attacker; CloseButtonEffect = SwitchToAfterRolledDiceModifications; break; case DiceModificationTimingType.AfterRolled: Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Attacker : Defender; CloseButtonEffect = SwitchToRegularDiceModifications; break; case DiceModificationTimingType.Normal: Selection.ActiveShip = (AttackStep == CombatStep.Attack) ? Attacker : Defender; CloseButtonEffect = Combat.ConfirmDiceResults; break; case DiceModificationTimingType.CompareResults: Selection.ActiveShip = Attacker; CloseButtonEffect = CompareResultsAndDealDamage; break; default: break; } Phases.CurrentSubPhase.RequiredPlayer = Selection.ActiveShip.Owner.PlayerNo; AvailableDecisions = new Dictionary <string, GenericAction>(); Selection.ActiveShip.GenerateDiceModifications(type); if (Selection.ActiveShip.GetDiceModificationsGenerated().Count > 0 || isForced) { float offset = 0; Vector3 position = Vector3.zero; foreach (var actionEffect in Selection.ActiveShip.GetDiceModificationsGenerated()) { AvailableDecisions.Add(actionEffect.Name, actionEffect); position += new Vector3(0, -offset, 0); CreateDiceModificationsButton(actionEffect, position); offset = 65; } ShowCloseButton(CloseButtonEffect); ShowDiceResultsPanel(); } else { if (Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).PlayerType != Players.PlayerType.Ai) { if (type != DiceModificationTimingType.Normal) { CloseButtonEffect.Invoke(); } else { ShowCloseButton(CloseButtonEffect); ShowDiceResultsPanel(); } } } }
public void Update(Roster roster, int teamScore, int opponentScore, int bitsMatchId) { if (roster == null) throw new ArgumentNullException("roster"); VerifyScores(teamScore, opponentScore); roster.MatchResultId = Id; if (roster.Id != RosterId) ApplyChange(new Roster4Changed(RosterId, roster.Id)); var matchResultUpdated = new MatchResult4Updated(roster.Id, roster.Players, teamScore, opponentScore, bitsMatchId, RosterId, TeamScore, OpponentScore, BitsMatchId); ApplyChange(matchResultUpdated); }
public Character Get(string id) { Roster ID = (Roster)Enum.Parse(typeof(Roster), id.ToUpper()); return(roster[(int)ID]); }
public override void PrepareDecision(System.Action callBack) { InfoText = "Select a trigger to resolve"; List <Trigger> currentTriggersList = Triggers.GetCurrentLevel().GetTriggersByPlayer(Phases.PlayerWithInitiative); Players.PlayerNo currentPlayer = (currentTriggersList.Count > 0) ? Phases.PlayerWithInitiative : Roster.AnotherPlayer(Phases.PlayerWithInitiative); currentTriggersList = Triggers.GetCurrentLevel().GetTriggersByPlayer(currentPlayer); foreach (var trigger in currentTriggersList) { if (trigger.TriggerOwner == currentPlayer) { AddDecision(trigger.Name, delegate { Phases.FinishSubPhase(this.GetType()); FireTrigger(trigger); }); } } DecisionOwner = Roster.GetPlayer(currentPlayer); DefaultDecisionName = GetDecisions().First().Name; callBack(); }
public void RemovePilotSkillModifier(IModifyPilotSkill modifier) { PilotSkillModifiers.Remove(modifier); Roster.UpdateShipStats(this); }
[Test] public void Test_Create() { Roster r = new Roster(doc); Assert.AreEqual("<query xmlns=\"jabber:iq:roster\" />", r.ToString()); }
private void HidePlanningTemplates() { Selection.ThisShip.GetBombLaunchHelper().Find("Straight5").gameObject.SetActive(false); Roster.SetRaycastTargets(true); }
private async Task <IHttpActionResult> Handle(VerifyMatchMessage message) { Roster roster = DocumentSession.Load <Roster>(message.RosterId); if (roster.IsVerified && message.Force == false) { return(Ok()); } WebsiteConfig websiteConfig = DocumentSession.Load <WebsiteConfig>(WebsiteConfig.GlobalId); HeadInfo result = await bitsClient.GetHeadInfo(roster.BitsMatchId); ParseHeaderResult header = BitsParser.ParseHeader(result, websiteConfig.ClubId); // chance to update roster values var update = new Roster.Update( Roster.ChangeType.VerifyMatchMessage, "system") { OilPattern = header.OilPattern, Date = header.Date, Opponent = header.Opponent, Location = header.Location }; if (roster.MatchResultId != null) { // update match result values BitsMatchResult bitsMatchResult = await bitsClient.GetBitsMatchResult(roster.BitsMatchId); Player[] players = DocumentSession.Query <Player, PlayerSearch>() .ToArray() .Where(x => x.PlayerItem?.LicNbr != null) .ToArray(); var parser = new BitsParser(players); if (roster.IsFourPlayer) { MatchResult4 matchResult = EventStoreSession.Load <MatchResult4>(roster.MatchResultId); Parse4Result parseResult = parser.Parse4(bitsMatchResult, websiteConfig.ClubId); update.Players = GetPlayerIds(parseResult); bool isVerified = matchResult.Update( PublishMessage, roster, parseResult.TeamScore, parseResult.OpponentScore, roster.BitsMatchId, parseResult.CreateMatchSeries(), players); update.IsVerified = isVerified; } else { MatchResult matchResult = EventStoreSession.Load <MatchResult>(roster.MatchResultId); ParseResult parseResult = parser.Parse(bitsMatchResult, websiteConfig.ClubId); update.Players = GetPlayerIds(parseResult); var resultsForPlayer = DocumentSession.Query <ResultForPlayerIndex.Result, ResultForPlayerIndex>() .Where(x => x.Season == roster.Season) .ToArray() .ToDictionary(x => x.PlayerId); MatchSerie[] matchSeries = parseResult.CreateMatchSeries(); bool isVerified = matchResult.Update( PublishMessage, roster, parseResult.TeamScore, parseResult.OpponentScore, matchSeries, parseResult.OpponentSeries, players, resultsForPlayer); update.IsVerified = isVerified; } } roster.UpdateWith(Trace.CorrelationManager.ActivityId, update); return(Ok()); }
public virtual void Start() { Roster.HighlightPlayer(RequiredPlayer); }
private void GiveInitiative(object sender, EventArgs e) { Phases.PlayerWithInitiative = Roster.AnotherPlayer(Phases.PlayerWithInitiative); ConfirmDecision(); }
public virtual void Resume() { Roster.HighlightPlayer(RequiredPlayer); }
void ProcessSetRoster(XmppBase.Iq iq) { Roster roster = iq.Query as Roster; Roster respRoster = new Roster(); foreach (var item in roster.GetRoster()) { string owner = Session.SessionUser.Username; string username = JIDEscaping.Unescape(item.Jid.User); string group = null; if (item.HasGroups) group = item.GetGroups()[0]; if (item.Subscription == Subscription.remove) { FriendshipManager.Instance.RemoveFriend(owner, JIDEscaping.Unescape(item.Jid.User)); return; } if (FriendshipManager.Instance.IsFriend( Session.SessionUser.Username, username)) { FriendUpdateFlags flags = FriendUpdateFlags.UpdateRemark; if (group != null) flags |= FriendUpdateFlags.UpdateGroup; FriendshipManager.Instance.UpdateFriend(owner, username, null, group, item.Name, null, flags); respRoster.Add(item); } else { var sqlUser = Server.AuthManager.GetUser(username); if (sqlUser == null) return; FriendshipManager.Instance.AddFriend(Session.SessionUser.Username, group, username, item.Name, sqlUser.Nickname, Subscription.from); } } iq.Type = IqType.result; iq.Query = respRoster; iq.SwitchDirection(); Session.Send(iq); }
public virtual bool ThisShipCanBeSelected(GenericShip ship, int mouseKeyIsPressed) { bool result = false; if ((ship.Owner.PlayerNo == RequiredPlayer) && (ship.State.Initiative == RequiredPilotSkill) && (Roster.GetPlayer(RequiredPlayer).GetType() == typeof(Players.HumanPlayer))) { result = true; } else { Messages.ShowErrorToHuman("Ship cannot be selected:\n Need " + Phases.CurrentSubPhase.RequiredPlayer + " and pilot skill " + Phases.CurrentSubPhase.RequiredPilotSkill); } return(result); }
/// <summary> /// Add roster to list /// </summary> /// <param name="lst"></param> /// <param name="item"></param> private static void AddRoster(List<object> lst, Roster item) { DataRepository.RosterProvider.DeepLoad(item); lst.Add(new { id = item.Id, start_date = String.Format("{0:MM-dd-yyyy HH:mm:ss}", item.StartTime), end_date = String.Format("{0:MM-dd-yyyy HH:mm:ss}", item.EndTime), section_id = item.Username, text = item.RosterTypeIdSource.Title, DoctorUserName = item.Username, DoctorShortName = item.UsernameSource.DisplayName, item.RosterTypeId, RosterTypeTitle = item.RosterTypeIdSource.Title, note = item.Note, isnew = false, ReadOnly = (item.StartTime <= DateTime.Now), color = item.RosterTypeIdSource.ColorCode }); }
public static string UpdateRoster(string id, string doctorId, int? rosterTypeId, DateTime? startTime, DateTime? endTime, DateTime? startDate, DateTime? endDate, string note) { try { #region Validation and covert value // Validate user right for updating if (!CheckUpdating(out _message)) { return WebCommon.BuildFailedResult(_message); } // Set gia tri mac dinh rosterTypeId = ServiceFacade.SettingsHelper.DefaultRosterType; if (!WebCommon.ValidateEmpty("Roster Id", id, out _message) || !WebCommon.ValidateEmpty("Doctor", doctorId, out _message) || !WebCommon.ValidateEmpty("Roster Type", rosterTypeId, out _message) || !WebCommon.ValidateEmpty("Start Time", startTime, out _message) || !WebCommon.ValidateEmpty("End Time", endTime, out _message) || !WebCommon.ValidateEmpty("Start Date", startDate, out _message) || !WebCommon.ValidateEmpty("End Date", endDate, out _message)) { return WebCommon.BuildFailedResult(_message); } // Get start date and end date, validate all of them var dtStart = new DateTime(startDate.Value.Year, startDate.Value.Month, startDate.Value.Day , startTime.Value.Hour, startTime.Value.Minute, 0); var dtEnd = new DateTime(endDate.Value.Year, endDate.Value.Month, endDate.Value.Day , endTime.Value.Hour, endTime.Value.Minute, 0); #endregion // Declare list of object are returned var lstResult = new List<object>(); var roster = new Roster { Id = id, Username = doctorId, RosterTypeId = Convert.ToInt32(rosterTypeId), StartTime = dtStart, EndTime = dtEnd, Note = note, UpdateUser = AccountSession.Session }; if (!BoFactory.RosterBO.Update(ref roster, ref _message)) return WebCommon.BuildFailedResult(_message); AddRoster(lstResult, roster); return WebCommon.BuildSuccessfulResult(lstResult); } catch (Exception ex) { LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient()); return WebCommon.BuildFailedResult("System error. Please contact Administrator."); } }
public void PrepareToggleConfirmButton(bool isActive) { Roster.GetPlayer(Selection.ActiveShip.Owner.PlayerNo).ToggleCombatDiceResults(isActive); }
private static void ShowPanel() { Phases.CurrentSubPhase.IsReadyForCommands = true; Roster.GetPlayer(Phases.CurrentSubPhase.RequiredPlayer).InformAboutCrit(); }
private void StopDrag() { Roster.SetRaycastTargets(true); inReposition = false; }
public void PrepareConfirmation() { Phases.CurrentSubPhase.IsReadyForCommands = true; Roster.GetPlayer(Selection.ActiveShip.Owner.PlayerNo).ConfirmDiceCheck(); }
private void ArgeeAndRoster(RosterAddResponse response) { if (response != null) { System.Windows.MessageBox.Show(response.user.name + "同意您添加为好友!"); Roster roster = new Roster(); roster.Uid = response.user.uid; roster.Jid = response.user.jid; roster.Name = response.user.name; roster.Nickname = response.user.nickname; roster.Status = (UserStatus)System.Enum.Parse(typeof(UserStatus), response.user.status.ToString()); roster.Signature = response.user.signature; this.dataService.AddRoster(roster); INWindow inWindow = this.dataService.INWindow as INWindow; inWindow.FriendsList.AddRoster(roster); } }
public virtual void Discard() { isDiscarded = true; Roster.DiscardUpgrade(Host, Name); }
public static string NewRoster(string doctorId, int? rosterTypeId, DateTime? startDate, DateTime? endDate, string note, bool? repeatRoster, string weekday) { try { #region Validation and covert value // Validate user right for creating if (!CheckCreating(out _message)) { return WebCommon.BuildFailedResult(_message); } // Set gia tri mac dinh rosterTypeId = ServiceFacade.SettingsHelper.DefaultRosterType; if (!WebCommon.ValidateEmpty("Doctor", doctorId, out _message) || !WebCommon.ValidateEmpty("Roster Type", rosterTypeId, out _message) || !WebCommon.ValidateEmpty("Start Date", startDate, out _message) || !WebCommon.ValidateEmpty("End Date", endDate, out _message)) { return WebCommon.BuildFailedResult(_message); } #endregion var roster = new Roster { Username = doctorId, RosterTypeId = Convert.ToInt32(rosterTypeId), StartTime = startDate.Value, EndTime = endDate.Value, Note = note, CreateUser = AccountSession.Session, UpdateUser = AccountSession.Session }; // Declare list of object are returned var lstResult = new List<object>(); // Declare list of roster in case repeat roster var lstRoster = new TList<Roster>(); // Repeat roster if (repeatRoster != null && repeatRoster == true) { if (!BoFactory.RosterBO.InsertRepeat(roster, weekday, lstRoster, ref _message)) return WebCommon.BuildFailedResult(_message); } else { if (!BoFactory.RosterBO.Insert(roster, ref _message)) return WebCommon.BuildFailedResult(_message); lstRoster.Add(roster); } // Load relation data DataRepository.RosterProvider.DeepLoad(lstRoster); // Add all roster to result list AddRoster(lstResult, lstRoster); return WebCommon.BuildSuccessfulResult(lstResult); } catch (Exception ex) { LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient()); return WebCommon.BuildFailedResult("System error. Please contact Administrator."); } }
public void HighlightShipsToSelect() { ShowSubphaseDescription(AbilityName, Description, ImageUrl); Roster.HighlightShipsFiltered(FilterTargets); IsInitializationFinished = true; }
/* F L O A D G A M E S */ /*---------------------------------------------------------------------------- %%Function: FLoadGames %%Qualified: ArbWeb.CountsData:GameData:Games.FLoadGames %%Contact: rlittle Loading the games needs a state machine -- this is a multi line report ----------------------------------------------------------------------------*/ public bool FLoadGames(string sGamesReport, Roster rst, bool fIncludeCanceled) { TextReader tr = new StreamReader(sGamesReport); string sLine; string[] rgsFields; ReadState rs = ReadState.ScanForHeader; bool fCanceled = false; bool fOpenSlot = false; bool fIgnore = false; string sGame = ""; string sDateTime = ""; string sSport = ""; string sLevel = ""; string sSite = ""; string sHome = ""; string sAway = ""; string sPosLast = ""; string sNameLast = ""; string sStatusLast = ""; Dictionary<string, string> mpNameStatus = new Dictionary<string, string>(); Dictionary<string, string> mpNamePos = new Dictionary<string, string>(); // m_mpNameSportLevelCount = new Dictionary<string, Dictionary<string, int>>(); Umpire ump = null; while ((sLine = tr.ReadLine()) != null) { // first, change "foo, bar" into "foo bar" (get rid of quotes and the comma) sLine = Regex.Replace(sLine, "\"([^\",]*),([^\",]*)\"", "$1$2"); icolGameDateTime = 2; if (sLine.Length < icolGameDateTime) continue; Regex rex = new Regex(","); rgsFields = rex.Split(sLine); // check for rainouts and cancellations if (FMatchGameCancelled(sLine)) { fCanceled = true; // drop us back to reading officials rs = ReadState.ReadingOfficials1; continue; } // look for comments if (FMatchGameComment(sLine)) { rs = RsHandleGameComment(rs, sLine); continue; } if (FMatchGameEmpty(sLine)) continue; if (FMatchGameTotalLine(rgsFields)) { // this is the final "total" line. the only thing that should follow this is // the final page break // just leave the rs alone for now... continue; } icolGameLevel = 5; if (rs == ReadState.ScanForHeader) { rs = RsHandleScanForHeader(sLine, rgsFields, rs); continue; } if (rs == ReadState.ReadingComments) { // when reading comments, we can get text in column 1; if the line ends with commas, then this is just // a continuation of the comment (also be careful to look for another comment starting right after ours // ends if (FMatchGameCommentContinuation(sLine)) { continue; } rs = ReadState.ReadingOfficials1; // drop back to reading officials } if (rs == ReadState.ReadingGame2) rs = RsHandleReadingGame2(rgsFields, ref sGame, ref sDateTime, ref sLevel, ref sSite, ref sHome, ref sAway, rs); if (rs == ReadState.ReadingOfficials2) rs = RsHandleReadingOfficials2(rgsFields, mpNamePos, mpNameStatus, sNameLast, sPosLast, sStatusLast, rs); if (rs == ReadState.ReadingOfficials1) rs = RsHandleReadingOfficials1(rst, fIncludeCanceled, sLine, rgsFields, mpNamePos, mpNameStatus, fCanceled, sSite, sGame, sHome, sAway, sLevel, sSport, rs, ref sPosLast, ref sNameLast, ref sStatusLast, ref sDateTime, ref fOpenSlot, ref ump); if (FMatchGameArbiterFooter(sLine)) { Debug.Assert(rs == ReadState.ReadingComments || rs == ReadState.ScanForHeader || rs == ReadState.ScanForGame, String.Format("Page break at illegal position: state = {0}", rs)); rs = ReadState.ScanForHeader; continue; } if (rs == ReadState.ScanForGame) rs = RsHandleScanForGame(ref sGame, mpNamePos, mpNameStatus, sLine, ref sDateTime, ref sSport, ref sLevel, ref sSite, ref sHome, ref sAway, ref fCanceled, ref fIgnore, rs); if (rs == ReadState.ReadingGame1) rs = RsHandleReadingGame1(ref sGame, rgsFields, ref sDateTime, ref sSport, ref sSite, ref sHome, ref sAway, rs); } return true; }
private void Load(RosterInfo rosterInfo) { var roster = new Roster(rosterInfo); RostersByName.Add(rosterInfo.Name, roster); }
/* R S H A N D L E R E A D I N G O F F I C I A L S 1 */ /*---------------------------------------------------------------------------- %%Function: RsHandleReadingOfficials1 %%Qualified: ArbWeb.CountsData:GameData:Games.RsHandleReadingOfficials1 %%Contact: rlittle ----------------------------------------------------------------------------*/ private ReadState RsHandleReadingOfficials1(Roster rst, bool fIncludeCanceled, string sLine, string[] rgsFields, Dictionary<string, string> mpNamePos, Dictionary<string, string> mpNameStatus, bool fCanceled, string sSite, string sGame, string sHome, string sAway, string sLevel, string sSport, ReadState rs, ref string sPosLast, ref string sStatusLast, ref string sNameLast, ref string sDateTime, ref bool fOpenSlot, ref Umpire ump) { // Games may have multiple officials, so we have to collect up the officials. // we do this in mpNamePos // &&&& TODO: omit dates before here... if (Regex.Match(sLine, "Attached").Success) return rs; if (rgsFields[0].Length < 1) { // look for possible contiuation line; if not there, then we will fall back // to ReadingOfficials1 rs = ReadState.ReadingOfficials2; sPosLast = rgsFields[1]; sNameLast = rgsFields[icolOfficial]; sStatusLast = rgsFields[icolSlotStatus]; if (Regex.Match(rgsFields[icolOfficial], "_____").Success) { fOpenSlot = true; mpNamePos.Add(String.Format("!!OPEN{0}", mpNamePos.Count), rgsFields[1]); mpNameStatus.Add(String.Format("!!OPEN{0}", mpNameStatus.Count), rgsFields[icolSlotStatus]); return rs; } else { string sName = ReverseName(rgsFields[icolOfficial]); mpNamePos.Add(sName, rgsFields[1]); mpNameStatus.Add(sName, rgsFields[icolSlotStatus]); return rs; } } // otherwise we're done!! // m_srpt.AddMessage("recording results..."); if (!fCanceled || fIncludeCanceled) { // record our game // we've got all the info for one particular game and its officials. // walk through the officials that we have foreach (string sName in mpNamePos.Keys) { string sPos = mpNamePos[sName]; string sStatus = mpNameStatus[sName]; string sEmail; string sTeam; string sNameUse = sName; List<string> plsMisc = null; if (Regex.Match(sName, "!!OPEN.*").Success) { sNameUse = null; sEmail = ""; sTeam = ""; sStatus = ""; } else { ump = rst.UmpireLookup(sName); if (ump == null) { if (sName != "") m_srpt.AddMessage(String.Format("Cannot find info for Umpire: {0}", sName), StatusRpt.MSGT.Error); sEmail = ""; sTeam = ""; } else { sEmail = ump.Contact; sTeam = ump.Misc; plsMisc = ump.PlsMisc; } } if (sPos != "Training") { if (sDateTime.EndsWith("TBA")) sDateTime = sDateTime.Substring(0, sDateTime.Length - icolOfficial) + "00:00"; AddGame(DateTime.Parse(sDateTime), sSite, sNameUse, sTeam, sEmail, sGame, sHome, sAway, sLevel, sSport, sPos, sStatus, fCanceled, plsMisc); } } } rs = ReadState.ScanForGame; return rs; }
public IActionResult UpdateRoster([FromBody] Roster model) { Roster_repo.Update(model); return(new OkObjectResult(new { RosterID = model.RosterId })); }
// protected IList _rosters = new ArrayList(); public void AddRoster(Roster roster) { roster.Branch = this; _rosters.Add(roster); }
private async Task <IHttpActionResult> Handle(GetRostersFromBitsMessage message) { WebsiteConfig websiteConfig = DocumentSession.Load <WebsiteConfig>(WebsiteConfig.GlobalId); Log.Info($"Importing BITS season {websiteConfig.SeasonId} for {TenantConfiguration.FullTeamName} (ClubId={websiteConfig.ClubId})"); RosterSearchTerms.Result[] rosterSearchTerms = DocumentSession.Query <RosterSearchTerms.Result, RosterSearchTerms>() .Where(x => x.Season == websiteConfig.SeasonId) .Where(x => x.BitsMatchId != 0) .ProjectFromIndexFieldsInto <RosterSearchTerms.Result>() .ToArray(); Roster[] rosters = DocumentSession.Load <Roster>(rosterSearchTerms.Select(x => x.Id)); var foundMatchIds = new HashSet <int>(); // Team Log.Info($"Fetching teams"); TeamResult[] teams = await bitsClient.GetTeam(websiteConfig.ClubId, websiteConfig.SeasonId); foreach (TeamResult teamResult in teams) { // Division Log.Info($"Fetching divisions"); DivisionResult[] divisionResults = await bitsClient.GetDivisions(teamResult.TeamId, websiteConfig.SeasonId); // Match if (divisionResults.Length != 1) { throw new Exception($"Unexpected number of divisions: {divisionResults.Length}"); } DivisionResult divisionResult = divisionResults[0]; Log.Info($"Fetching match rounds"); MatchRound[] matchRounds = await bitsClient.GetMatchRounds(teamResult.TeamId, divisionResult.DivisionId, websiteConfig.SeasonId); var dict = matchRounds.ToDictionary(x => x.MatchId); foreach (int key in dict.Keys) { foundMatchIds.Add(key); } // update existing rosters foreach (Roster roster in rosters.Where(x => dict.ContainsKey(x.BitsMatchId))) { Log.Info($"Updating roster {roster.Id}"); MatchRound matchRound = dict[roster.BitsMatchId]; roster.OilPattern = OilPatternInformation.Create( matchRound.MatchOilPatternName, matchRound.MatchOilPatternId); roster.Date = matchRound.MatchDate.ToDateTime(matchRound.MatchTime); roster.Turn = matchRound.MatchRoundId; roster.MatchTimeChanged = matchRound.MatchStatus == 2; if (matchRound.HomeTeamClubId == websiteConfig.ClubId) { roster.Team = matchRound.MatchHomeTeamAlias; roster.TeamLevel = roster.Team.Substring(roster.Team.LastIndexOf(' ') + 1); roster.Opponent = matchRound.MatchAwayTeamAlias; } else if (matchRound.AwayTeamClubId == websiteConfig.ClubId) { roster.Team = matchRound.MatchAwayTeamAlias; roster.TeamLevel = roster.Team.Substring(roster.Team.LastIndexOf(' ') + 1); roster.Opponent = matchRound.MatchHomeTeamAlias; } else { throw new Exception($"Unknown clubs: {matchRound.HomeTeamClubId} {matchRound.AwayTeamClubId}"); } roster.Location = matchRound.MatchHallName; } // add missing rosters var existingMatchIds = new HashSet <int>(rosters.Select(x => x.BitsMatchId)); foreach (int matchId in dict.Keys.Where(x => existingMatchIds.Contains(x) == false)) { Log.Info($"Adding match {matchId}"); MatchRound matchRound = dict[matchId]; string team; string opponent; if (matchRound.HomeTeamClubId == websiteConfig.ClubId) { team = matchRound.MatchHomeTeamAlias; opponent = matchRound.MatchAwayTeamAlias; } else if (matchRound.AwayTeamClubId == websiteConfig.ClubId) { team = matchRound.MatchAwayTeamAlias; opponent = matchRound.MatchHomeTeamAlias; } else { throw new Exception($"Unknown clubs: {matchRound.HomeTeamClubId} {matchRound.AwayTeamClubId}"); } var roster = new Roster( matchRound.MatchSeason, matchRound.MatchRoundId, matchRound.MatchId, team, team.Substring(team.LastIndexOf(' ') + 1), matchRound.MatchHallName, opponent, matchRound.MatchDate.ToDateTime(matchRound.MatchTime), matchRound.MatchNbrOfPlayers == 4, OilPatternInformation.Create(matchRound.MatchOilPatternName, matchRound.MatchOilPatternId)) { MatchTimeChanged = matchRound.MatchStatus == 2 }; DocumentSession.Store(roster); } } // remove extraneous rosters Roster[] toRemove = rosters.Where(x => foundMatchIds.Contains(x.BitsMatchId) == false).ToArray(); if (toRemove.Any()) { string body = $"Rosters to remove: {string.Join(",", toRemove.Select(x => $"Id={x.Id} BitsMatchId={x.BitsMatchId}"))}"; Log.Info(body); foreach (Roster roster in toRemove) { DocumentSession.Delete(roster); } await Emails.SendAdminMail($"Removed rosters for {TenantConfiguration.FullTeamName}", body); } return(Ok()); }
public override void Initialize() { UpdateHelpInfo(); HighlightShips(); Roster.GetPlayer(RequiredPlayer).AssignManeuver(); }
internal void UpdateRoster(Roster rstr) { this.rstr = rstr; UpdateDisplay( ); }