protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    List <SelectFeaturedPlayerResult> results = dataContext.SelectFeaturedPlayer(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
                    foreach (SelectFeaturedPlayerResult result in results)
                    {
                        if (result.ProfileImageName.HasValue)
                        {
                            playerImage.ImageUrl = "~/ProfileImages/" + result.ProfileImageName.ToString() + ".jpg";
                        }
                        else
                        {
                            playerImage.ImageUrl = "~/Resources/Images/NoProfile.gif";
                        }

                        locationLabel.Text  = result.LeagueCity + ", " + result.LeagueState;
                        ntrpLabel.Text      = result.NTRPRanking.ToString();
                        seasonLabel.Text    = result.Win + "W - " + result.Loss + "L";
                        seasonPoints.Text   = result.TotalPoints.ToString();
                        favortiteLabel.Text = result.FavoriteShot;
                        nameLabel.Text      = result.FirstName + " " + result.LastName;
                    }
                    if (results.Count == 0)
                    {
                        playerImage.ImageUrl = "~/Resources/Images/NoProfile.gif";
                    }
                }
            }
        }
Exemplo n.º 2
0
        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;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        protected void updateButton_Click(object sender, EventArgs e)
        {
            if (Validation() && Page.IsValid)
            {
                int?availabilityId = null;
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    bool availabilityPresent = false;
                    if (ViewState["AvailabilityPresent"] != null)
                    {
                        availabilityPresent = Convert.ToBoolean(ViewState["AvailabilityPresent"]);
                    }

                    if (availabilityPresent)
                    {
                        //update availability
                        dataContext.UpdateAvailability(StoredData.User.UserId, sundayFromRadTimePicker.SelectedDate, sundayToRadTimePicker.SelectedDate, sundayUnavailableCheckBox.Checked, mondayFromRadTimePicker.SelectedDate, mondayToRadTimePicker.SelectedDate, mondayUnavailableCheckBox.Checked, tuesdayFromRadTimePicker.SelectedDate, tuesdayToRadTimePicker.SelectedDate, tuesdayUnavailableCheckBox.Checked, wednesdayFromRadTimePicker.SelectedDate, wednesdayToRadTimePicker.SelectedDate, wednesdayUnavailableCheckBox.Checked, thursdayFromRadTimePicker.SelectedDate, thursdayToRadTimePicker.SelectedDate, thursdayUnavailableCheckBox.Checked, fridayFromRadTimePicker.SelectedDate, fridayToRadTimePicker.SelectedDate, fridayUnavailableCheckBox.Checked, saturdayFromRadTimePicker.SelectedDate, saturdayToRadTimePicker.SelectedDate, saturdayUnavailableCheckBox.Checked);
                    }
                    else
                    {
                        dataContext.InsertAvailability(StoredData.User.UserId, sundayFromRadTimePicker.SelectedDate, sundayToRadTimePicker.SelectedDate, sundayUnavailableCheckBox.Checked, mondayFromRadTimePicker.SelectedDate, mondayToRadTimePicker.SelectedDate, mondayUnavailableCheckBox.Checked, tuesdayFromRadTimePicker.SelectedDate, tuesdayToRadTimePicker.SelectedDate, tuesdayUnavailableCheckBox.Checked, wednesdayFromRadTimePicker.SelectedDate, wednesdayToRadTimePicker.SelectedDate, wednesdayUnavailableCheckBox.Checked, thursdayFromRadTimePicker.SelectedDate, thursdayToRadTimePicker.SelectedDate, thursdayUnavailableCheckBox.Checked, fridayFromRadTimePicker.SelectedDate, fridayToRadTimePicker.SelectedDate, fridayUnavailableCheckBox.Checked, saturdayFromRadTimePicker.SelectedDate, saturdayToRadTimePicker.SelectedDate, saturdayUnavailableCheckBox.Checked, ref availabilityId);
                    }

                    string errorMessage = "radalert('Availability updated succesfully!!',250,150,'Success!!')";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", "(function(){var f = function(){" + errorMessage + ";Sys.Application.remove_load(f);};Sys.Application.add_load(f);})();", true);
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DropDownList   homeCourtDropDownList  = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("homeCourtDropDownList");
            DropDownList   leagueCityDropDownList = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("leagueCityDropDownList");
            RadCaptcha     radCaptcha             = (RadCaptcha)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("radCaptcha");
            RadAjaxManager radAjaxManage          = RadAjaxManager.GetCurrent(Page);

            radAjaxManage.AjaxSettings.AddAjaxSetting(leagueCityDropDownList, homeCourtDropDownList);
            radAjaxManage.AjaxSettings.AddAjaxSetting(leagueCityDropDownList, radCaptcha);
            if (!Page.IsPostBack)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    List <SelectUniqueTennisCourtCitiesResult> selectUniqueTennisCourtCitiesResults = dataContext.SelectUniqueTennisCourtCities(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
                    foreach (SelectUniqueTennisCourtCitiesResult result in selectUniqueTennisCourtCitiesResults)
                    {
                        leagueCityDropDownList.Items.Add(new ListItem(result.City, result.City));
                    }
                    leagueCityDropDownList.Items[0].Selected = true;
                    homeCourtDropDownList.Items.Add(string.Empty);
                    List <TennisCourt> tennisCourts = dataContext.SelectTennisCourtByCity(selectUniqueTennisCourtCitiesResults[0].City, Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
                    foreach (TennisCourt tennisCourt in tennisCourts)
                    {
                        homeCourtDropDownList.Items.Add(new ListItem(tennisCourt.CourtName, tennisCourt.CourtId.ToString()));
                    }
                }
            }
        }
        private List <DLL.Appointment> GetAppointments(int userId, int opponentId, out bool opponentAvailabilitySet)
        {
            List <DLL.Appointment> appointments = new List <DLL.Appointment>();

            opponentAvailabilitySet = false;
            using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
            {
                appointments = dataContext.SelectAppointmentsByUserIdOpponentId(StoredData.User.UserId, opponentId).ToList();
                //Get availability for current user
                List <SelectAvailabilitiesByUserIdResult> availability = dataContext.SelectAvailabilitiesByUserId(StoredData.User.UserId).ToList();
                if (availability.Count > 0)
                {
                    appointments = CombineAppointmentsWithAvailability(availability, appointments, StoredData.User.UserId);
                }

                //Get availability for opponent
                List <SelectAvailabilitiesByUserIdResult> opponentAvailability = dataContext.SelectAvailabilitiesByUserId(opponentId).ToList();
                if (opponentAvailability.Count > 0)
                {
                    appointments            = CombineAppointmentsWithAvailability(opponentAvailability, appointments, opponentId);
                    opponentAvailabilitySet = true;
                }
            }
            return(appointments);
        }
Exemplo n.º 6
0
 protected void communicationButton_Click(object sender, EventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
     {
         dataContext.UpdateCommunicationPreferences(StoredData.User.EmailId, postEmailCheckBox.Checked);
     }
 }
Exemplo n.º 7
0
        protected void postMessageButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(messageTextBox.Text))
            {
                int?messageId = 0;
                int replyId   = 0;
                if (Request.QueryString["MessageId"] != null)
                {
                    messageId = Convert.ToInt32(Request.QueryString["MessageId"]);
                }
                else if (Request.QueryString["ReplyId"] != null)
                {
                    replyId = Convert.ToInt32(Request.QueryString["ReplyId"]);
                }

                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    if (messageId > 0)
                    {
                        dataContext.UpdateMessage(messageId, messageTextBox.Text);
                        Response.Redirect(string.Format("MessageDetail.aspx?MessageId={0}", messageId));
                    }
                    else if (replyId > 0)
                    {
                        dataContext.UpdateReply(replyId, messageTextBox.Text, ref messageId);
                        Response.Redirect(string.Format("MessageDetail.aspx?MessageId={0}", messageId.Value));
                    }
                }
            }
        }
