Example #1
0
 private void FindButton_Click(object sender, RoutedEventArgs e) //Finds the competitor in the SkiRun class.
 {
     NameTextBox.Clear();                                        //Clears the name text box.
     AddressTextBox.Clear();                                     //Clears the address text box.
     ScoreTextBox.Clear();                                       //Clears the score text box.
     TagTextBox.Clear();                                         //Clears the tag text box.
     FindCompetitor();                                           //Calls the FindCompetitor method above.
 }
Example #2
0
        public void AddShareSkillDetails(ShareSkillDetails skillObj)
        {
            //Enter Title data from Excel
            driver.WaitForElementIsVisible(TitleTextBox);
            TitleTextBox.SendKeys(skillObj.Title);

            //Enter Description data from Excel
            DescriptionTextBox.SendKeys(skillObj.Description);

            //Select Category based on Excel data
            driver.WaitForElementIsVisible(CategoryDropDown);
            SelectElement categorySelect = new SelectElement(CategoryDropDown);

            categorySelect.SelectByText(skillObj.Category);

            //Select Subcategory based on Excel data
            SelectElement subCategorySelect = new SelectElement(SubCategoryDropDown);

            subCategorySelect.SelectByText(skillObj.SubCategory);

            //Enter Text in Tag and perform keyboard action "Enter"
            TagTextBox.SendKeys(skillObj.Tags + Keys.Enter);

            //Select Service Type based on Excel data
            SelectRadioButton(ServiceType, ServiceTypeLabel, skillObj.ServiceType);

            //Select Location Type based on Excel data
            SelectRadioButton(LocationType, LocationTypeLabel, skillObj.LocationType);

            //Enter Startdate based on Excel data
            StartDate.SendKeys(skillObj.StartDate);

            //Enter Enddate based on Excel data
            EndDate.SendKeys(skillObj.EndDate);

            //Select days based on excel data and enter start and end time
            SelectAvailableDays(skillObj.SelectDay, skillObj.StartTime, skillObj.EndTime);

            //Select SkillTrade based on Excel data
            SelectRadioButton(SkillTrade, SkillTradeLabel, skillObj.SkillTrade);

            //Enter Text in Tag and perform keyboard action "Enter"
            SkillExchange.SendKeys(skillObj.SkillExchange + Keys.Enter);

            //Click WorkSample and upload the file through AutoIT
            driver.WaitForElementIsVisible(WorkSamples);
            WorkSamples.Click();
            UploadFileByAutoIT();

            //Select Active/Hidden based on Excel data
            SelectRadioButton(Active, ActiveLabel, skillObj.Active);

            //Save ShareSkill data
            SaveButton.Click();
        }
Example #3
0
 private void ClearData_Click(object sender, RoutedEventArgs e)
 {
     activeSkiRun.ClearCompData();             //Calls a method in the SkiRun class which empties the dictionary and the lists.
     IncomeTextBox.Clear();                    //Clears the income textbox.
     TotalScoresTextBox.Clear();               //Clears the total scores text box.
     EntriesTextBox.Clear();                   //Clears the ammount of entries the competiton had.
     TopThreeScoresTextBox.Clear();            //Clears the high scores text box so data doesn't overlap.
     AgeMinTextBox.Clear();                    //Clears the minimum age textbox.
     AgeMaxTextBox.Clear();                    //Clears the maximum age textbox.
     AgeAveTextBox.Clear();                    //Clears the average age textbox.
     AgeModeTextBox.Clear();                   //Clears the mode age textbox.
     activeSkiRun.CompetitorAges.Clear();      //Clears the ages list.
     CompetitorNumberTextBox.Text = "000000";  //Resets the competitor number text box.
     NumberTextBox.Clear();                    //Clears the number text box.
     NameTextBox.Clear();                      //Clears the name text box.
     AddressTextBox.Clear();                   //Clears the address text box.
     DetailsTextBox.Clear();                   //Clears the details text box.
     ScoreTextBox.Clear();                     //Clears the scores text box.
     SearchTextBox.Clear();                    //Clears the seach by name text box.
     TagTextBox.Clear();                       //Clears the tag text box.
     SearchByName.Items.Clear();               //Clears the search by name combo box.
 }
Example #4
0
 private void AddTagClicked(object sender, RoutedEventArgs e)
 {
     TagTextBox.GetBindingExpression(AutoSuggestBox.TextProperty).UpdateSource();
 }
