protected void Page_Load(object sender, EventArgs e) { string match_id = Request.QueryString[0]; // === M A T C H === Matches match = new Matches(); string[] matchInfo = match.getMatchInfo(match_id); // == MATCHINFO ARRAY : == //0 = NAME //1 = CITY //2 = DATE //3 = TYPE //4 = FIELD // === /M A T C H // === C O U R T === Courts court = new Courts(); string[] courtInfo = court.getCourtInfo(Int32.Parse(matchInfo[3])); List <String> courtImgs = court.getCourtImages(Int32.Parse(matchInfo[3])); string url = "https://www.google.com/maps/embed/v1/place?key=AIzaSyDT-7W1RK56peUVp3CRTKxuQ5pyoifLnH8&q=" + courtInfo[3] + "," + courtInfo[4] + "&zoom=12"; string iframeUrl = "<iframe width=\"210\" height=\"160\" src=\"" + url + "\" frameborder=\"0\" style=\"border: 0\" > </iframe>"; // == COURTINFO ARRAY : == //0 = NAME //1 = CITY //2 = LIMIT //3 = LAT //4 = LNG // === /C O U R T === // === FILLING DATA ==== // Match related info Mname.InnerText = matchInfo[0]; Mcity.InnerText = courtInfo[1]; Mdatetime.InnerText = matchInfo[1]; // Court related info fillSrc(courtImgs); Cname.InnerText = courtInfo[0]; Clocation.InnerHtml = iframeUrl; //viewMatch.Attributes["href"] = System.Web.HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/" + "MatchRoom?match_id=" + match_id; }
public bool IsTeamFull(string mid, int team) { Matches match = new Matches(); string[] matchInfo = match.getMatchInfo(mid); List <string> teamList = this.getTeam(mid, team); Courts court = new Courts(); string[] courtInfo = court.getCourtInfo(Int32.Parse(matchInfo[3])); string courtLimit = courtInfo[2]; int teamLimit = Int32.Parse(courtInfo[2]) / 2; if (teamList.Count() == teamLimit) {// team is full return(true); } return(false); }
public void checkIfFull() { Matches match = new Matches(); string[] matchInfo = match.getMatchInfo(match_id); Courts court = new Courts(); string[] courtInfo = court.getCourtInfo(Int32.Parse(matchInfo[3])); string courtLimit = courtInfo[2]; int teamLimit = Int32.Parse(courtInfo[2]) / 2; // Check if team A is full: List <string> teamA = match.getTeam(match_id, 1); if (teamA.Count() == teamLimit) // team A is full { if (!teamA.Contains(user_id)) // if not current user: { JoinA.Visible = false; teamAfull.Visible = true; } } // Check if team B is full: List <string> teamB = match.getTeam(match_id, 2); if (teamB.Count() == teamLimit) // team B is full { if (!teamB.Contains(user_id)) // if not current user: { JoinB.Visible = false; teamBfull.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["courtId"] == null) { Response.Redirect("/Default.aspx"); } int court_id = Int32.Parse(Request.QueryString["courtId"]); string len = Request.QueryString["length"]; string courtLocationUrl = "https://maps.google.com/?q="; Courts court = new Courts(); string[] courtInfo = court.getCourtInfo(court_id); List <String> courtImgs = court.getCourtImages(court_id); // == COURTINFO ARRAY : == //0 = NAME //1 = CITY //2 = LIMIT //3 = LAT //4 = LNG string name = courtInfo[0]; string city = courtInfo[1]; string limit = courtInfo[2]; string lat = courtInfo[3]; string lng = courtInfo[4]; courtLocationUrl += lat + "," + lng + "&ll=" + lat + "," + lng + "&z=15"; courtMap.Attributes["href"] = courtLocationUrl; courtName.InnerText = name; courtCity.InnerText = "Field city: " + city; courtLimit.InnerText = "Field limit: " + limit; int imgsCounter = 0; if (courtImgs != null) { for (int i = 0; i < courtImgs.Count(); i++) { string src = courtImgs[i].Replace(@"\", "/"); imgsCounter++; switch (i) { case 0: img0.Attributes["src"] = src; break; case 1: img1.Attributes["src"] = src; break; case 2: img2.Attributes["src"] = src; break; case 3: img3.Attributes["src"] = src; break; case 4: img4.Attributes["src"] = src; break; } } if (courtImgs.Count() < 5) { for (int i = 4; i >= imgsCounter; i--) { switch (i) { case 4: imgblock4.Visible = false; break; case 3: imgblock3.Visible = false; break; case 2: imgblock2.Visible = false; break; case 1: imgblock1.Visible = false; break; case 0: imgblock0.Visible = false; break; } } } } else { for (int i = 0; i < 5; i++) { switch (i) { case 4: imgblock4.Visible = false; break; case 3: imgblock3.Visible = false; break; case 2: imgblock2.Visible = false; break; case 1: imgblock1.Visible = false; break; case 0: imgblock0.Visible = false; break; } } } if (courtImgs == null) { notFound.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null || Session["userid"] == null) { Response.Redirect("~/Login.aspx"); } else//Session is available { // Get user ID from session, match ID from URL query string user_id = Session["userid"].ToString(); match_id = Request.QueryString.Get(0); } Matches match = new Matches(); string[] MatchInfo = match.getMatchInfo(match_id); Courts court = new Courts(); string[] courtInfo = court.getCourtInfo(Int32.Parse(MatchInfo[3])); type = MatchInfo[2]; if (type == "Private" && isCaptain(user_id, match_id))// if private and captain { pvt.Visible = true; } if (type == "Public" && isCaptain(user_id, match_id))// if private and captain { pvt1.Visible = true; } if (type == "Public") { status.Visible = true; status.InnerText = "public."; status.Attributes["class"] = "subtitle-pub"; } if (type == "Private") { status.Visible = true; status.InnerText = "private."; status.Attributes["class"] = "subtitle-pvt"; } List <String> courtImgs = court.getCourtImages(Int32.Parse(MatchInfo[3])); string courtLocationUrl = "https://maps.google.com/?q="; string lat = courtInfo[3]; string lng = courtInfo[4]; courtLocationUrl += lat + "," + lng + "&ll=" + lat + "," + lng + "&z=15"; // == Filling data: == if (!IsPostBack) { checkIfFull(); checkIfJoined(user_id, match_id); fillDefaultSlots(Int32.Parse(MatchInfo[3])); fillSlotsTeam1(match_id); fillSlotsTeam2(match_id); fillCourtImages(courtImgs); } matchName.InnerText = MatchInfo[0]; matchDate.InnerText = MatchInfo[1]; courtName.InnerText = courtInfo[0]; matchCity.InnerText = courtInfo[1]; courtLocation.HRef = courtLocationUrl; }
public void fillDefaultSlots(int cid) { Courts court = new Courts(); string[] courtInfo = court.getCourtInfo(cid); for (int i = 0; i < Int32.Parse(courtInfo[2]) / 2; i++) { switch (i) { case 0: Div0.Visible = true; break; case 1: Div1.Visible = true; break; case 2: Div2.Visible = true; break; case 3: Div3.Visible = true; break; case 4: Div4.Visible = true; break; case 5: Div5.Visible = true; break; case 6: Div6.Visible = true; break; case 7: Div7.Visible = true; break; case 8: Div8.Visible = true; break; case 9: Div9.Visible = true; break; case 10: Div10.Visible = true; break; } } for (int i = 0; i < Int32.Parse(courtInfo[2]) / 2; i++) { switch (i) { case 0: Div11.Visible = true; break; case 1: Div12.Visible = true; break; case 2: Div13.Visible = true; break; case 3: Div14.Visible = true; break; case 4: Div15.Visible = true; break; case 5: Div16.Visible = true; break; case 6: Div17.Visible = true; break; case 7: Div18.Visible = true; break; case 8: Div19.Visible = true; break; case 9: Div20.Visible = true; break; case 10: Div21.Visible = true; break; } } }