Exemplo n.º 8
0
 protected void basicProfileSaveButton_Click(object sender, EventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
     {
         dataContext.UpdateBasicUserInfoByEmailId(HttpContext.Current.User.Identity.Name, zipTextBox.Text, firstNameTextBox.Text, lastNameTextBox.Text, phoneTextBox.Text, Convert.ToInt32(homeCourtDropDownList.SelectedValue), Convert.ToDouble(nTRPDropDownList.Text));
         HttpContext.Current.Items["User"] = null;
     }
 }
Exemplo n.º 9
0
 protected void tennisProfileSaveButton_Click(object sender, EventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
     {
         dataContext.UpdateTennisUserInfoByEmailId(HttpContext.Current.User.Identity.Name, ageGroupDropDownList.SelectedValue, racquetHandDropDownList.SelectedValue, favoriteShotDropDownList.SelectedValue, racquetTextBox.Text, facebookTextBox.Text, linkedInTextBox.Text, mySpaceTextBox.Text, orkutTextBox.Text, playTypeDropDownList.Text);
         HttpContext.Current.Items["User"] = null;
     }
 }
Exemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!StoredData.User.AccessExpired.Value && !StoredData.User.TempDivision.Value)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             geoRSSFeed = string.Format("/TennisCourts/PlayerLocations.ashx?Division={0}", Encryption.Encrypt(StoredData.User.Division.Value.ToString(), "skhdhkrwshrkhwrh"));
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.IsAuthenticated)
            {
                Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString());
            }

            RadAjaxManager.GetCurrent(Page).AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(Schedule_AjaxRequest);
            if (!Page.IsPostBack)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    if (!StoredData.User.TempDivision.Value && !StoredData.User.AccessExpired.Value)
                    {
                        var upcomingMatches = dataContext.GetUpcomingMatches(StoredData.User.UserId);
                        upcomingMatchesRadGrid.DataSource = upcomingMatches;
                        upcomingMatchesRadGrid.DataBind();

                        var previousMatches = dataContext.GetPreviousMatches(StoredData.User.UserId);
                        previousMatchesRadGrid.DataSource = previousMatches;
                        previousMatchesRadGrid.DataBind();

                        List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division.Value).ToList();
                        foreach (SelectDivisionResult result in selectDivisionResult)
                        {
                            if (result.StartDate > DateTime.Now)
                            {
                                warningImage.Visible      = true;
                                warningLinkButton.Visible = true;
                                warningLinkButton.Text    = "Although you may play practice matches with members in your league. You will not be able to record scores until the league start date of " + result.StartDate.ToShortDateString();
                                HyperLink1.Visible        = false;
                                Image1.Visible            = false;
                            }
                        }
                    }
                    else
                    {
                        warningImage.Visible      = true;
                        warningLinkButton.Visible = true;
                        Image1.Visible            = false;
                        HyperLink1.Visible        = false;

                        if (StoredData.User.TempDivision.Value)
                        {
                            warningLinkButton.Text = "Your account is still being created. You will not be able to schedule matches or report scores. Please wait for the email confirming your account activation.";
                        }
                        else if (StoredData.User.AccessExpired.Value)
                        {
                            warningLinkButton.Text        = "Your access has expired. Please click here to subscribe to the current season and regain access.";
                            warningLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["NewLeagueRegisterURL"].ToString();
                        }
                    }
                }
            }
        }
 protected void postMessageButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(messageTextBox.Text) && messageTextBox.Text != "Eg: Is anyone available for tennis match at 5PM on Friday?")
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             dataContext.InsertMessage(StoredData.User.UserId, StoredData.User.Division, messageTextBox.Text);
         }
         messagesRadGrid.Rebind();
     }
 }
 protected void messagesRadGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     if (!StoredData.User.TempDivision.Value && !StoredData.User.AccessExpired.Value)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             List <SelectMessageResult> messages = dataContext.SelectMessage(StoredData.User.Division).ToList();
             messagesRadGrid.DataSource = messages;
         }
     }
 }
