public XElement Serialize(string name)
 {
     return(new XElement(UblNames.Cac + name,
                         ID.Serialize(nameof(ID)),
                         AddressTypeCode.Serialize(nameof(AddressTypeCode)),
                         AddressFormatCode.Serialize(nameof(AddressFormatCode)),
                         Postbox.Serialize(nameof(Postbox)),
                         Floor.Serialize(nameof(Floor)),
                         Room.Serialize(nameof(Room)),
                         StreetName.Serialize(nameof(StreetName)),
                         AdditionalStreetName.Serialize(nameof(AdditionalStreetName)),
                         BlockName.Serialize(nameof(BlockName)),
                         BuildingName.Serialize(nameof(BuildingName)),
                         BuildingNumber.Serialize(nameof(BuildingNumber)),
                         InhouseMail.Serialize(nameof(InhouseMail)),
                         Department.Serialize(nameof(Department)),
                         MarkAttention.Serialize(nameof(MarkAttention)),
                         MarkCare.Serialize(nameof(MarkCare)),
                         PlotIdentification.Serialize(nameof(PlotIdentification)),
                         CitySubdivisionName.Serialize(nameof(CitySubdivisionName)),
                         CityName.Serialize(nameof(CityName)),
                         PostalZone.Serialize(nameof(PostalZone)),
                         CountrySubentity.Serialize(nameof(CountrySubentity)),
                         CountrySubentityCode.Serialize(nameof(CountrySubentityCode)),
                         Region.Serialize(nameof(Region)),
                         District.Serialize(nameof(District)),
                         TimezoneOffset.Serialize(nameof(TimezoneOffset)),
                         AddressLines?.Select(line => new XElement(UblNames.Cac + "AddressLine", line.Serialize("Line"))),
                         Country?.Serialize(),
                         LocationCoordinates?.Select(lc => lc.Serialize())
                         ));
 }
示例#2
0
        public void READ_BUILDING()
        {
            int    ISTEDI = 0;
            int    IPIS   = 0;
            double COTI   = 0;
            int    IATI   = 0;
            int    IATF   = 0;
            int    ISTAT  = 0;
            int    IGNORE = 0;
            int    NPRJ   = 0;

            ACESSOL_METHODS.ACLIST(ref ISTEDI);
            ACESSOL_METHODS.ACLINICX(ref ISTAT);
            if (ISTAT != 0)
            {
                return;
            }
            ACESSOL_METHODS.ACLDED(BuildingName, IGNORE, ref NPRJ, ref IPIS, ref COTI, ref IATI, ref IATF);
            SelectedBuildingName = BuildingName.ToString();
            ACESSOL_METHODS.ACLDIRPRECONS(BuildingPath, IGNORE);
            if (ISTEDI == 0)
            {
                ACESSOL_METHODS.ACLFIM();
            }
        }
示例#3
0
        public List <int> VerifyBuildingName()
        {
            var errors = new List <int>();

            if (BuildingName == null)
            {
                return(errors);
            }

            BuildingName = BuildingName.Trim().Replace(HidroConstants.DOUBLE_SPACE, HidroConstants.WHITE_SPACE);
            if (string.IsNullOrWhiteSpace(BuildingName))
            {
                BuildingName = null;
                return(errors);
            }

            BuildingName = HelperProvider.CapitalizeFirstLetterOfEachWord(BuildingName);

            var lenTest = new Regex(@".{1,50}");

            if (!lenTest.IsMatch(BuildingName))
            {
                errors.Add(0);
            }

            var rx = new Regex(@"^[A-Za-z\d\-.,'() ]*$");

            if (!rx.IsMatch(BuildingName))
            {
                errors.Add(1);
            }

            return(errors);
        }
    public GameObject SetActiveTemplate(BuildingName name)
    {
        if (!templates.ContainsKey(name))
        {
            return(null);
        }

        ActiveTemplate = templates[name];
        ActiveTemplate.SetActive(true);
        return(ActiveTemplate);
    }
示例#5
0
        private string ConcatAddressComponents(bool useBuildingName = false)
        {
            var addressSections = IsZipCodeReversedFormat()
                                ? new[] { FirstSectionOfDisplayAddress, LastSectionOfDisplayAddress, State.ToSafeString() }.Where(x => x.HasValueTrimmed()).ToArray()
                                : new[] { FirstSectionOfDisplayAddress, City.ToSafeString(), LastSectionOfDisplayAddress }.Where(x => x.HasValueTrimmed()).ToArray();

            if (FirstSectionOfDisplayAddress.HasValueTrimmed() &&
                LastSectionOfDisplayAddress.HasValueTrimmed() &&
                FirstSectionOfDisplayAddress.Contains(LastSectionOfDisplayAddress))
            {
                // special case where we only had a FullAddress that we added value to but we don't want to redo the loop again
                return(FirstSectionOfDisplayAddress);
            }

            // should return ("StreetNumber Street" or "Street StreetNumber" or "FullAddress"), ("City", "State" "ZipCode" or "ZipCode" "City", "State")
            var address = string.Join(", ", addressSections);

            if (useBuildingName && BuildingName.HasValueTrimmed())
            {
                address = BuildingName + " - " + address;
            }

            // Check if full address is really a full address
            // If it doesn't contain the city, then we overwrite FullAddress with the value of DisplayAddress
            // We also check that the street doesn't contain the city, ie: "11000 Garden Grove Blvd, Garden Grove, CA 92843"
            if (FullAddress.HasValueTrimmed())
            {
                if (!FullAddress.Contains(City.ToSafeString()))
                {
                    FullAddress = address;
                }
                else
                {
                    if (Street.HasValueTrimmed() && Street.Contains(City.ToSafeString()))
                    {
                        FullAddress = address;
                    }
                }
            }

            return(address);
        }
