public static void Test() { var curpit11 = new EPIT11V21(10101); var xml = XmlSerializationHelper.GetXml(curpit11, NameSpaces.XmlSerializerNamespaces); Debug.WriteLine(xml); }
public static string CreateGroupXML(List <String> ProfilesList) { var group = new ProfilesGroup(); group.ProfilesList = ProfilesList; return(XmlSerializationHelper.GetXml(group)); }
public static void Test() { var derived = new DerivedClass { Id = 1, NoParameterlessConstructor = new NoParameterlessConstructor("Test") }; var xml = XmlSerializationHelper.GetXml(derived, DerivedClass.DerivedClassXmlSerializer); Debug.WriteLine(xml); }
private void Next_Button(object sender, RoutedEventArgs e) { 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(); }
public async Task <decimal?> GetQuoteAsync(Shipment shipment) { var requestData = shipment.ToRequestData(); var url = _urlProvider.GetVendorUrlByName("Vendor3"); var body = XmlSerializationHelper.GetXml(requestData); var content = new StringContent(body); content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/xml"); var response = await _apiService.PostAsync(url, content, GetAuthorizationHeaderValue()); return(ParseResponse(response)); }
public void WhenSerialized_ObjectContainsProperElements() { var requestData = new RequestData { source = "s", destination = "d", packages = new List <decimal> { 1 } }; var xml = XmlSerializationHelper.GetXml(requestData); Assert.Contains("<source>", xml); Assert.Contains("<destination>", xml); Assert.Contains("<packages>", xml); Assert.Contains("<package>", xml); }
public static void Test() { var test = new TestConfiguration(); Debug.WriteLine("\nTesting Xmlserializer..."); var xml = XmlSerializationHelper.GetXml(test); using (new SetValue <bool>(TestConfiguration.ShowDebugInformation, true)) { var testFromXml = XmlSerializationHelper.LoadFromXML <TestConfiguration>(xml); Debug.WriteLine("XmlSerializer result: " + testFromXml.ToString()); } Debug.WriteLine("\nTesting Json.NET..."); var json = JsonConvert.SerializeObject(test, Formatting.Indented); using (new SetValue <bool>(TestConfiguration.ShowDebugInformation, true)) { var testFromJson = JsonConvert.DeserializeObject <TestConfiguration>(json); Debug.WriteLine("Json.NET result: " + testFromJson.ToString()); } Debug.WriteLine("\nTesting DataContractSerializer..."); var contractXml = DataContractSerializerHelper.GetXml(test); using (new SetValue <bool>(TestConfiguration.ShowDebugInformation, true)) { var testFromContractXml = DataContractSerializerHelper.LoadFromXML <TestConfiguration>(contractXml); Debug.WriteLine("DataContractSerializer result: " + testFromContractXml.ToString()); } Debug.WriteLine("\nTesting BinaryFormatter..."); var binary = BinaryFormatterHelper.ToBase64String(test); using (new SetValue <bool>(TestConfiguration.ShowDebugInformation, true)) { var testFromBinary = BinaryFormatterHelper.FromBase64String <TestConfiguration>(binary); Debug.WriteLine("BinaryFormatter result: " + testFromBinary.ToString()); } Debug.WriteLine("\nTesting JavaScriptSerializer..."); var javaScript = new JavaScriptSerializer().Serialize(test); using (new SetValue <bool>(TestConfiguration.ShowDebugInformation, true)) { var testFromJavaScript = new JavaScriptSerializer().Deserialize <TestConfiguration>(javaScript); Debug.WriteLine("JavaScriptSerializer result: " + testFromJavaScript.ToString()); } }
private void Next_Button(object sender, RoutedEventArgs e) { bool startDateOkay = false; bool endDateOkay = false; if (dateStartYear.SelectedDate != null) { startDateOkay = true; } if (dateEndYear.SelectedDate != null) { endDateOkay = true; } if ( textName.Text != "" && textLegalName.Text != "" && textABN.Text != "" && textBusinessDescription.Text != "" && startDateOkay && endDateOkay && textEmail.Text != "" && textAddress.Text != "" && textPostCode.Text != "" ) { testPAYEVNT = new PAYEVNT(); testPAYEVNT.Rp.SoftwareInformationBusinessManagementSystemId = "08136164-0685-4c6c-8697-6b9003b5b57a"; testPAYEVNT.Rp.AustralianBusinessNumberId = textABN.Text; testPAYEVNT.Rp.OrganisationDetailsOrganisationBranchC = "100"; testPAYEVNT.Rp.OrganisationName.DetailsOrganisationalNameT = textName.Text; testPAYEVNT.Rp.OrganisationName.PersonUnstructuredNameFullNameT = textLegalName.Text; testPAYEVNT.Rp.ElectronicContact.ElectronicMailAddressT = textEmail.Text; testPAYEVNT.Rp.ElectronicContact.TelephoneMinimalN = "12 34567890"; testPAYEVNT.Rp.AddressDetailsPostal.Line1T = textAddress.Text; testPAYEVNT.Rp.AddressDetailsPostal.LocalityNameT = "Melbourne"; testPAYEVNT.Rp.AddressDetailsPostal.StateOrTerritoryC = "VIC"; testPAYEVNT.Rp.AddressDetailsPostal.PostcodeT = textPostCode.Text; testPAYEVNT.Rp.AddressDetailsPostal.CountryC = "au"; testPAYEVNT.Rp.Payroll.ProxyPaymentRecordTransactionD = new DateTime(2000, 5, 5); testPAYEVNT.Rp.Payroll.InteractionRecordCt = 10; testPAYEVNT.Rp.Payroll.MessageTimestampGenerationDt = new DateTime(2000, 5, 5); testPAYEVNT.Rp.Payroll.InteractionTransactionId = "BULK008"; testPAYEVNT.Rp.Payroll.AmendmentI = false; //the M changes it to a decimal type testPAYEVNT.Rp.Payroll.IncomeTaxAndRemuneration.PayAsYouGoWithholdingTaxWithheldA = 324188.31M; testPAYEVNT.Rp.Payroll.IncomeTaxAndRemuneration.TotalGrossPaymentsWithholdingA = 17821.87M; testPAYEVNT.Rp.Declaration.SignatoryIdentifierT = "jassmith"; testPAYEVNT.Rp.Declaration.ProxyDateSignatureD = new DateTime(2000, 5, 5); testPAYEVNT.Rp.Declaration.StatementAcceptedI = true; //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); if (Validate(payevntFile)) { Employer employer = new Employer() { orgName = textName.Text, empName = textLegalName.Text, abnNumber = textABN.Text, businessDescription = textBusinessDescription.Text, contactEmail = textEmail.Text, startYear = dateStartYear.SelectedDate.Value.Date, endYear = dateEndYear.SelectedDate.Value.Date, address = textAddress.Text, postcode = textPostCode.Text }; using (SQLiteConnection connection = new SQLiteConnection(DatabaseHelpers.employerDB)) { connection.DropTable <Employer>(); connection.CreateTable <Employer>(); connection.Insert(employer); } MainWindow.testPAYEVNT = testPAYEVNT; navigatePages(); } else { MessageBoxResult result = MessageBox.Show(GetErrorList(payevntFile), "error"); } } else { string messageBoxTextError = "Please fill all fields in before continuing"; MessageBoxResult result = MessageBox.Show(messageBoxTextError, "error"); } /*testPAYEVNT.Rp.OrganisationName.DetailsOrganisationalNameT = textName.Text; * testPAYEVNT.Rp.OrganisationName.PersonUnstructuredNameFullNameT = textLegalName.Text; * testPAYEVNT.Rp.AustralianBusinessNumberId = textABN.Text; * testPAYEVNT.Rp.ElectronicContact.ElectronicMailAddressT = textEmail.Text; * testPAYEVNT.Rp.AddressDetailsPostal.Line1T = textAddress.Text; * testPAYEVNT.Rp.AddressDetailsPostal.PostcodeT = textPostCode.Text; * * XmlSerializationHelper.outputFileName = "ATOPAYLOAD.xml"; * var xml = XmlSerializationHelper.GetXml(testPAYEVNT, NameSpaces.XmlSerializerNamespaces); * Console.WriteLine(xml); * */ }
private void Next_Button(object sender, RoutedEventArgs e) { bool payFromOkay = false; bool payToOkay = false; decimal grossNum; decimal taxNum; decimal superNum; bool grossCheck = false; bool taxCheck = false; bool superCheck = false; if (payStart.SelectedDate != null) { payFromOkay = true; } if (payEnd.SelectedDate != null) { payToOkay = true; } if (decimal.TryParse(grossAmount.Text, out grossNum)) { grossCheck = true; } if (decimal.TryParse(taxWithheld.Text, out taxNum)) { taxCheck = true; } if (decimal.TryParse(superContributions.Text, out superNum)) { superCheck = true; } if ( firstName.Text != "" && lastName.Text != "" && DOBday.Text != "" && DOBmonth.Text != "" && DOByear.Text != "" && payToOkay && payFromOkay && address.Text != "" && postcode.Text != "" && grossCheck && taxCheck && superCheck ) { testPAYEVNTEMP = new PAYEVNTEMP(); testPAYEVNTEMP.Payee.AddressDetails.Line1T = address.Text; testPAYEVNTEMP.Payee.AddressDetails.Line2T = "wwo"; testPAYEVNTEMP.Payee.AddressDetails.LocalityNameT = "fmak"; testPAYEVNTEMP.Payee.AddressDetails.PostcodeT = postcode.Text; testPAYEVNTEMP.Payee.AddressDetails.StateOrTerritoryC = "VIC"; testPAYEVNTEMP.Payee.ElectronicContact.ElectronicMailAddressT = "*****@*****.**"; testPAYEVNTEMP.Payee.ElectronicContact.TelephoneMinimalN = "10101"; testPAYEVNTEMP.Payee.EmployerConditions.ProxyDateEmploymentEndD = new DateTime(1999, 10, 10); testPAYEVNTEMP.Payee.EmployerConditions.ProxyDateEmploymentStartD = new DateTime(1999, 10, 11); testPAYEVNTEMP.Payee.Identifiers.AustralianBusinessNumberId = "67094544519"; testPAYEVNTEMP.Payee.Identifiers.EmploymentPayrollNumberId = "yea"; testPAYEVNTEMP.Payee.Identifiers.TaxFileNumberId = "151994243"; testPAYEVNTEMP.Payee.Onboarding.Declaration.SignatoryIdentifierT = "fawoiafwoiafw"; testPAYEVNTEMP.Payee.Onboarding.Declaration.ProxyDateSignatureD = new DateTime(1999, 10, 10); testPAYEVNTEMP.Payee.Onboarding.Declaration.StatementAcceptedI = true; testPAYEVNTEMP.Payee.Onboarding = null; testPAYEVNTEMP.Payee.PersonDemographicDetails.BirthDm = int.Parse(DOBday.Text); testPAYEVNTEMP.Payee.PersonDemographicDetails.BirthM = int.Parse(DOBmonth.Text); testPAYEVNTEMP.Payee.PersonDemographicDetails.BirthY = int.Parse(DOByear.Text); testPAYEVNTEMP.Payee.PersonNameDetails.FamilyNameT = lastName.Text; testPAYEVNTEMP.Payee.PersonNameDetails.GivenNameT = firstName.Text; testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.PayrollPeriod.ProxyDateStartD = payStart.SelectedDate.Value.Date; testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.PayrollPeriod.ProxyDateEndD = payEnd.SelectedDate.Value.Date; testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.PayrollPeriod.PayrollEventFinalI = false; testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.IndividualNonBusiness.GrossA = decimal.Parse(grossAmount.Text); testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.IndividualNonBusiness.TaxWithheldA = decimal.Parse(taxWithheld.Text); testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.DeductionCollection = new ATO_STP_System.Helpers.DeductionCollection(); testPAYEVNTEMP.Payee.RemunerationIncomeTaxPayAsYouGoWithholding.SuperannuationContribution.EmployerContributionsSuperannuationGuaranteeA = decimal.Parse(superContributions.Text); 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); Console.WriteLine(empxml); if (Validate(payevntFile)) { Employee employee = new Employee() { firstName = firstName.Text, lastName = lastName.Text, dobDay = int.Parse(DOBday.Text), dobMonth = int.Parse(DOBmonth.Text), dobYear = int.Parse(DOByear.Text), address = address.Text, postcode = postcode.Text, payFrom = payStart.SelectedDate.Value.Date, payTo = payEnd.SelectedDate.Value.Date, grossAmount = decimal.Parse(grossAmount.Text), taxWithheld = decimal.Parse(taxWithheld.Text), superContribution = decimal.Parse(superContributions.Text), }; using (SQLiteConnection connection = new SQLiteConnection(DatabaseHelpers.employeeDB)) { connection.DropTable <Employee>(); connection.CreateTable <Employee>(); connection.Insert(employee); } MainWindow.testPAYEVNTEMP = testPAYEVNTEMP; navigatePages(); } else { string messageBoxTextError = ""; MessageBoxResult result = MessageBox.Show(GetErrorList(payevntFile), "error"); } } else { MessageBoxResult result = MessageBox.Show("Please fill all fields in before continuing", "error"); } //Validate(); }