Exemplo n.º 14
0
 protected void nextLeagueRadGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     if (!StoredData.User.TempDivision.Value && !StoredData.User.AccessExpired.Value && StoredData.User.NextDivision.HasValue)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             List <LeaguePerformance> leaguePerformance = dataContext.SelectLeaguePerformanceByDivision(StoredData.User.NextDivision.Value).ToList();
             nextLeagueRadGrid.DataSource = leaguePerformance;
         }
     }
 }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request.IsAuthenticated)
            {
                Response.Redirect(WebConfigurationManager.AppSettings["LoginPageURL"].ToString());
            }

            if (!Page.IsPostBack)
            {
                //Hide next division panel if the current user is not signed up for next division.
                if (StoredData.User.NextDivision == StoredData.User.Division)
                {
                    nextLeaguePanel.Visible = false;
                }

                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    if (StoredData.User.TempDivision.Value || StoredData.User.AccessExpired.Value)
                    {
                        warningImage.Visible      = true;
                        warningLinkButton.Visible = true;
                        if (StoredData.User.TempDivision.Value)
                        {
                            warningLinkButton.Text = "Your account is still being created. You will not be able to schedule matches or report scores. Please wait for the email confirming your account activation.";
                        }
                        else if (StoredData.User.AccessExpired.Value)
                        {
                            warningLinkButton.Text        = "Your access has expired. Please click here to subscribe to the current season and regain access.";
                            warningLinkButton.PostBackUrl = WebConfigurationManager.AppSettings["NewLeagueRegisterURL"].ToString();
                        }
                    }
                    else
                    {
                        leagueRadGrid.Rebind();
                        nextLeagueRadGrid.Rebind();
                    }

                    List <SelectDivisionResult> selectDivisionResult = dataContext.SelectDivision(StoredData.User.Division).ToList();
                    if (selectDivisionResult.Count > 0)
                    {
                        leagueLabel.Text = selectDivisionResult[0].Division;
                    }

                    if (StoredData.User.NextDivision != StoredData.User.Division)
                    {
                        List <SelectDivisionResult> selectNextDivisionResult = dataContext.SelectDivision(StoredData.User.NextDivision.Value).ToList();
                        if (selectNextDivisionResult.Count > 0)
                        {
                            nextLeagueLabel.Text = selectNextDivisionResult[0].Division + " (Your Next Season)";
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
 protected void submitButton_Click(object sender, EventArgs e)
 {
     if (!StoredData.User.AccessExpired.Value && !StoredData.User.TempDivision.Value)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             dataContext.UpdateMatchPointRankingLogByMatchIdUserId(Convert.ToInt32(matchIdHiddenField.Value), StoredData.User.UserId, ownServeRadSlider.Value, ownForehandRadSlider.Value, ownBackhandRadSlider.Value, ownVolleyRadSlider.Value, ownDropRadSlider.Value, ownOverheadRadSlider.Value, ownCourtCoverageRadSlider.Value, opponentServeRadSlider.Value, opponentForehandRadSlider.Value, opponentBackhandRadSlider.Value, opponentVolleyRadSlider.Value, opponentDropRadSlider.Value, opponentOverheadRadSlider.Value, opponentCourtCoverageRadSlider.Value);
             string closingScript = "<script type='text/javascript'>Sys.Application.add_load(function () {closeRadWindowAndShowAlert('Match rating successfully recorded.');}); </script> ";
             ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", closingScript, false);
         }
     }
 }
Exemplo n.º 17
0
 protected void upcomingLeagueButton_Click(object sender, EventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
     {
         upcomingLeagueButton.Enabled = false;
         dataContext.UpdateNextDivision(HttpContext.Current.User.Identity.Name, Convert.ToInt32(ViewState["NextDivision"]));
         HttpContext.Current.Items["User"] = null;
         string radalertscript = "<script language='javascript'>function f(){radalert('Thank you for signing up.<br>Your account will be updated within 12 hours.', 330, 210,'Thank you!!'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";
         Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);
         SendEmail();
     }
 }