示例#6
0
    public void SpawnBuildingOnCellByType(Cell cell, BuildingName buildingName)
    {
        if (buildingName == BuildingName.Hut)
        {
            cell.building = InstantiateBuildingOnCell <Hut>(cell, hutPref);
        }
        else if (buildingName == BuildingName.Stable)
        {
            cell.building = InstantiateBuildingOnCell <Stable>(cell, stablePref);
        }
        else if (buildingName == BuildingName.Monastery)
        {
            cell.building = InstantiateBuildingOnCell <Monastery>(cell, monasteryPref);
        }
        else if (buildingName == BuildingName.Beacon)
        {
            cell.building = InstantiateBuildingOnCell <Beacon>(cell, beaconPref);
        }

        cell.building.gameObject.name = buildingName.ToString();
        cell.building.parentCell      = cell;
        cell.building.stateManager    = cell.stateManager;
    }
 public static BuildingData Find(BuildingName name)
 {
     return(BuildingDataList[name.ToString()]);
 }
示例#8
0
 public void TeleportGhostBuildingToCellByType(Cell cell, BuildingName buildingName)
 {
     TeleportObjectToCell(cell, ghostBuildings[buildingName]);
 }
示例#9
0
        public override void ExecuteCRMWorkFlowActivity(CodeActivityContext executionContext, LocalWorkflowContext crmWorkflowContext)
        {
            string uprn;
            string buildingnumber;
            string buildingname;
            string street;
            string postcode;
            string country;
            int    type;

            uprn           = UPRN.Get(executionContext);
            buildingnumber = BuildingNumber.Get(executionContext);
            buildingname   = BuildingName.Get(executionContext);
            street         = Street.Get(executionContext);
            postcode       = PostCode.Get(executionContext);
            country        = Country.Get(executionContext);
            street         = Street.Get(executionContext);
            SCII.Helper objCommon = new SCII.Helper(executionContext);
            type = AddressType.Get(executionContext);
            Guid        customerId      = string.IsNullOrEmpty(CustomerId.Get(executionContext)) ? Guid.Empty : new Guid(CustomerId.Get(executionContext));
            AddressData addressData     = new AddressData();
            Guid        addressId       = Guid.Empty;
            Guid        contactDetailId = Guid.Empty;
            OrganizationServiceContext orgSvcContext = new OrganizationServiceContext(objCommon.service);

            try
            {
                if (string.IsNullOrEmpty(buildingname))
                {
                    if (string.IsNullOrEmpty(buildingnumber))
                    {
                        throw new Exception("Provide either building name or building number, Building name is mandatory if the building number is empty;");
                    }
                }

                if (!Enum.IsDefined(typeof(SCII.AddressTypes), type))
                {
                    throw new Exception("Option set value for address of type not found;" + type);
                }

                if (string.IsNullOrEmpty(postcode))
                {
                    throw new Exception("Postcode is required");
                }
                else if (postcode.Length > 8)
                {
                    throw new Exception("postcode length can not be greater than 8 for UK countries;");
                }

                if (string.IsNullOrEmpty(country))
                {
                    throw new Exception("Country is required");
                }
                else if (country.Length > 3)
                {
                    throw new Exception("Country ISO ALPHA - 3 Code cannot be greater than 3;");
                }

                if (country.Trim().ToUpper() == "GBR")
                {
                    if (postcode.Length > 8)
                    {
                        throw new Exception("postcode length can not be greater than 8 for UK countries;");
                    }
                }
                else
                {
                    if (postcode.Length > 25)
                    {
                        throw new Exception("postcode length can not be greater than 25 for NON-UK countries;");
                    }
                }

                if (customerId != Guid.Empty)
                {
                    var contactDetailsWithType = from c in orgSvcContext.CreateQuery(SCS.ContactDetails.ENTITY)
                                                 where ((string)c[SCS.ContactDetails.ADDRESSTYPE]).Equals(type) && ((EntityReference)c[SCS.ContactDetails.CUSTOMER]).Id.Equals(customerId)
                                                 select new { contactDetailsId = c.Id };
                    contactDetailId = contactDetailsWithType != null && contactDetailsWithType.FirstOrDefault() != null?contactDetailsWithType.FirstOrDefault().contactDetailsId : Guid.Empty;

                    if (contactDetailId != Guid.Empty)
                    {
                        throw new Exception("Contact details of same type already exist for this customer:" + contactDetailId);
                    }
                }
            }
            catch (Exception ex)
            {
                crmWorkflowContext.Trace(ex.Message);
                throw ex;
            }
        }