private void FactorCheck(int contID) { // extract contender var cont = VisualLeagueEvent.AllVisualContenders.Where(x => x.SystemID == contID).Select(c => c).Single(); // extract visual bracket number var vbNum = VisualLeagueEvent.GetVisualBracketNumtByVisualContender(contID); if (vbNum == -1) { // the contender is uplaced in no bracket Helpers.ShowGenericPromtForm(cont.Contender.FirstName + " " + cont.Contender.LastName + " " + "עדיין לא שובץ בשום בית" + " לכן לא ניתן להציג פקטור"); return; } // extract visual bracket var vb = VisualLeagueEvent.VisualBracketsList.Where(x => x.Bracket.BracketNumber == vbNum).Select(b => b).Single(); // get the factor string string factor = Contenders.ContndersGeneral.GetFactorExplanation(cont, vb); if (factor == "") { factor = "לא הופעל אף פקטור עבור " + cont.Contender.FirstName + " " + cont.Contender.LastName; } // show the factor Helpers.ShowGenericPromtForm(factor); }
private void Vbracket_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { System.Windows.Forms.Control c = e.Data.GetData(e.Data.GetFormats()[0]) as System.Windows.Forms.Control; // find parent control (Vcont FlowLayout Panel), max parent is "grandfather" System.Windows.Forms.Control Parent; if (c.Name.Contains("Cont")) { Parent = c; } else if (c.Parent.Name.Contains("Cont")) { Parent = c.Parent; } else { Parent = c.Parent.Parent; } // Extract Contender ID int ContID = (int)MartialArts.Helpers.extractNumberFromString(Parent.Name); // check if contender is allready belongs to this bracket if (Bracket.ContendersList.Any(x => x.SystemID == ContID)) { return; } // Extract cont VisualContender visualcont = VisualLeagueEvent.AllVisualContenders.Where(x => x.Contender.SystemID == ContID).Select(x => x).Single(); // check if the contender score is suitable for bracket of not promt the user if (CheckContTransffer(visualcont) == false) { return; } // Its the header ( Vbracket FlowLayoutPanel child, hence we use Parent.Controls.Add) ((System.Windows.Forms.Control)sender).Parent.Controls.Add(Parent); VisualLeagueEvent.AddContender(ContID, this); }
void contexMenuuu_ItemClicked(object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e) { System.Windows.Forms.ToolStripItem item = e.ClickedItem; if (item.Text == "העתק מתחרה") { System.Windows.Forms.ContextMenuStrip c = sender as System.Windows.Forms.ContextMenuStrip; if (e.ClickedItem.Name.IsNumeric() == true) { // save the contender id that will be pasted VisualLeagueEvent.ClipBoardValue = int.Parse(e.ClickedItem.Name); } } else if (item.Text == "צור בית חדש") { if (e.ClickedItem.Name.ToString().Trim().IsNumeric() == true) { // promt the user to permit using (var promt = new Martial_Arts_league_Management2.PromtForm("המתחרה יימחק מהבית הנוכחי ויפתח בית חדש שייצג את ציון החגורה הגיל והמשקל שלו" + Environment.NewLine + "אנא אשר על מנת להמשיך")) { var result = promt.ShowDialog(); if (result == System.Windows.Forms.DialogResult.No) { return; } } VisualLeagueEvent.CreateNewBracket(int.Parse(e.ClickedItem.Name.ToString().Trim())); } } else if (item.Text == "בדוק פקטור בבית") { if (e.ClickedItem.Name.ToString().Trim().IsNumeric() == true) { FactorCheck(int.Parse(e.ClickedItem.Name)); } } }
private bool CheckContTransffer(VisualContender vis) { double finalgrade; if (VisualLeagueEvent.IsSutibleForBracket(vis, this, out finalgrade) == false) { using (Martial_Arts_league_Management2.PromtForm promt = new Martial_Arts_league_Management2.PromtForm("המתחרה שברצונך להעביר לבית זה אינו מתאים לציון הממוצע של הבית, אנא אשר על מנת להעבירו", false)) { if (promt.ShowDialog() == DialogResult.OK) { return(true); } else { return(false); } } } else { return(true); } }
private void PasteVisualContender() { // Extract Contender ID int ContID = VisualLeagueEvent.ClipBoardValue; // check if contender is allready belongs to this bracket if (Bracket.ContendersList.Any(x => x.SystemID == ContID)) { return; } // Extract cont VisualContender visualcont = VisualLeagueEvent.AllVisualContenders.Where(x => x.Contender.SystemID == ContID).Select(x => x).Single(); // check if the contender score is suitable for bracket of not promt the user if (CheckContTransffer(visualcont) == false) { return; } // add to fpanel Vbracket.Controls.Add(visualcont.Vcontender); VisualLeagueEvent.AddContender(ContID, this); }