Exemplo n.º 18
0
        protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            if (e.Argument == "true")
            {
                if (!StoredData.User.AccessExpired.Value && !StoredData.User.TempDivision.Value)
                {
                    bool success = false;
                    using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                    {
                        int?     matchPointLogId  = 0;
                        int?     matchId          = null;
                        int?     opponentId       = null;
                        DateTime selectedDateTime = Convert.ToDateTime(RadDatePicker1.SelectedDate.Value.ToShortDateString() + " " + RadTimePicker1.SelectedDate.Value.ToShortTimeString());
                        using (TransactionScope transactionScope = new TransactionScope())
                        {
                            if (string.IsNullOrEmpty(matchIdHiddenField.Value))
                            {
                                opponentId = Convert.ToInt32(opponentDropDownList.SelectedItem.Value);
                                dataContext.InsertMatch(selectedDateTime, Convert.ToInt32(locationDropDownList.Text), StoredData.User.UserId, Convert.ToInt32(opponentDropDownList.SelectedItem.Value), 2, "0-0,0-0", ref matchId);
                            }
                            else
                            {
                                matchId    = Convert.ToInt32(matchIdHiddenField.Value);
                                opponentId = Convert.ToInt32(opponentIdHiddenField.Value);
                                dataContext.UpdateMatch(matchId.Value, selectedDateTime, Convert.ToInt32(locationDropDownList.Text), Convert.ToInt32(MatchStatus.Completed), "0-0,0-0");
                            }

                            dataContext.InsertMatchPointLog(matchId.Value, StoredData.User.UserId, true, 1, 0, 0, 3, ref matchPointLogId);
                            dataContext.InsertMatchPointLog(matchId.Value, opponentId.Value, false, 0, 0, 0, 0, ref matchPointLogId);

                            dataContext.UpdatePerformance(StoredData.User.UserId, 1, 0, 4, 0);
                            dataContext.UpdatePerformance(opponentId.Value, 0, 1, 0, 0);

                            dataContext.UpdateUserWarningByUserId(opponentId.Value, 2);

                            transactionScope.Complete();
                            success = true;
                        }
                    }
                    if (success)
                    {
                        string closingScript = "<script type='text/javascript'>Sys.Application.add_load(function () {closeRadWindowAndShowAlert('No show successfully recorded.');}); </script> ";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", closingScript, false);
                    }
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "EnableButton", "changeButtonState('false');", true);
            }
        }
