protected override void deserialize(PowerPlannerSending.BaseItem item, List <PropertyNames> changedProperties) { Teacher from = item as Teacher; if (changedProperties != null) { if (!EmailAddresses.SequenceEqual(from.EmailAddresses)) { changedProperties.Add(BaseItemWin.PropertyNames.EmailAddresses); } if (!OfficeLocations.SequenceEqual(from.OfficeLocations)) { changedProperties.Add(BaseItemWin.PropertyNames.OfficeLocations); } if (!PhoneNumbers.SequenceEqual(from.PhoneNumbers)) { changedProperties.Add(BaseItemWin.PropertyNames.PhoneNumbers); } if (!PostalAddresses.SequenceEqual(from.PostalAddresses)) { changedProperties.Add(BaseItemWin.PropertyNames.PostalAddresses); } } this.EmailAddresses = from.EmailAddresses; this.OfficeLocations = from.OfficeLocations; this.PhoneNumbers = from.PhoneNumbers; this.PostalAddresses = from.PostalAddresses; //guaranteed that upper temp and perm will be -1 base.deserialize(from, changedProperties); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Identification != null) { hashCode = hashCode * 59 + Identification.GetHashCode(); } if (PostalAddresses != null) { hashCode = hashCode * 59 + PostalAddresses.GetHashCode(); } if (Availability != null) { hashCode = hashCode * 59 + Availability.GetHashCode(); } if (Phones != null) { hashCode = hashCode * 59 + Phones.GetHashCode(); } if (Services != null) { hashCode = hashCode * 59 + Services.GetHashCode(); } return(hashCode); } }
public void Edit() { var country = new Countries(this.Session).FindBy(M.Country.IsoCode, "NL"); var person = new People(this.Session).Extent().First; var before = new PostalAddresses(this.Session).Extent().ToArray(); this.people.Table.DefaultAction(person); var personOverview = new PersonOverviewComponent(this.people.Driver); var panelComponent = personOverview.ContactmechanismOverviewPanel.Click(); var row = panelComponent.Table.FindRow(this.editContactMechanism); var cell = row.FindCell("contact"); cell.Click(); var postalAddressEditComponent = new PostalAddressEditComponent(this.Driver); postalAddressEditComponent.Address1.Set("addressline 1") .Address2.Set("addressline 2") .Address3.Set("addressline 3") .Locality.Set("city") .PostalCode.Set("postalcode") .Country.Select(country) .Description.Set("description") .SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new PostalAddresses(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length); Assert.Equal("addressline 1", this.editContactMechanism.Address1); Assert.Equal("addressline 2", this.editContactMechanism.Address2); Assert.Equal("addressline 3", this.editContactMechanism.Address3); Assert.Equal("addressline 1", this.editContactMechanism.Address1); Assert.Equal("city", this.editContactMechanism.Locality); Assert.Equal("postalcode", this.editContactMechanism.PostalCode); Assert.Equal(country, this.editContactMechanism.Country); Assert.Equal("description", this.editContactMechanism.Description); }
public void Create() { var country = new Countries(this.Session).FindBy(M.Country.IsoCode, "BE"); var before = new PostalAddresses(this.Session).Extent().ToArray(); var extent = new People(this.Session).Extent(); var person = extent.First(v => v.PartyName.Equals("John0 Doe0")); var personOverview = this.people.Select(person); var page = personOverview.NewPostalAddress(); page.ContactPurposes.Toggle(new ContactMechanismPurposes(this.Session).BillingAddress.Name) .Address1.Set("addressline 1") .Address2.Set("addressline 2") .Address3.Set("addressline 3") .Locality.Set("city") .PostalCode.Set("postalcode") .Country.Set(country.Name) .Description.Set("description") .Save.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new PostalAddresses(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length + 1); var contactMechanism = after.Except(before).First(); var partyContactMechanism = contactMechanism.PartyContactMechanismsWhereContactMechanism.First; Assert.Equal("addressline 1", contactMechanism.Address1); Assert.Equal("addressline 2", contactMechanism.Address2); Assert.Equal("addressline 3", contactMechanism.Address3); Assert.Equal("addressline 1", contactMechanism.Address1); Assert.Equal("city", contactMechanism.PostalBoundary.Locality); Assert.Equal("postalcode", contactMechanism.PostalBoundary.PostalCode); Assert.Equal(country, contactMechanism.PostalBoundary.Country); Assert.Equal("description", contactMechanism.Description); }
public void Create() { var country = new Countries(this.Session).FindBy(M.Country.IsoCode, "BE"); var before = new PostalAddresses(this.Session).Extent().ToArray(); var person = new People(this.Session).Extent().First; this.people.Table.DefaultAction(person); var postalAddressEditComponent = new PersonOverviewComponent(this.people.Driver).ContactmechanismOverviewPanel.Click().CreatePostalAddress(); postalAddressEditComponent .ContactPurposes.Toggle(new ContactMechanismPurposes(this.Session).GeneralCorrespondence) .Address1.Set("addressline 1") .Address2.Set("addressline 2") .Address3.Set("addressline 3") .Locality.Set("city") .PostalCode.Set("postalcode") .Country.Select(country) .Description.Set("description") .SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new PostalAddresses(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length + 1); var contactMechanism = after.Except(before).First(); var partyContactMechanism = contactMechanism.PartyContactMechanismsWhereContactMechanism.First; Assert.Equal("addressline 1", contactMechanism.Address1); Assert.Equal("addressline 2", contactMechanism.Address2); Assert.Equal("addressline 3", contactMechanism.Address3); Assert.Equal("addressline 1", contactMechanism.Address1); Assert.Equal("city", contactMechanism.Locality); Assert.Equal("postalcode", contactMechanism.PostalCode); Assert.Equal(country, contactMechanism.Country); Assert.Equal("description", contactMechanism.Description); }
/// <summary> /// Returns true if Branch instances are equal /// </summary> /// <param name="other">Instance of Branch to be compared</param> /// <returns>Boolean</returns> public bool Equals(Branch other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Identification == other.Identification || Identification != null && Identification.Equals(other.Identification) ) && ( PostalAddresses == other.PostalAddresses || PostalAddresses != null && PostalAddresses.Equals(other.PostalAddresses) ) && ( Availability == other.Availability || Availability != null && Availability.Equals(other.Availability) ) && ( Phones == other.Phones || Phones != null && Phones.SequenceEqual(other.Phones) ) && ( Services == other.Services || Services != null && Services.SequenceEqual(other.Services) )); }
public PostalAddress GetPostalAddress(string address1, string address2, string address3, PostalCode postalCode, City city, Country country) { var postalAddresses = new PostalAddresses(this.Session).Extent(); if (!string.IsNullOrEmpty(address1)) { postalAddresses.Filter.AddEquals(Meta.Address1, address1); } if (!string.IsNullOrEmpty(address2)) { postalAddresses.Filter.AddEquals(Meta.Address2, address2); } if (!string.IsNullOrEmpty(address3)) { postalAddresses.Filter.AddEquals(Meta.Address3, address3); } if (postalCode != null) { postalAddresses.Filter.AddContains(Meta.GeographicBoundaries, postalCode); } if (city != null) { postalAddresses.Filter.AddContains(Meta.GeographicBoundaries, city); } if (country != null) { postalAddresses.Filter.AddContains(Meta.GeographicBoundaries, country); } return postalAddresses.First; }
public PostalAddress GetPostalAddress(string address1, string address2, string address3, PostalCode postalCode, City city, Country country) { var postalAddresses = new PostalAddresses(this.Session).Extent(); if (!string.IsNullOrEmpty(address1)) { postalAddresses.Filter.AddEquals(this.Meta.Address1, address1); } if (!string.IsNullOrEmpty(address2)) { postalAddresses.Filter.AddEquals(this.Meta.Address2, address2); } if (!string.IsNullOrEmpty(address3)) { postalAddresses.Filter.AddEquals(this.Meta.Address3, address3); } if (postalCode != null) { postalAddresses.Filter.AddContains(this.Meta.GeographicBoundaries, postalCode); } if (city != null) { postalAddresses.Filter.AddContains(this.Meta.GeographicBoundaries, city); } if (country != null) { postalAddresses.Filter.AddContains(this.Meta.GeographicBoundaries, country); } return(postalAddresses.First); }
public void LookUpRegistrationDetails(string taxReferenceNo) { var serviceClient = new FDRQueueService(); var id = serviceClient.GetTaxpayerRegistrationData(taxReferenceNo); var data = DBReadManager.GetResponse(id); var i = 1; while (!data.HasRows && i <= Configurations.QueueResponseTime) { Thread.Sleep(1); i++; data = DBReadManager.GetResponse(id); } if (!data.HasRows && i >= Configurations.QueueResponseTime) { DetailsFound = false; Message = Configurations.QueueTimeoutMessage; return; } if (Convert.ToInt32(data[0]["ReturnCode"]) != 0) { DetailsFound = false; Message = data[0]["ReturnMessage"].ToString(); //MessageBox.Show(data[0]["ReturnMessage"].ToString()); return; } DetailsFound = true; var xml = data[0]["Message"].ToString(); RegistrationData = xml; const string _namespace = "http://www.sars.gov.za/enterpriseMessagingModel/RegistrationManagement/xml/schemas/version/3.3"; var registrationManagementResponse = FdrCommon.SelectNode(xml, "ns0", _namespace, "RegistrationManagementResponse"); if (registrationManagementResponse != null) { var reg = Sars.Systems.Serialization.XmlObjectSerializer .ConvertXmlToObject <RegistrationManagementResponseStructure> ( registrationManagementResponse.OuterXml ); if (reg != null) { if (reg.Registration != null && reg.Registration.Parties != null && reg.Registration.Parties.Any()) { if (reg.Registration.Parties[0].Addresses != null && reg.Registration.Parties[0].Addresses.Any()) { foreach (var addressStructure in reg.Registration.Parties[0].Addresses) { if (addressStructure.PhysicalAddress != null) { PhysicalAddresses.Add(addressStructure.PhysicalAddress); } if (addressStructure.PostalAddress != null) { PostalAddresses.Add(addressStructure.PostalAddress); } } } if (reg.Registration.Parties[0].TradingNameDetails != null && reg.Registration.Parties[0].TradingNameDetails.Any()) { foreach (var tradingNameDetailStructure in reg.Registration.Parties[0].TradingNameDetails) { if (!string.IsNullOrWhiteSpace(tradingNameDetailStructure.Name)) { RegistrationName = tradingNameDetailStructure.Name; break; } } } } } } if (PhysicalAddresses.Any()) { foreach (var address in PhysicalAddresses) { if ( !string.IsNullOrEmpty(address.PostalCode) && !string.IsNullOrEmpty(address.StreetName) && (!string.IsNullOrEmpty(address.Suburb) || !string.IsNullOrEmpty(address.City)) ) { PreferredAddress = address; break; } } if (PreferredAddress == null) { PreferredAddress = PhysicalAddresses.Find( a => !string.IsNullOrEmpty(a.StreetName) || !string.IsNullOrEmpty(a.ComplexName) || !string.IsNullOrEmpty(a.UnitNo)); } } RecordSet.ReadXml(new StringReader(xml)); }
public override string ToString() { return(string.Format("[Contact: Identifier={0}, NamePrefix={1}, GivenName={2}, MiddleName={3}, FamilyName={4}, PreviousFamilyName={5}, NameSuffix={6}, Nickname={7}, OrganizationName={8}, DepartmentName={9}, JobTitle={10}, PhoneticGivenName={11}, PhoneticMiddleName={12}, PhoneticFamilyName={13}, PhoneticOrganizationName={14}, Note={15}, Birthday={16}, PhoneNumbers={17}, Emails={18}, PostalAddresses={19}, Urls={20}, Relations={21}, SocialProfiles={22}, InstantMessageAddresses={23}, Dates={24}]", Identifier, NamePrefix, GivenName, MiddleName, FamilyName, PreviousFamilyName, NameSuffix, Nickname, OrganizationName, DepartmentName, JobTitle, PhoneticGivenName, PhoneticMiddleName, PhoneticFamilyName, PhoneticOrganizationName, Note, Birthday, PhoneNumbers.ToStringList(), Emails.ToStringList(), PostalAddresses.ToStringList(), Urls.ToStringList(), Relations.ToStringList(), SocialProfiles.ToStringList(), InstantMessageAddresses.ToStringList(), Dates.ToStringList())); }