public void GetOrganization(string username, out string Name, out string Description, out string Type, out string Phone, out string Website, out string ProfilePic, out string CoverPic) { ISingleResult <getOrganizationResult> result1 = Data.getOrganization(username); ISingleResult <getUserResult> result2 = Data.getUser(username); if (result1 != null && result2 != null) { getOrganizationResult o = result1.First(); getUserResult u = result2.First(); Name = o.name; Description = o.description; Type = o.type; Phone = o.phone; Website = o.website; ProfilePic = u.profilePicture; CoverPic = u.coverPicture; } else { Name = ""; Description = ""; Type = ""; Phone = ""; Website = ""; ProfilePic = ""; CoverPic = ""; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { int opponentId = Convert.ToInt32(Request.QueryString["opponentId"]); RadDatePicker1.MinDate = DateTime.Now.AddDays(1); if (!IsPostBack) { if (!StoredData.User.TempDivision.Value || !StoredData.User.AccessExpired.Value) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { ISingleResult <SelectUserPublicProfileResult> users = dataContext.SelectUserPublicProfile(opponentId); SelectUserPublicProfileResult user = users.First(); opponentLabel.Text = user.FirstName + " " + user.LastName; List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtsByEmailId(StoredData.User.EmailId).ToList(); locationDropDownList.DataSource = tennisCourts; locationDropDownList.DataTextField = "CourtName"; locationDropDownList.DataValueField = "CourtId"; locationDropDownList.DataBind(); locationDropDownList.SelectedValue = StoredData.User.HomeCourt.ToString(); ViewState["UserCourtName"] = locationDropDownList.SelectedItem.Text; } } } } }
public void GetIndividual(string username, out string FirstName, out string MiddleName, out string LastName, out DateTime DOB, out bool Gender, out string ProfilePic, out string CoverPic) { ISingleResult <getIndividualResult> result1 = Data.getIndividual(username); ISingleResult <getUserResult> result2 = Data.getUser(username); if (result1 != null && result2 != null) { getIndividualResult i = result1.First(); getUserResult u = result2.First(); FirstName = i.firstName; MiddleName = i.midName; LastName = i.lastName; DOB = i.DOB; Gender = i.gender; ProfilePic = u.profilePicture; CoverPic = u.coverPicture; } else { FirstName = ""; MiddleName = ""; LastName = ""; DOB = DateTime.MinValue; Gender = false; ProfilePic = ""; CoverPic = ""; } }
byte[] IDatabaseInterface.GetData(string login, string password, object key, string id, ref string extension) { Guid g = new Guid(id); ISingleResult <SelectBinaryResult> sr = Context.SelectBinary(g); SelectBinaryResult r = sr.First <SelectBinaryResult>(); ext = r.Ext; return(r.Data.ToArray()); }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { List <Performance> performances = dataContext.SelectPerformanceByUserId(StoredData.User.UserId).ToList(); Performance seasonPerformance = performances.Find(p => p.DivisionId == StoredData.User.Division); seasonWinsLabel.Text = string.Format("{0}W - {1}L", seasonPerformance.Win, seasonPerformance.Loss); seasonPointsLabel.Text = seasonPerformance.TotalPoints.ToString(); overallWinsLabel.Text = string.Format("{0}W - {1}L", performances.Sum(p => p.Win), performances.Sum(p => p.Loss)); overallPointsLabel.Text = performances.Sum(p => p.TotalPoints).ToString(); ISingleResult <SelectDivisionResult> divisions = dataContext.SelectDivision(StoredData.User.Division); SelectDivisionResult division = divisions.First(); List <SelectRatingsByUserIdStartEndDateResult> ratings = dataContext.SelectRatingsByUserIdStartEndDate(StoredData.User.UserId, division.StartDate, division.EndDate).ToList(); List <SelectRatingsByUserIdStartEndDateResult> validOwnRatings = ratings.FindAll(p => p.OwnForehand.HasValue); if (validOwnRatings.Count > 0) { DrawRateOwnPerformanceChart(validOwnRatings); DrawRateOwnDetailPerformanceChart(validOwnRatings); } List <SelectOpponentRatingsByUserIdStartEndDateResult> opponentRatings = dataContext.SelectOpponentRatingsByUserIdStartEndDate(StoredData.User.UserId, division.StartDate, division.EndDate).ToList(); List <SelectOpponentRatingsByUserIdStartEndDateResult> validOpponentRatings = opponentRatings.FindAll(p => p.OpponentForehand.HasValue); if (validOpponentRatings.Count > 0) { DrawRateOthersPerformanceChart(validOpponentRatings); DrawRateOpponentServeChart(validOpponentRatings); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { int opponentId = Convert.ToInt32(Request.QueryString["opponentId"]); int matchId = Convert.ToInt32(Request.QueryString["matchId"]); matchIdHiddenField.Value = matchId.ToString(); opponentIdHiddenField.Value = opponentId.ToString(); if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { ISingleResult <SelectUserPublicProfileResult> users = dataContext.SelectUserPublicProfile(opponentId); SelectUserPublicProfileResult user = users.First(); ISingleResult <SelectMatchResult> matches = dataContext.SelectMatch(matchId); SelectMatchResult match = matches.First(); ISingleResult <SelectMatchPointLogsByMatchIdResult> matchResults = dataContext.SelectMatchPointLogsByMatchId(matchId); SelectMatchPointLogsByMatchIdResult matchResult = matchResults.First(); string winner = string.Empty; if (matchResult.UserId == StoredData.User.UserId) { if (matchResult.Win) { winner = StoredData.User.FirstName + " " + StoredData.User.LastName; } else { winner = user.FirstName + " " + user.LastName; } } else { if (matchResult.Win) { winner = user.FirstName + " " + user.LastName; } else { winner = StoredData.User.FirstName + " " + StoredData.User.LastName; } } matchLabel.Text = string.Format("{0} vs {1} on {2} {3}. Winner: {4} ({5})", StoredData.User.FirstName + " " + StoredData.User.LastName, user.FirstName + " " + user.LastName, match.MatchDate.ToShortDateString(), match.MatchDate.ToShortTimeString(), winner, match.Score); ISingleResult <SelectMatchPointLogsByMatchIdUserIdResult> ratings = dataContext.SelectMatchPointLogsByMatchIdUserId(matchId, StoredData.User.UserId); SelectMatchPointLogsByMatchIdUserIdResult rating = ratings.First(); ownBackhandRadSlider.Value = rating.OwnBackhand.Value; ownCourtCoverageRadSlider.Value = rating.OwnCourtCoverage.Value; ownDropRadSlider.Value = rating.OwnDrop.Value; ownForehandRadSlider.Value = rating.OwnForehand.Value; ownOverheadRadSlider.Value = rating.OwnOverhead.Value; ownServeRadSlider.Value = rating.OwnServe.Value; ownVolleyRadSlider.Value = rating.OwnVolley.Value; opponentBackhandRadSlider.Value = rating.OpponentBackhand.Value; opponentCourtCoverageRadSlider.Value = rating.OpponentCourtCoverage.Value; opponentDropRadSlider.Value = rating.OpponentDrop.Value; opponentForehandRadSlider.Value = rating.OpponentForehand.Value; opponentOverheadRadSlider.Value = rating.OpponentOverhead.Value; opponentServeRadSlider.Value = rating.OpponentServe.Value; opponentVolleyRadSlider.Value = rating.OpponentVolley.Value; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Request.IsAuthenticated) { Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString()); } Guid userId = new Guid(Request.QueryString["UserId"]); using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { ISingleResult <SelectUserPublicProfileByProfileIdResult> users = dataContext.SelectUserPublicProfileByProfileId(userId); SelectUserPublicProfileByProfileIdResult user = users.First(); userLabel.Text = user.FirstName + " " + user.LastName; //Load Image if (user.ProfileImageName.HasValue) { profileImage.ImageUrl = string.Format("~/ProfileImages/{0}.jpg", user.ProfileImageName.ToString()); } divisionLabel.Text = user.Division; homeCourtLabel.Text = user.CourtName; ntrpRankingLabel.Text = user.NTRPRanking.ToString(); ageGroupLabel.Text = user.AgeGroup; racquetHandLabel.Text = user.RacquetHand; favoriteShotLabel.Text = user.FavoriteShot; racquetLabel.Text = user.Racquet; if (!StoredData.User.TempDivision.Value || (user.DivisionId != StoredData.User.Division) || !StoredData.User.AccessExpired.Value) { emailHyperLink.Text = user.EmailId; emailHyperLink.NavigateUrl = string.Format("mailto:{0}", user.EmailId); phoneLabel.Text = user.Phone; facebookHyperLink.Text = user.Facebook; facebookHyperLink.NavigateUrl = user.Facebook; linkedInHyperLink.Text = user.LinkedIn; linkedInHyperLink.NavigateUrl = user.LinkedIn; myspaceHyperLink.Text = user.MySpace; myspaceHyperLink.NavigateUrl = user.MySpace; orkutHyperLink.Text = user.Orkut; orkutHyperLink.NavigateUrl = user.Orkut; } List <Performance> performances = dataContext.SelectPerformanceByUserId(user.UserId).ToList(); Performance seasonPerformance = performances.Find(p => p.DivisionId == user.DivisionId); seasonWinsLabel.Text = string.Format("{0}W - {1}L", seasonPerformance.Win, seasonPerformance.Loss); seasonPointsLabel.Text = seasonPerformance.TotalPoints.ToString(); overallWinsLabel.Text = string.Format("{0}W - {1}L", performances.Sum(p => p.Win), performances.Sum(p => p.Loss)); overallPointsLabel.Text = performances.Sum(p => p.TotalPoints).ToString(); if (!StoredData.User.TempDivision.Value) { List <GetUpcomingMatchesResult> upcomingMatches = dataContext.GetUpcomingMatches(user.UserId).ToList(); upcomingMatchesRadGrid.DataSource = upcomingMatches; upcomingMatchesRadGrid.DataBind(); List <GetPreviousMatchesResult> previousMatches = dataContext.GetPreviousMatches(user.UserId).ToList(); previousMatchesRadGrid.DataSource = previousMatches; previousMatchesRadGrid.DataBind(); int upcomingMatchCount = Convert.ToInt32(upcomingMatches.Count(p => p.UserId == StoredData.User.UserId)); int previousMatchCount = Convert.ToInt32(previousMatches.Count(p => p.UserId == StoredData.User.UserId)); } //Get availability List <SelectAvailabilitiesByUserIdResult> availabilities = dataContext.SelectAvailabilitiesByUserId(user.UserId).ToList(); SetAvailabilities(availabilities); if (StoredData.User.TempDivision.Value || StoredData.User.AccessExpired.Value) { matchRequestLinkButton.Enabled = false; } else { List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division.Value).ToList(); foreach (SelectDivisionResult result in selectDivisionResult) { if (result.StartDate > DateTime.Now) { matchRequestLinkButton.Enabled = false; } } } //TODO: Have to uncomment these lines below //if ((upcomingMatchCount + previousMatchCount) < 2) matchRequestLinkButton.Attributes.Add("onClick", string.Format("openRadWindow('{0}'); return false;", user.UserId)); //else //matchRequestLinkButton.Attributes.Add("onClick", "alert('You have already played two matches against this player for the season. You cannot play against a player more than twice.');return false;"); //matchRequestLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["MatchRequestPath"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.IsAuthenticated) { int? opponentId = null; int? matchId = null; string mode = string.Empty; if (Request.QueryString["opponentId"] != null) { opponentId = Convert.ToInt32(Request.QueryString["opponentId"]); opponentIdHiddenField.Value = opponentId.ToString(); } //RadDatePicker1.MinDate = DateTime.Now; if (Request.QueryString["matchId"] != null) { matchId = Convert.ToInt32(Request.QueryString["matchId"]); matchIdHiddenField.Value = matchId.ToString(); } if (Request.QueryString["mode"] != null) { mode = Request.QueryString["mode"].ToString(); } ViewState["Submitted"] = false; Page.Title = "Report Score"; if (!Page.IsPostBack) { using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext()) { opponentDropDownList.Items.Clear(); List <LeaguePerformance> leaguePerformances = dataContext.SelectLeaguePerformanceByDivision(StoredData.User.Division).ToList(); opponentDropDownList.Items.Add(new ListItem(string.Empty, string.Empty)); foreach (LeaguePerformance leaguePerformance in leaguePerformances) { if (leaguePerformance.UserId != StoredData.User.UserId) { opponentDropDownList.Items.Add(new ListItem(leaguePerformance.FirstName + " " + leaguePerformance.LastName, leaguePerformance.UserId.ToString())); } } opponentDropDownList.SelectedValue = opponentId.ToString(); List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtsByLeague(leaguePerformances[0].LeagueId).ToList(); locationDropDownList.DataSource = tennisCourts; locationDropDownList.DataTextField = "CourtName"; locationDropDownList.DataValueField = "CourtId"; locationDropDownList.DataBind(); //RadDatePicker1.MinDate = Convert.ToDateTime("1/1/2009"); if (!string.IsNullOrEmpty(mode)) { RadDatePicker1.MinDate = DateTime.Now.AddDays(-14); } if (matchId.HasValue) { ISingleResult <SelectMatchResult> matches = dataContext.SelectMatch(matchId); SelectMatchResult match = matches.First(); RadDatePicker1.SelectedDate = match.MatchDate; RadTimePicker1.SelectedDate = match.MatchDate; locationDropDownList.SelectedValue = match.TennisCourt.ToString(); RadDatePicker1.MaxDate = match.MatchDate; } else { locationDropDownList.SelectedValue = StoredData.User.HomeCourt.ToString(); RadDatePicker1.MaxDate = DateTime.Now; } winnerDropDownList.Items.Clear(); winnerDropDownList.Items.Add(new ListItem()); winnerDropDownList.Items.Add(new ListItem(StoredData.User.FirstName + " " + StoredData.User.LastName, StoredData.User.UserId.ToString())); if (opponentId.HasValue) { winnerDropDownList.Items.Add(new ListItem(opponentDropDownList.SelectedItem.Text, opponentDropDownList.SelectedItem.Value)); opponentDropDownList.Enabled = false; } } } } }
private static FLMRequiredExtensionsType BuildFlmRequiredExtention(X509Certificate2 x509Certificate2, ISingleResult<flm_GetFacilityInfoResult> facilityInfoCollection, ArrayList secureDeviceArray) { FLMRequiredExtensionsType flmRequiredExtention = new FLMRequiredExtensionsType(); flm_GetFacilityInfoResult facilityInfo = facilityInfoCollection.First(); #region Build the FacilityInfo element flmRequiredExtention.FacilityInfo = new FLMRequiredExtensionsTypeFacilityInfo(); flmRequiredExtention.FacilityInfo.FacilityID = "urn:x-facilityID:" + facilityInfo.URI_Mapping + ":" + facilityInfo.Site_Code.ToString(); flmRequiredExtention.FacilityInfo.AnnotationText = new UserTextType(); flmRequiredExtention.FacilityInfo.AnnotationText.language = "en-us"; flmRequiredExtention.FacilityInfo.AnnotationText.Value = "FLM for site " + facilityInfo.Site_Name; flmRequiredExtention.FacilityInfo.FacilityName = new UserTextType(); flmRequiredExtention.FacilityInfo.FacilityName.Value = facilityInfo.Site_Name; #endregion #region Build the SecureDeviceList element flmRequiredExtention.SecurityDeviceList = new SecurityDeviceListType(); ArrayList secureDeviceCombinedTypeArray = new ArrayList(); flm_GetFacilitySecureEquipmentResult currentDevice = null; X509Certificate2 deviceCertificate = null; ArrayList versionInformation = null; foreach (flm_GetFacilitySecureEquipmentResult secureDevice in secureDeviceArray) { if ((null != currentDevice) && (currentDevice.Equipment_Id == secureDevice.Equipment_Id)) // It still the same device (get next version element) { AddInfoType(versionInformation, secureDevice); currentDevice = secureDevice; continue; } else // the next device in the list { #region Add the last completed device to the array if ((null != currentDevice) && (null != deviceCertificate)) { CombinedType securityDevice = BuildSecurityDeviceCombinedType(currentDevice, versionInformation, deviceCertificate); secureDeviceCombinedTypeArray.Add(securityDevice); } #endregion currentDevice = null; deviceCertificate = null; versionInformation = null; #region Get the serial number of the next device. Skip this device if we cannot get the serial number if ((null == secureDevice.Serial_Number) || (secureDevice.Serial_Number.Length < 1)) { continue; } #endregion #region Get the certificate of the next device. Skip this device if we cannot get the certificate string deviceCertificateChainString = secureDevice.Cert_String; if (null == deviceCertificateChainString) { continue; } int certificateCount = X509Certificate_ClassLibrary.X509CertificateClassLibrary.GetBeginCertificateCount(deviceCertificateChainString); if (certificateCount < 1) { continue; } string deviceCertificateString = X509Certificate_ClassLibrary.X509CertificateClassLibrary.GetBeginCertificate(0, deviceCertificateChainString); if (null == deviceCertificateString) { continue; } deviceCertificate = X509Certificate_ClassLibrary.X509CertificateClassLibrary.BuildCertificate(deviceCertificateString); if (null == deviceCertificate) { currentDevice = null; continue; } #endregion currentDevice = secureDevice; versionInformation = new ArrayList(); AddInfoType(versionInformation, secureDevice); } } #endregion #region Add the Secure Device List to the Required Extention flmRequiredExtention.SecurityDeviceList.Items = new CombinedType[secureDeviceCombinedTypeArray.Count]; int index = 0; foreach (CombinedType device in secureDeviceCombinedTypeArray) { flmRequiredExtention.SecurityDeviceList.Items[index] = device; index++; } #endregion return flmRequiredExtention; }