Exemplo n.º 19
0
 protected void leagueCityDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
     {
         DropDownList       homeCourtDropDownList  = (DropDownList)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("homeCourtDropDownList");
         DropDownList       leagueCityDropDownList = (DropDownList)sender;
         List <TennisCourt> tennisCourts           = dataContext.SelectTennisCourtByCity(leagueCityDropDownList.SelectedItem.Text, Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
         homeCourtDropDownList.Items.Clear();
         homeCourtDropDownList.Items.Add(string.Empty);
         foreach (TennisCourt tennisCourt in tennisCourts)
         {
             homeCourtDropDownList.Items.Add(new ListItem(tennisCourt.CourtName, tennisCourt.CourtId.ToString()));
         }
     }
 }
 protected void cityDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
     {
         if (!string.IsNullOrEmpty(cityDropDownList.SelectedItem.Value))
         {
             leagueDropDownList.Items.Clear();
             List <SelectDivisionByLeagueIdResult> results = dataContext.SelectDivisionByLeagueId(Convert.ToInt32(cityDropDownList.SelectedItem.Value)).ToList();
             foreach (SelectDivisionByLeagueIdResult result in results)
             {
                 leagueDropDownList.Items.Add(new ListItem(result.Division, result.DivisionId.ToString()));
             }
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             List <SelectLeagueAllResult> selectLeagueAllResults = dataContext.SelectLeagueAll().ToList();
             cityDropDownList.Items.Add(new ListItem(string.Empty, string.Empty));
             foreach (SelectLeagueAllResult result in selectLeagueAllResults)
             {
                 cityDropDownList.Items.Add(new ListItem(result.LeagueCity + ", " + result.LeagueState, result.LeagueId.ToString()));
             }
         }
     }
 }
        protected void Schedule_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "RefreshPreviousMatches")
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    var upcomingMatches = dataContext.GetUpcomingMatches(StoredData.User.UserId);
                    upcomingMatchesRadGrid.DataSource = upcomingMatches;
                    upcomingMatchesRadGrid.Rebind();

                    var previousMatches = dataContext.GetPreviousMatches(StoredData.User.UserId);
                    previousMatchesRadGrid.DataSource = previousMatches;
                    previousMatchesRadGrid.Rebind();
                }
            }
        }