Example #5
0
        private void FindCompetitor()                                                                  //Set up to find the competitors by their number.
        {
            DetailsTextBox.Clear();                                                                    //Clears the details textbox.
            Competitor editSkier;                                                                      //Makes aninstance of the Competitor class.

            if (SearchTextBox.Text.Trim() != "" && NumberTextBox.Text.Trim() != "")                    //You can only use on search method so if there is text in both it will be rejected.
            {
                MessageBox.Show("Please use only one search method!");                                 //The error message.
            }
            else if (SearchByName.Text.Trim() == "" && NumberTextBox.Text.Trim() == "")                //If there is no text in either search methods then the search will fail.
            {
                editSkier = null;                                                                      //There's no competitor.
                MessageBox.Show("There is no competitor with that number or name! Please try again."); //The error message.
                NameTextBox.Clear();                                                                   //Clears the name text box.
                AddressTextBox.Clear();                                                                //Clears the address text box.
                ScoreTextBox.Clear();                                                                  //Clears the score text box.
                NumberTextBox.Clear();                                                                 //Clears number text box.
                TagTextBox.Clear();                                                                    //Clears the tag text box.
            }

            //***NOTE*** - This is a very inefficient way to seach. I have the same code twice for each search method because I didn't know how to differentiate between the two.

            else if (SearchByName.Text.Trim() != "")                          //If search by name has some text in it then it will make a competitor.
            {
                editSkier = SkiRun.FindSkierByName(SearchByName.Text.Trim()); //Calls the find competitor by name in the SkiRun class.
                try
                {
                    NameTextBox.Text    = editSkier.GetName().Trim();                                                                                                                                                                                                                                    //Sets the competitor name.
                    AddressTextBox.Text = editSkier.GetAddress().Trim();                                                                                                                                                                                                                                 //Sets the competitor address.
                    ScoreTextBox.Text   = editSkier.GetScore().Trim();                                                                                                                                                                                                                                   //Sets the competitor score.

                    if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null)                                                                                                                                                                                    //If there's no sponsor, no blood type and no next of kin then it must be an amateur.
                    {
                        DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100";                                                                                                                                   //Information show in details text box.
                        TagTextBox.Text     = "Amateur";                                                                                                                                                                                                                                                 //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetSponsor() != null)                                                                                                                                                                                                                                             //If the sponsor does no equal null then it must be a professional.
                    {
                        DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor();                                                                 //Information show in details text box.
                        TagTextBox.Text     = "Professional";                                                                                                                                                                                                                                            //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetBlood() != null)                                                                                                                                                                                                                                               //If blood type does not equal null then is must be a celebrity.
                    {
                        DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box.
                        TagTextBox.Text     = "Celebrity";                                                                                                                                                                                                                                               //Displays the tag in the tag text box.
                    }
                }
                catch
                {
                    MessageBox.Show("Could not find competitor!");  //If the user types a name it cannot find then it will display this.
                }
            }
            else if (NumberTextBox.Text.Trim() != "")                    //If the number text box has something in it then it will use this method.
            {
                editSkier = SkiRun.FindSkier(NumberTextBox.Text.Trim()); //Calls the find competitor in the SkiRun class.
                try
                {
                    NameTextBox.Text    = editSkier.GetName();                                                                                                                                                                                                                                           //Sets the competitor name.
                    AddressTextBox.Text = editSkier.GetAddress();                                                                                                                                                                                                                                        //Sets the competitor address.
                    ScoreTextBox.Text   = editSkier.GetScore();                                                                                                                                                                                                                                          //Sets the competitor score.

                    if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null)                                                                                                                                                                                    //If there's no sponsor, no blood type and no next of kin then it must be an amateur.
                    {
                        DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100";                                                                                                                                   //Information show in details text box.
                        TagTextBox.Text     = "Amateur";                                                                                                                                                                                                                                                 //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetSponsor() != null)                                                                                                                                                                                                                                             //If the sponsor does no equal null then it must be a professional.
                    {
                        DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor();                                                                 //Information show in details text box.
                        TagTextBox.Text     = "Professional";                                                                                                                                                                                                                                            //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetBlood() != null)                                                                                                                                                                                                                                               //If blood type does not equal null then is must be a celebrity.
                    {
                        DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box.
                        TagTextBox.Text     = "Celebrity";                                                                                                                                                                                                                                               //Displays the tag in the tag text box.
                    }
                }
                catch
                {
                    MessageBox.Show("Could not find competitor!");  //If the user types a name it cannot find then it will display this.
                }
            }
            //NumberTextBox.Clear();
            //SearchByName.Items.Clear();
            //SearchTextBox.Clear();
        }