private static LineUp GetBestLineups(int playerCount) { IList <GameSnapshot> snapshots = CsvImporter.GetGameSnapShots(CSV_3_SNAPSHOTS); var lineup = LineUp.GetBestLineup(playerCount, snapshots); return(lineup); }
private void LineUpSelector_Click(object sender, EventArgs e) { LinearLayout layout = sender as LinearLayout; try { ImageView iv_name = FindViewById <ImageView>(Resource.Id.MusicDicLineUpIndicator_Name); ImageView iv_update = FindViewById <ImageView>(Resource.Id.MusicDicLineUpIndicator_Update); switch (layout.Id) { case Resource.Id.MusicDicLineUpSelector_Name: LineUpStyle = LineUp.Name; iv_name.Visibility = ViewStates.Visible; iv_update.Visibility = ViewStates.Invisible; break; case Resource.Id.MusicDicLineUpSelector_Update: LineUpStyle = LineUp.Update; iv_name.Visibility = ViewStates.Invisible; iv_update.Visibility = ViewStates.Visible; break; } } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } ListMusic(SearchText.Text); }
//public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) //{ //} public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { ObservableCollection <Optreden> optredens = (ObservableCollection <Optreden>)values[0]; LineUp up = (LineUp)values[1]; return(optredens.Where(optreden => optreden.LineUp == up)); }
//lineup aanpassen private void EditLineUP() { if (SelectedBand == null || SelectedStage == null) { MessageBox.Show("Door een bug in het systeem moet je momenteel nog de juiste band en stage selecteren"); } else { LineUp lp = new LineUp(); lp.Date = SelectedLineUP.Date; lp.From = SelectedLineUP.From; lp.Until = SelectedLineUP.Until; lp.Stage = SelectedLineUP.Stage; lp.Stage.ID = SelectedLineUP.Stage.ID; lp.Band = SelectedLineUP.Band; lp.Band.ID = SelectedLineUP.Band.ID; LineUp.ModifyLineUp(lp); MessageBox.Show("De LineUP is aangepast"); _LineUP = LineUp.GetLineUp(); OnPropertyChanged("LineUP"); } }
private void AddToLineUp(CheckedListBox listbox, Player[] lineUp) { if (listbox.CheckedItems.Count == 11) { bool value = false; for (int i = 0; i < listbox.CheckedItems.Count; i++) { Player player = League.GetPlayerFromTeam(listbox.SelectedItem.ToString()); if (player != null) { lineUp[i] = player; } } LineUp lineup = new LineUp(lineUp, result => { value = result; }); if (value) { listbox.Enabled = false; } else { Dialog.Show("Something went wrong", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private LineUpViewModel GetBestLineup(int playerCount) { LineUp lineup = LineUp.GetBestLineup(playerCount, this._snapshots, LINEUPS_MIN_TIME); List <PlayerViewModel> players = this.PlayersData.Where(pvm => lineup.Contains(pvm.Number)).ToList(); var vm = new LineUpViewModel(players, this._snapshots); return(vm); }
public ActionResult DeleteConfirmed(int id) { LineUp lineUp = db.Lineups.Find(id); db.Lineups.Remove(lineUp); db.SaveChanges(); return(RedirectToAction("Index")); }
//Constructor public LRoosterVM() { Stages = Stage.GetStages(); Festivals = Festival.GetFestivals(); Dagen = BerekenData(); Bands = Band.GetBands(); NewLineUp = new LineUp(); }
public PartialViewResult StageOptredensPerLineupPartial(LineUp lineup) { var optredens = Festival.SingleFestival.Optredens.Where(optreden => optreden.From.Date == lineup.Dag); if (optredens == null || optredens.Count() < 1) { return(null); } return(PartialView("_StageOptredensPerLineupPartial", optredens)); }
public void DeffensiveLineup() { var snapshots = LineupTests.GetSnapshots(); IList <LineUp> lineups = LineUp.GetDeffensiveLineup(snapshots, playerCount: 5, minTime: TimeSpan.FromMinutes(1)); var lineup = lineups.FirstOrDefault(); var expected = new int[] { 1, 2, 3, 4, 5 }; CollectionAssert.AreEquivalent(expected, lineup); }
public void OffensiveLineup() { var snapshots = LineupTests.GetSnapshots(); IList <LineUp> lineups = LineUp.GetOffensiveLineup(snapshots, playerCount: 5); var lineup = lineups.FirstOrDefault(); var expected = new int[] { 1, 2, 3, 4, 7 }; CollectionAssert.AreEquivalent(expected, lineup); }
public ActionResult Edit([Bind(Include = "ID,Position,PlayerID")] LineUp lineUp) { if (ModelState.IsValid) { db.Entry(lineUp).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "FirstName", lineUp.PlayerID); return(View(lineUp)); }
public void NewLineUp() { try { LineUp NewLineUp = new LineUp(); SelectedLineUp = NewLineUp; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public LineUpVM() { _lineUpList = LineUp.GetLineUp(); _festivaldateList = Festival.GetDatums(); _genreList = Genre.GetGenres(); _stageList = Stage.GetStages(); _bandList = Band.GetBands(); NewStage = new Stage(); NewDate = new Festival(); NewBand = new Band(); SelectedLineUp = new LineUp(); }
// GET: LineUps/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LineUp lineUp = db.Lineups.Find(id); if (lineUp == null) { return(HttpNotFound()); } return(View(lineUp)); }
private static LineUp Fill(DbDataReader reader) { LineUp lineup = new LineUp(); lineup.Start = reader["Start"].ToString(); lineup.Finish = reader["Finish"].ToString(); lineup.BandID = (int)reader["BandID"]; lineup.Band = BandRepository.FindById(lineup.BandID); lineup.StageID = (int)reader["StageID"]; lineup.Stage = StageRepository.FindById(lineup.StageID); lineup.FestivaldagID = (int)reader["FestivaldagID"]; lineup.Festivaldag = FestivaldagRepository.FindById(lineup.FestivaldagID); return(lineup); }
// Use this for initialization void Start() { Point = new List <GameObject>(); nowPoint = 0; LineUp = GameObject.Find("LineUp").GetComponent <LineUp>(); Point = LineUp.GetPointList(); GetComponent <NavMeshAgent>().SetDestination(Point[nowPoint].transform.position); startPos = transform.position; }
// GET: LineUps/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LineUp lineUp = db.Lineups.Find(id); if (lineUp == null) { return(HttpNotFound()); } ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "FirstName", lineUp.PlayerID); return(View(lineUp)); }
public void Filter() { if (SelectedFestivaldate == null && SelectedStage != null) { LineUpList = LineUp.GetLineUpByStageID(SelectedStage.ID); } else if (SelectedFestivaldate != null && SelectedStage == null) { LineUpList = LineUp.GetLineUpByDateID(SelectedFestivaldate.ID); } else if (SelectedFestivaldate != null && SelectedStage != null) { LineUpList = LineUp.GetLineUpByStageAndDateID(SelectedStage.ID, SelectedFestivaldate.ID); } }
// 라인업 얻어오기 private List <LineUp> GetLineUp(Int64 matchId, String content, AttackType attackType) { List <LineUp> lineUps = new List <LineUp>(); Int32 number = 0; List <HitterInfo> HitterInfos = new List <HitterInfo>(); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(content); var nodes = doc.DocumentNode.SelectSingleNode("//tbody").SelectNodes("tr"); foreach (var node in nodes) { HtmlDocument hitterDoc = new HtmlDocument(); hitterDoc.LoadHtml(node.OuterHtml); // Player ID 얻어오기 String href = hitterDoc.DocumentNode.SelectSingleNode("//a").GetAttributeValue("href", ""); String[] items = href.Split(separator, StringSplitOptions.RemoveEmptyEntries); LineUp lineUp = new LineUp(); lineUp.PlayerId = Convert.ToInt32(items[1]); if (lineUps.Exists(x => x.PlayerId == lineUp.Id)) { // 이미 추가된아이면 무시 continue; } String position = hitterDoc.DocumentNode.SelectSingleNode("//td [@class='frst']").InnerHtml; if (position != "교") { number++; lineUp.EntryType = EntryType.Starting; } else { lineUp.EntryType = EntryType.Change; } lineUp.BatNumber = number; lineUp.AttackType = attackType; lineUp.MatchId = matchId; lineUps.Add(lineUp); } return(lineUps); }
private IList <LineUpViewModel> GetLineup(int playerCount) { IList <LineUp> lineups = LineUp.GetLineups(playerCount, this._snapshots, filter: new Predicate <LineUp>(lu => lu.Elapsed >= LINEUPS_MIN_TIME)); List <int[]> numbers = lineups.Select(lu => lu.ToArray()).Distinct().ToList(); List <PlayerViewModel[]> players = numbers.Select(list => list.Select( n => this.PlayersData.FirstOrDefault(p => p.Number == n)).ToArray() ) .ToList(); var vms = players.Select(ps => new LineUpViewModel(ps, this._snapshots)).ToList(); vms.Sort(); return(vms); }
public ActionResult Create([Bind(Include = "ID,Position,PlayerID,CoachID")] LineUp lineUp) { //if (ModelState.IsValid) //{ string sameUser = User.Identity.GetUserId(); var result = from row in db.Coaches where row.UserId == sameUser select row; var resultToUser = result.FirstOrDefault(); lineUp.CoachID = resultToUser.CoachID; db.Lineups.Add(lineUp); db.SaveChanges(); return(RedirectToAction("Index")); //} //ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "FirstName", lineUp.PlayerID); //return View(lineUp); }
/// <summary> /// /// </summary> /// <param name="lineUpID"></param> /// <returns></returns> public static LineUp GetLineUp(int lineUpID) { LineUp toReturn = null; string url = string.Format("http://services.radio-canada.ca/neuro/v1/future/lineups/{0}", lineUpID); using (WebClient client = new WebClient()) { // Set le type d'encodage client.Encoding = System.Text.Encoding.UTF8; // Telecharge le json string json = client.DownloadString(new Uri(url)); // Converti le json en format type toReturn = JsonConvert.DeserializeObject <LineUp>(json); } return(toReturn); }
public void SaveLineUp() { try { string sql = "INSERT INTO LineUp(Start,Finish,BandID,StageID,FestivaldagID) VALUES(@Start,@Finish,@BandID,@StageID,@FestivaldagID)"; DbParameter parStart = Database.AddParameter("@Start", SelectedLineUp.From); DbParameter parFinish = Database.AddParameter("@Finish", SelectedLineUp.Until); DbParameter parBandID = Database.AddParameter("@BandID", SelectedLineUp.Band.ID); DbParameter parStageID = Database.AddParameter("@StageID", SelectedLineUp.Stage.ID); DbParameter parDateID = Database.AddParameter("@FestivaldagID", SelectedLineUp.Date.ID); Database.ModifyData(sql, parStart, parFinish, parBandID, parStageID, parDateID); LineUpList.Add(SelectedLineUp); LineUpList = LineUp.GetLineUp(); NewLineUp(); MessageBox.Show("Artiest werd succesvol toegevoegd aan de line up"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void GenerateLineUp(LineUp lineUp) { float ratio = 40 / 60f; foreach (var artist in lineUp.Artists) { float size = ratio * artist.Duration; float positionY = 185 - (ratio * artist.StartTime.GetTotalMinutes()); Button btn = Instantiate(btnPrefab); btn.name = artist.Name; btn.gameObject.GetComponent <TimetableItem>().timeTable = timetable; SetPositionX(artist, btn); btn.GetComponent <RectTransform>().anchorMin = new Vector2(0, 0.5f); btn.GetComponent <RectTransform>().anchorMax = new Vector2(1, 0.5f); btn.GetComponent <RectTransform>().pivot = new Vector2(0.5f, 1); btn.GetComponent <RectTransform>().localScale = new Vector3(1, size / 40, 1); btn.GetComponent <RectTransform>().localPosition = new Vector3(0, positionY, 0); btn.GetComponentInChildren <TextMeshProUGUI>().text = artist.StartTime.TimeAsString() + " - " + artist.Name; btn.GetComponent <Image>().color = Color.black; btn.GetComponentInChildren <TextMeshProUGUI>().color = new Color(231 / 255f, 154 / 255f, 65 / 255f, 1); } }
public LineUpViewModel ToLineUpViewModel(LineUp lineup) { return(new LineUpViewModel { Id = lineup.Id, Vessel = lineup.Vessel, Agency = lineup.Agency, Cargo = lineup.Cargo, Cargo_Charterer = lineup.Cargo_Charterer, Eta = lineup.Eta, Etb = lineup.Etb, Etc = lineup.Etb, Etd = lineup.Etd, Laycan = lineup.Laycan, Pol_Pod = lineup.Pol_Pod, Quantity = lineup.Quantity, Shipper_Consignee = lineup.Shipper_Consignee, Status = lineup.Status, Terminal = lineup.Terminal, Terminal_id = lineup.Terminal.Id, }); }
async Task ExecuteButtonClick(string value) { var btnValueArr = value.Split('-'); if (btnValueArr.Length > 1) { string lineType = btnValueArr[0]; int lineCount = int.Parse(btnValueArr[1]); var user = new User(); var userLocation = user.CurrentLocation().Result; var lineObj = new LineUp() { ApplicationId = user.ApplicationId, LineCount = lineCount, LineType = lineType, StoreId = SingleStore.Id, Time = DateTime.UtcNow, LocationLatitude = userLocation.Latitude, LocationLongtitude = userLocation.Longitude, }; await _lineUpService.AddUpdateEntity(lineObj);; } }
//ophalen gegevens. public StageVM() { _Bands = Band.GetBands(); _Stages = Stage.GetStages(); _LineUP = LineUp.GetLineUp(); }
//Method om een nieuwe line up toe te voegen private void AddLineUp() { //controle of dag en stage wel geselecteerd zijn if (SelectedStage != null && SelectedDay != null) { NewLineUp.Date = Convert.ToDateTime(SelectedDay); NewLineUp.Stage = SelectedStage; //Controle uren en data (niet op zelfde moment) NewLineUp.From = HourFrom.ToShortTimeString(); NewLineUp.Until = HourUntil.ToShortTimeString(); int affected = LineUp.AddLineUp(NewLineUp); if (affected == 1) { //LineUps.Add(NewLineUp); LineUps = LineUp.GetLineUpByStageAndDay(SelectedStage, SelectedDay); int lastIndex = LineUps.Count - 1; SelectedLineUp = LineUps[lastIndex]; NewLineUp = new LineUp(); Console.WriteLine("Line up werd succesvol toegevoegd in de database."); ModernDialog.ShowMessage("Het optreden werd toegevoegd.", "Toevoegen", MessageBoxButton.OK); } } else { ModernDialog.ShowMessage("Gelieve een dag en stage te selecteren", "Optreden", MessageBoxButton.OK); } }
public LineUpDataGroup(LineUp lineup) : base(lineup.Dag.BeDayOfWeek().ToString(), lineup.Dag.BeDayOfWeek().ToString(), lineup.Dag.BeDayOfWeek().ToString(), null) { }
/// <summary> /// POST: api/Messages /// Recois un msg de l'usgaer et on y retourne une reponse /// </summary> public async Task <HttpResponseMessage> Post([FromBody] Activity activity) { if (activity.Type == ActivityTypes.Message && activity.Text.ToLower() == "/random") { ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); LineUp lineUp = RcHelpers.GetLineUp(RcContants_LineUp.REGION_GRAND_MTL); // Va chercher un index aleatoire var randomIndex = new Random(DateTime.Now.Millisecond).Next(0, lineUp.pagedList.items.Count - 1); // On extrait du tableau, l'article que nous voulons montrer a l'usager var article = lineUp.pagedList.items[randomIndex]; // Extraction du url de l'image var imageUrl = article.summaryMultimediaItem.concreteImages?.Find(x => x.dimensionRatio == "4:3")?.mediaLink.href; // Converti l'image en grandeur utilisable var imageBase64 = string.Empty; if (!string.IsNullOrEmpty(imageUrl)) { var base64 = imageUrl.TransformUrlToScaledImage(); imageBase64 = imageUrl.EndsWith("png") ? "data:image/png;base64," + base64 : "data:image/jpg;base64," + base64; } Activity reply = activity.CreateReply(""); reply.Recipient = activity.From; reply.Type = "message"; reply.Attachments = new List <Attachment>(); // Construit l'image en reponse List <CardImage> cardImages = new List <CardImage>(); cardImages.Add(new CardImage(url: imageBase64)); // Construit l'action qui va aller avec l'image List <CardAction> cardButtons = new List <CardAction>(); CardAction plButton = new CardAction() { Value = article.canonicalWebLink.href, Type = "openUrl", Title = "Voir plus" }; cardButtons.Add(plButton); // Construit la carte HeroCard plCard = new HeroCard() { Title = HttpUtility.HtmlDecode(article.title), Subtitle = "", Images = cardImages, Buttons = cardButtons }; Attachment plAttachment = plCard.ToAttachment(); reply.Attachments.Add(plAttachment); await connector.Conversations.ReplyToActivityAsync(reply); } else if (activity.Type == ActivityTypes.Message) { ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); Activity reply = activity.CreateReply("Je ne connais qu'une commande. Utilisez /random"); await connector.Conversations.ReplyToActivityAsync(reply); } else { HandleSystemMessage(activity); } var response = Request.CreateResponse(HttpStatusCode.OK); return(response); }
void displayPlayersByLineUp(ToolStrip ts, Team team, LineUp lineUp) { bool separate = (ts.Items.Count != 0 && !(ts.Items[ts.Items.Count - 1] is ToolStripSeparator)); foreach (Player p in team.Players) if (p.LineUp == lineUp) { if (separate) { ToolStripSeparator tss = new ToolStripSeparator(); tss.Margin = new Padding(0, 5, 0, 5); ts.Items.Add(tss); separate = false; } ToolStripButton tsb = new ToolStripButton(); tsb.Text = p.Name; switch (p.LineUp) { case LineUp.Top: case LineUp.Middle: case LineUp.Bottom: tsb.Text += " (" + p.LineUp.ToString() + ")"; break; case LineUp.JungleOrRoaming: tsb.Text += " (" + "Jungle/Roaming" + ")"; break; } tsb.Font = UIFonts.tahoma9_75Bold; tsb.BackColor = playerColorToColorBG(p.Color); tsb.ForeColor = Color.White; tsb.AutoToolTip = false; tsb.Click += new EventHandler(playerToolStripButton_Click); tsb.MouseDown += new MouseEventHandler(playerToolStripButton_MouseDown); tsb.Tag = p; if (p.Heroes.Count != 0) { string imagePath = DHLOOKUP.hpcUnitProfiles[p.GetMostUsedHero().Name, "Art"] as string; tsb.Image = (imagePath != null) ? DHRC.GetImage(imagePath) : Properties.Resources.armor; } else tsb.Image = Properties.Resources.armor; tsb.ImageAlign = ContentAlignment.MiddleLeft; ts.Items.Add(tsb); } }
void appendLineUpToExport(Team t, LineUp lineUp, bool vertical) { int count = 0; foreach (Player p in t.Players) if (p.LineUp == lineUp) { count++; if (count > 1) { if (vertical) UIRichText.Default.AddText("\n"); else UIRichText.Default.AddText(" + "); } Hero h = p.GetMostUsedHero(); string tag = getHeroTag(h.Name); dcUsedHeroTags[tag] = h.Name; UIRichText.Default.AddText(tag); if (includeNamesCB.Checked && namesCmbB.SelectedIndex != -1) UIRichText.Default.AddText(" " + getHeroNames(h.Name, namesCmbB.SelectedIndex)); UIRichText.Default.AddText(" " + p.Name); if (vertical) UIRichText.Default.AddText("(" + getLaneName(lineUp) + ")"); } }
unit GetTowerForLineUp(List<unit> towers, LineUp lineUp, bool isSentinel) { unit selected = null; switch (lineUp) { case LineUp.Top: if (isSentinel) { // top-most for sentinel foreach (unit tower in towers) if (selected == null || selected.y < tower.y) selected = tower; } else// left-most for scourge foreach (unit tower in towers) if (selected == null || selected.x > tower.x) selected = tower; break; case LineUp.Middle: // calculating hypotenuse as the measure // of the nearest tower to map center foreach (unit tower in towers) if (selected == null || ((selected.y * selected.y) + (selected.x * selected.x) > (tower.y * tower.y) + (tower.x * tower.x))) selected = tower; break; case LineUp.Bottom: if (isSentinel) { // right-most for sentinel foreach (unit tower in towers) if (selected == null || selected.x < tower.x) selected = tower; } else// bottom-most for scourge foreach (unit tower in towers) if (selected == null || selected.y > tower.y) selected = tower; break; } return selected; }
string getLaneName(LineUp lane) { switch (lane) { case LineUp.Top: return lane.ToString(); case LineUp.Middle: return shortLaneNamesCB.Checked ? "Mid" : lane.ToString(); case LineUp.Bottom: return shortLaneNamesCB.Checked ? "Bot" : lane.ToString(); case LineUp.JungleOrRoaming: return shortLaneNamesCB.Checked ? "Jungle" : "Jungle/Roaming"; default: return string.Empty; } }
string getHorzLineUp(Team t, LineUp lineUp) { string result = string.Empty; int count = 0; foreach (Player p in t.Players) if (p.LineUp == lineUp) { count++; if (count > 1) result+= " + "; Hero h = p.GetMostUsedHero(); string tag = getHeroTag(h.Name); dcUsedHeroTags[tag] = h.Name; result += tag; result+= " " + p.Name; } return result; }
public LineUpViewModel(IEnumerable <PlayerViewModel> players, IEnumerable <GameSnapshot> snapShots) { this._lineUp = new LineUp(snapShots, players.Select(p => p.Number).ToArray()); this.Players = players.OrderByDescending(p => p.RatePerMinute).ToList().AsReadOnly(); this.SnapShots = snapShots.Where(sn => players.All(p => sn.PlayerNumbers.Contains(p.Number))).ToList().AsReadOnly(); }