Exemplo n.º 23
0
        protected void postMessageButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(messageTextBox.Text))
            {
                int messageId = Convert.ToInt32(Request.QueryString["MessageId"]);
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    dataContext.InsertMessageReply(messageId, StoredData.User.UserId, messageTextBox.Text);

                    List <SelectRepliesResult> selectReplies = dataContext.SelectReplies(messageId).ToList();
                    messageRepeater.DataSource = selectReplies;
                    messageRepeater.DataBind();

                    List <string> emailIds = new List <string>();
                    if (ViewState["PostOwnerEmail"] != null)
                    {
                        emailIds.Add(ViewState["PostOwnerEmail"].ToString());
                    }
                    foreach (SelectRepliesResult result in selectReplies)
                    {
                        if (result.EmailPost.Value && !emailIds.Contains(result.EmailId))
                        {
                            emailIds.Add(result.EmailId);
                        }
                    }

                    StringBuilder sb      = new StringBuilder();
                    string        subject = string.Empty;
                    if (ViewState["Subject"] != null)
                    {
                        sb.Append(string.Format("Following item was posted by {0} {1} as a reply to {2}", StoredData.User.FirstName, StoredData.User.LastName, ViewState["Subject"].ToString()));
                        subject = "(FlexTennis)" + ViewState["Subject"].ToString();
                    }
                    else
                    {
                        sb.Append("A recent post you have participated in has been updated.");
                        subject = "(FlexTennis) Your post has been updated";
                    }
                    sb.Append("\r\n\r\n-------------------------------------------------\r\n");
                    sb.Append(messageTextBox.Text);

                    messageTextBox.Text = string.Empty;

                    SendEmail(emailIds, sb, subject, StoredData.User.EmailId, StoredData.User.FirstName + " " + StoredData.User.LastName);
                }
            }
        }
Exemplo n.º 24
0
 protected void tennisCourtsRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
 {
     using (FlexibleTennisLeagueDataContext dataContent = new FlexibleTennisLeagueDataContext())
     {
         List <TennisCourt> tennisCourts = new List <TennisCourt>();
         if (citiesDropDownList.SelectedItem.Text == "All Cities")
         {
             tennisCourts = dataContent.SelectTennisCourtsByLeague(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
         }
         else
         {
             tennisCourts = dataContent.SelectTennisCourtByCity(citiesDropDownList.SelectedItem.Text, Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
         }
         tennisCourtsRadGrid.DataSource = tennisCourts;
         //tennisCourtsRadGrid.DataBind();
     }
 }
 protected void mailingListButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             try
             {
                 dataContext.InsertMailingList(mailingListEmailTextBox.Text, cityTextBox.Text);
                 mailingListStatusLabel.Text = "We have received your email address. Thank you.";
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 26
0
 protected void mailingListButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             try
             {
                 dataContext.InsertMailingList(mailingListEmailTextBox.Text, WebConfigurationManager.AppSettings["City"].ToString());
                 mailingListStatusLabel.Text = "We have received your email address. Thank you.";
             }
             catch
             {
             }
         }
     }
 }
Exemplo n.º 27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     textLabel.Text = WebConfigurationManager.AppSettings["TennisCourtGridLabelText"].ToString();
     if (!Page.IsPostBack)
     {
         using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
         {
             List <SelectUniqueTennisCourtCitiesResult> selectUniqueTennisCourtCitiesResults = dataContext.SelectUniqueTennisCourtCities(Convert.ToInt32(WebConfigurationManager.AppSettings["LeagueCityId"])).ToList();
             citiesDropDownList.Items.Add(new ListItem("All Cities", "All Cities"));
             foreach (SelectUniqueTennisCourtCitiesResult result in selectUniqueTennisCourtCitiesResults)
             {
                 citiesDropDownList.Items.Add(new ListItem(result.City, result.City));
             }
             citiesDropDownList.Items[1].Selected = true;
         }
     }
 }
