/// <summary> /// Event Handler for btnGetDGradeStudents button /// that gets all D grade students /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnGetDGradeStudents_Click(object sender, EventArgs e) { //Call the GetDGradeStudents() method string names = XmlDataHandler.GetDGradeStudents(Strings.StudentFilePath); txtResult.Text = names; }
/// <summary>The main.</summary> private static void Main() { Console.WriteLine("Football Tester\n"); var random = new Random(DateTime.Now.Millisecond * DateTime.Now.Day); var teams = XmlDataHandler.LoadTeams("BaseTeams.xml"); var league = new League("Premiership", teams); var matchDays = FixtureGenerator.GenerateFixtures(teams, true, random); foreach (var matchDay in matchDays) { // League table before matchday Console.WriteLine(league); Console.ReadKey(); Console.Clear(); // Matchday fixtures Console.WriteLine(matchDay); PlayMatchDay(matchDay); Console.ReadKey(); Console.Clear(); //// Matchday results Console.WriteLine(matchDay); Console.ReadKey(); Console.Clear(); } // final league table Console.WriteLine(league); Console.ReadKey(); Console.Clear(); }
/// <summary> /// Event Handler for btnTotalNodes button /// that counts the number of child nodes in root /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnTotalNodes_Click(object sender, EventArgs e) { //Call the TotalNodes() method to count the child nodes int result = XmlDataHandler.TotalNodes(Strings.FilePath); txtResult.Text = result.ToString(); }
/// <summary> /// Event Handler for btnChildNode button /// that counts the number of child nodes in root /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnChildNode_Click(object sender, EventArgs e) { //Call the ChildNode() method to count the child nodes string result = XmlDataHandler.ChildNode(Strings.FilePath); txtResult.Text = result.ToString(); }
public void XmlDataHandler_GetSecuredData_EmptySecuredProps_NonChangedResult() { //ARRANGE AbstractDataHandler handler = new XmlDataHandler(); handler.Properties = new string[] { }; //ACT var result = handler.GetSecuredData("<auth user=\"max\"><pass>123456</pass></auth>"); //ASSERT Assert.AreEqual("<auth user=\"max\"><pass>123456</pass></auth>", result); }
public void XmlDataHandler_GetSecuredData_SomePropsNotInRequest_ListedParametresSecured() { //ARRANGE AbstractDataHandler handler = new XmlDataHandler(); handler.Properties = new string[] { "user", "first_name" }; //ACT var result = handler.GetSecuredData("<auth user=\"max\"><pass>123456</pass></auth>"); //ASSERT Assert.AreEqual("<auth user=\"XXX\"><pass>123456</pass></auth>", result); }
public void XmlDataHandler_GetSecuredData_SecuredPropsNotInRequest_NonChangedResult() { //ARRANGE AbstractDataHandler handler = new XmlDataHandler(); handler.Properties = new string[] { "first_name", "second_name" }; //ACT var result = handler.GetSecuredData("<auth user=\"max\"><pass>123456</pass></auth>"); //ASSERT Assert.AreEqual("<auth user=\"max\"><pass>123456</pass></auth>", result); }
public void XmlDataHandler_GetSecuredData_NonEmptySecuredProps_ParametresSecured() { //ARRANGE AbstractDataHandler handler = new XmlDataHandler(); handler.Properties = new string[] { "user", "pass" }; //ACT var result = handler.GetSecuredData("<auth user=\"max\"><pass>123456</pass></auth>"); //ASSERT Assert.AreEqual("<auth user=\"XXX\"><pass>XXXXXX</pass></auth>", result); }
/// <summary> /// Event Handler for btnRemoveNode button /// that removes Assignment node /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnRemoveNode_Click(object sender, EventArgs e) { //Call the RemoveNode() method to remove the node bool result = XmlDataHandler.RemoveNode(Strings.FilePath); //check the result if (result) { txtResult.Text = Strings.RemoveNodeSuccess; } else { txtResult.Text = Strings.RemoveNodeFailed; } }
/// <summary> /// Event Handler for btnInsertBefore button /// that adds a new node Testing before Training node /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnInsertBefore_Click(object sender, EventArgs e) { //Call the InsertBefore() method to insert the node into the xml bool result = XmlDataHandler.InsertBefore(Strings.FilePath); //check the result if (result) { txtResult.Text = Strings.InsertBeforeSuccees; } else { txtResult.Text = Strings.InsertBeforeFailed; } }
/// <summary> /// Event Handler for btnAddNode button to add a new node in XML file /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnAddNode_Click(object sender, EventArgs e) { //Call AddNewNode() method to add new node bool result = XmlDataHandler.AddNewNode(Strings.FilePath); //Check the returned result if (result) { //if success txtResult.Text = Strings.NodeAddSuccess; } else { //if failure txtResult.Text = Strings.NodeAddSuccess; } }
/// <summary> /// Event Handler for btnFirstChild button that displays first child in root node /// </summary> /// <param name="sender">Object on which event has occured</param> /// <param name="e">Args for event</param> protected void btnFirstChild_Click(object sender, EventArgs e) { // Call GetFirstChild() method of XmlDataHandler class // to get first childof the root string result = XmlDataHandler.GetFirstChild(Strings.FilePath); // Check the result if (result == null) { // if null received txtResult.Text = Strings.NoChildNodeFound; } else { // if data received txtResult.Text = result; } }
protected void btnLoadAndSaveXML_Click(object sender, EventArgs e) { if (fileUploadXML.HasFile) { //Call LoadStudentsFromXMLFile() method bool result = XmlDataHandler.LoadStudentsFromXMLFile(Strings.StudentFilePath); //check the result if (result) { txtResult.Text = Strings.SaveStudentsSuccess; } else { txtResult.Text = Strings.SaveStudentsFailed; } } else { txtResult.Text = Strings.NoFileFound; } }
public override void Save() { InternalDataToXml(); XmlDataHandler.SaveDataToFile(xmlPath, ref xData); }
public override void Refresh() { XmlDataHandler.LoadDataFromFile(xmlPath, ref xData); XmlToInternalData(); }