Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
Appended where not to.
Unlinked 4th page
  • Loading branch information
PockyG committed May 2, 2019
1 parent 28321c9 commit f6bf017
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
7 changes: 2 additions & 5 deletions ATO STP System/Helpers/TestXml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static XmlSerializerNamespaces XmlSerializerNamespaces
public static class XmlSerializationHelper
{
public static string outputFileName = "defaultxml";
public static bool appendOver = false;

public static string GetXml<T>(this T obj)
{
Expand Down Expand Up @@ -118,13 +119,9 @@ public static string GetXml<T>(T obj, XmlSerializer serializer, XmlSerializerNam


var fname = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, outputFileName);
var appendMode = false;
var appendMode = appendOver;
var encoding = Encoding.UTF8;

if (obj.GetType() == typeof(PAYEVNTEMP))
{
appendMode = true;
}

using (var streamWriter = new StreamWriter(fname, appendMode , encoding))
{
Expand Down
3 changes: 2 additions & 1 deletion ATO STP System/Pages/Page1.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ private void Next_Button(object sender, RoutedEventArgs e)

//Writes the xml to a file with filename. by default should appear in bin / Debug or bin/ Release folder.
//USE THE EXTENSION.
XmlSerializationHelper.appendOver = false;
XmlSerializationHelper.outputFileName = payevntFile;
var xml = XmlSerializationHelper.GetXml(testPAYEVNT, NameSpaces.XmlSerializerNamespaces);
Console.WriteLine(xml);
Expand Down Expand Up @@ -163,7 +164,7 @@ private void Next_Button(object sender, RoutedEventArgs e)
}
else
{
string messageBoxTextError = "";

MessageBoxResult result = MessageBox.Show(GetErrorList(payevntFile), "error");
}

Expand Down
9 changes: 3 additions & 6 deletions ATO STP System/Pages/Page2.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ private void Next_Button(object sender, RoutedEventArgs e)
testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.UnusedAnnualOrLongServiceLeavePayment = null;
//Writes the xml to a file with filename. by default should appear in bin / Debug or bin/ Release folder.
//USE THE EXTENSION.

XmlSerializationHelper.appendOver = false;
XmlSerializationHelper.outputFileName = payevntFile;

var empxml = XmlSerializationHelper.GetXml(testPAYEVNTEMP, NameSpaces.XmlSerializerNamespaces);
Expand Down Expand Up @@ -194,12 +196,7 @@ private void Next_Button(object sender, RoutedEventArgs e)






XmlSerializationHelper.outputFileName = "ATOPAYLOAD.xml";
var xml = XmlSerializationHelper.GetXml(testPAYEVNTEMP, NameSpaces.XmlSerializerNamespaces);
Console.WriteLine(xml);


//Validate();

Expand Down
4 changes: 2 additions & 2 deletions ATO STP System/Pages/Page3.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
Title="Page3">

<Grid>
<TextBlock x:Name="contentBlock" Margin="120,94,120,53" TextWrapping="Wrap" TextAlignment="Center" FontSize="18"/>
<TextBlock x:Name="contentBlock" Margin="120,94,120,33" TextWrapping="Wrap" TextAlignment="Center" FontSize="18"/>
<Label x:Name="label" Content="Summary" Margin="320,30,320,0" VerticalAlignment="Top" Height="59" FontSize="36"/>
<Button Content="Next" MinWidth="100" HorizontalAlignment="Right" Click="Next_Button" Margin="0,664,690,0" Height="35" VerticalAlignment="Top"/>
<Button Content="Submit" MinWidth="100" HorizontalAlignment="Right" Click="Next_Button" Margin="0,664,690,0" Height="35" VerticalAlignment="Top"/>
</Grid>
</Page>
14 changes: 9 additions & 5 deletions ATO STP System/Pages/Page3.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public partial class Page3 : Page
Uri _page1 = new Uri("Pages/Page1.xaml", UriKind.Relative);
Uri _page2 = new Uri("Pages/Page2.xaml", UriKind.Relative);
Uri _page3 = new Uri("Pages/Page3.xaml", UriKind.Relative);
Uri _page4 = new Uri("Pages/Page4.xaml", UriKind.Relative);
//Uri _page4 = new Uri("Pages/Page4.xaml", UriKind.Relative);


Employer readEmployer;
Expand Down Expand Up @@ -82,12 +82,16 @@ public Page3()

private void Next_Button(object sender, RoutedEventArgs e)
{
navigatePages();

XmlSerializationHelper.appendOver = false;
XmlSerializationHelper.outputFileName = "ATOPAYLOAD.xml";
XmlSerializationHelper.GetXml(MainWindow.testPAYEVNT, NameSpaces.XmlSerializerNamespaces);

XmlSerializationHelper.appendOver = true;
XmlSerializationHelper.GetXml(MainWindow.testPAYEVNTEMP, NameSpaces.XmlSerializerNamespaces);


System.Windows.Application.Current.Shutdown();
}


Expand All @@ -109,9 +113,9 @@ public void navigatePages()
case "Pages/Page2.xaml":
newUri = _page3;
break;
case "Pages/Page3.xaml":
newUri = _page4;
break;
//case "Pages/Page3.xaml":
// newUri = _page4;
// break;
default:
newUri = _page1;
break;
Expand Down

0 comments on commit f6bf017

Please sign in to comment.