Exemplo n.º 28
0
        private void SendEmail()
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        subject       = "Welcome to FlexibleTennisLeague";

            try
            {
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress("*****@*****.**");
                mailMessage.To.Add(CreateUserWizard1.UserName);
                mailMessage.Bcc.Add(WebConfigurationManager.AppSettings["EmailId"].ToString());
                mailMessage.Subject = subject;

                TextBox firstNameTextBox = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("firstNameTextBox");
                TextBox lastNameTextBox  = (TextBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("lastNameTextBox");

                stringBuilder.Append(string.Format("Dear {0} {1},\r\n\r\n", firstNameTextBox.Text, lastNameTextBox.Text));
                stringBuilder.Append("Thank you for joining the FlexibleTennisLeague. Discover how easy it is to play competitive tennis at your convenience.\r\n");
                stringBuilder.Append("While we set up your account please use your login information below to browse through the site and familiarize yourself with the league's rules.\r\n\r\n");
                stringBuilder.Append(string.Format("User Name: {0}\r\n", CreateUserWizard1.UserName));
                stringBuilder.Append(string.Format("Password: {0}\r\n\r\n", CreateUserWizard1.Password));
                stringBuilder.Append("Once we complete setting up your account, we will send you an email informing you of your account status. This process is usually completed within 12 hours.\r\n");
                stringBuilder.Append("FlexibleTennisLeague takes its customer satisfaction very seriously. If you have any questions, comments or suggestions please email us at: [email protected] or [email protected].\r\n\r\n");
                stringBuilder.Append("In order to ensure the timely delivery of emails regarding your tennis matches or scores please add [email protected] to your list of known senders.\r\n\r\n");
                stringBuilder.Append("Thank you for signing up with FlexibleTennisLeague\r\n");
                stringBuilder.Append("Administrator -- FlexibleTennisLeague.");


                mailMessage.Body = Server.HtmlEncode(stringBuilder.ToString());

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Send(mailMessage);
            }
            catch (Exception exception)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    int?id = null;
                    dataContext.InsertEmailError(StoredData.User.UserId, CreateUserWizard1.UserName, CreateUserWizard1.UserName, subject, stringBuilder.ToString(), exception.Message + "\r\n\r\n" + exception.StackTrace, ref id);
                }
            }
        }
Exemplo n.º 29
0
        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);
                    }
                }
            }
        }
Exemplo n.º 30
0
        private void SendEmail(string opponentEmailId, string winner, string score)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        subject       = "Score posted on FlexibleTennisLeague";

            try
            {
                MailMessage mailMessage = new MailMessage();

                mailMessage.From = new MailAddress("*****@*****.**");
                mailMessage.To.Add(opponentEmailId);
                mailMessage.CC.Add(StoredData.User.EmailId);
                mailMessage.Bcc.Add(WebConfigurationManager.AppSettings["EmailId"].ToString());
                mailMessage.Subject = subject;

                stringBuilder.Append(string.Format("Dear {0},\r\n\r\n", opponentDropDownList.SelectedItem.Text));
                stringBuilder.Append(string.Format("The following score for your recent match against {0} {1} at {2} has been posted on {3} {4}\r\n\r\n", StoredData.User.FirstName, StoredData.User.LastName, locationDropDownList.SelectedItem.Text, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString()));
                stringBuilder.Append(string.Format("Winner : {0}\r\n", winner));
                stringBuilder.Append(string.Format("Score : {0}\r\n", score));
                stringBuilder.Append(string.Format("Was no show : {0}\r\n\r\n", noShowCheckBox.Checked.ToString()));
                stringBuilder.Append("Please login to the FlexibleTennisLeague.com to rate your game and your opponent's game.\r\n");
                stringBuilder.Append("Please email incorrect scores and other complaints/suggestions to [email protected].\r\n\r\n");
                stringBuilder.Append("Thank you for choosing FlexibleTennisLeague.\r\n");
                stringBuilder.Append("Administrator -- FlexibleTennisLeague.");

                mailMessage.Body = Server.HtmlEncode(stringBuilder.ToString());

                SmtpClient smtpClient = new SmtpClient();
                smtpClient.Send(mailMessage);
            }
            catch (Exception exception)
            {
                using (FlexibleTennisLeagueDataContext dataContext = new FlexibleTennisLeagueDataContext())
                {
                    int?id = null;
                    dataContext.InsertEmailError(StoredData.User.UserId, opponentEmailId, StoredData.User.EmailId, subject, stringBuilder.ToString(), exception.Message + "\r\n\r\n" + exception.StackTrace, ref id);
                }
            }
        }