/// <summary> /// Tries to get the first available recycled ID. /// </summary> /// <param name="entityIdType">the type of the entity id</param> /// <returns>a non-zero ID if one was available; 0 otheriwse</returns> /// <remarks>If an available ID is found, it'll be removed from the database.</remarks> public static uint TryGetLowerEntityId(EntityIdType entityIdType) { // Lock so someone else doesn't grab the same row m_idLock.Enter(); try { RecycledEntityId eid = GetFirstRecycledId(entityIdType); if (eid == null) { return(0); } else { RemoveRecycledId(eid); return((uint)eid.EntityId); } } finally { m_idLock.Exit(); } }
private static NocoreResumeType CreateNocoreResume() { NocoreResumeType n = new NocoreResumeType(); n.Availability = new List <AvailibilityType>(); AvailibilityType a = new AvailibilityType(); a.AvailabilityStatus = AvailabilityStatusType.Available; a.DayOfWeek = DayOfWeekType.Monday; a.PartOfDay = PartOfDayType.Afternoon; n.Availability.Add(a); a = new AvailibilityType(); a.AvailabilityStatus = AvailabilityStatusType.Available; a.DayOfWeek = DayOfWeekType.Wednesday; a.PartOfDay = PartOfDayType.Morning; n.Availability.Add(a); n.DesiredWork = new DesiredWorkType(); n.DesiredWork.Description = "Putjesschepper"; n.DesiredWork.Items = new List <StructuredDesiredWorkType>(); StructuredDesiredWorkType s = new StructuredDesiredWorkType(); s.DesiredWork = "DesiredWork"; EntityIdType desiredWorkId = CreateEntityIdType(); s.DesiredWorkId.Add(desiredWorkId); n.DesiredWork.Items.Add(s); return(n); }
/// <summary> /// Tries to get the first available recycled ID. /// </summary> /// <param name="entityIdType">the type of the entity id</param> /// <returns>a non-zero ID if one was available; 0 otheriwse</returns> /// <remarks>If an available ID is found, it'll be removed from the database.</remarks> public static uint TryGetLowerEntityId(EntityIdType entityIdType) { // Lock so someone else doesn't grab the same row m_idLock.Enter(); try { RecycledEntityId eid = GetFirstRecycledId(entityIdType); if (eid == null) { return 0; } else { RemoveRecycledId(eid); return (uint)eid.EntityId; } } finally { m_idLock.Exit(); } }
/// <summary> /// Checks if the recycled ID already exists in the database. /// </summary> /// <param name="lowerId">the ID to check for</param> /// <param name="type">the entity ID type to check for</param> /// <returns>true if the ID has already been recycled; false if not</returns> public static bool DoesIdExist(uint lowerId, EntityIdType type) { using (var db = RealmServerDataContext.GetContext()) { return(RecycledIdByLowerAndType(db, (int)lowerId, (int)type).Count() > 0); } }
/// <summary> /// Gets the first available ID of the given type. /// </summary> /// <param name="type">the type of entity ID to get</param> /// <returns>a <see cref="RecycledEntityId" /> object representing the ID; null if no ID was available</returns> public static RecycledEntityId GetFirstRecycledId(EntityIdType type) { using (var db = RealmServerDataContext.GetContext()) { IQueryable <RecycledEntityId> ids = RecycledIdsByType(db, (int)type); return(ids.FirstOrDefault()); } }
private static EntityIdType CreateEntityIdType() { EntityIdType Id = new EntityIdType(); Id.idOwner = "NoCore"; Id.IdValue = new List <EntityIdTypeIdValue>(); EntityIdTypeIdValue val = new EntityIdTypeIdValue(); val.name = "Id"; val.Value = "12345"; Id.IdValue.Add(val); return(Id); }
private static MinorType CreateMinorType() { MinorType m = new MinorType(); m.Name = new List <string>(); m.Name.Add("MajorTypeName"); m.ProgramId = new List <EntityIdType>(); EntityIdType id = CreateEntityIdType(); m.ProgramId.Add(id); return(m); }
private static MajorType CreateMajorType() { MajorType m = new MajorType(); m.DegreeConcentration = new List <string>(); m.DegreeConcentration.Add("DegreeConcentration"); m.Name = new List <string>(); m.Name.Add("MajorTypeName"); m.ProgramId = new List <EntityIdType>(); EntityIdType id = CreateEntityIdType(); m.ProgramId.Add(id); return(m); }
/// <summary> /// Recycles an entity ID of the given type. /// </summary> /// <param name="lowerEntityId">the lower entity id</param> /// <param name="entityIdType">the type of the entity id</param> public static bool RecycleLowerEntityId(uint lowerEntityId, EntityIdType idType) { if (DoesIdExist(lowerEntityId, idType)) { // TODO: What should we do if it already exists? This is are a serious bug. s_log.Debug(Resources.AlreadyRecycledEntityId, lowerEntityId, idType.ToString()); return(false); } RecycledEntityId eid = new RecycledEntityId(); eid.RecycledEntityIdGuid = Guid.NewGuid(); eid.EntityId = (long)lowerEntityId; eid.EntityType = (int)idType; AddRecycledId(eid); return(true); }
private static SchoolDataType CreateSchoolDataType() { SchoolDataType s = new SchoolDataType(); s.InternetDomainName = new List <InternetDomainNameType>(); InternetDomainNameType i = CreateInternetDomainNameType(); s.InternetDomainName.Add(i); s.SchoolId = new List <EntityIdType>(); EntityIdType id = CreateEntityIdType(); s.SchoolId.Add(id); s.SchoolName = "School"; s.type = SchoolTypeType.prior; s.typeSpecified = true; return(s); }
private static void DoHumanResource() { HumanResourceType humanResource; EntityIdType entityIDFlex2GO; EntityIdTypeIdValue entityIdTypeIdFlex2GO; EntityIdType entityIDNocore; EntityIdTypeIdValue entityIdTypeIdNocore; // aanmaken hoofdelement. humanResource = new HumanResourceType(); // referenceInformation hebben we zo ook nodig humanResource.ReferenceInformation = new HumanResourceTypeReferenceInformation(); // resourceInformation hebben we zo ook nodig. humanResource.ResourceInformation = new HumanResourceTypeResourceInformation(); // profielinformatie zoals beschikbaarheden hebben we zo ook nodig humanResource.Profile = new HumanResourceTypeProfile(); // userArea, die we gaan gebruiken voor eigen gegevens en setu aanvullingen humanResource.UserArea = new UserAreaType(); // voorkeuren, leeg element. humanResource.Preferences = new HumanResourceTypePreferences(); #region Status humanResource.HumanResourceStatus = new HumanResourceTypeHumanResourceStatus(); // nieuwe medewerker humanResource.HumanResourceStatus.status = KnownStatusType.New; #endregion #region Identifier van HumanResource in Flex2GO // maken van eigen identifier Flex2GO entityIDFlex2GO = new EntityIdType(); // wij zijn eigenaar entityIDFlex2GO.idOwner = "Flex2GO"; // waardeobject entityIdTypeIdFlex2GO = new EntityIdTypeIdValue(); // Flex2GO gebruikt guids entityIdTypeIdFlex2GO.Value = "F020D955-A2A8-4371-A57F-BB9E5012CEDD"; // toevoegen waarde object aan entityId object entityIDFlex2GO.IdValue.Add(entityIdTypeIdFlex2GO); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Flex2GO humanResource.HumanResourceId.Add(entityIDFlex2GO); #endregion #region Identifier van HumanResource in Nocore // maken van eigen identifier Nocore entityIDNocore = new EntityIdType(); // wij zijn eigenaar entityIDNocore.idOwner = "SEDIS"; // waardeobject entityIdTypeIdNocore = new EntityIdTypeIdValue(); // Nocore gebruikt integers, personeelsnummer entityIdTypeIdNocore.Value = "12345"; // toevoegen waarde object aan entityId object entityIDNocore.IdValue.Add(entityIdTypeIdNocore); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Nocore humanResource.HumanResourceId.Add(entityIDNocore); #endregion #region Identifier Bedrijf Flex2GO = StaffingSupplier indien van Flex2GO naar Nocore // maken van eigen identifier Flex2GO EntityIdType entityIDBedrijfFlex2GO = new EntityIdType(); // waardeobject EntityIdTypeIdValue entityIdTypeIdBedrijfFlex2GO = new EntityIdTypeIdValue(); // Flex2GO gebruikt guids, guid van het Bedrijf in Flex2GO entityIdTypeIdBedrijfFlex2GO.Value = "0F14A513-BC2A-4F44-9EBC-5EDA5CF58BDC"; // toevoegen waarde object aan entityId object entityIDBedrijfFlex2GO.IdValue.Add(entityIdTypeIdBedrijfFlex2GO); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Flex2GO humanResource.ReferenceInformation.StaffingSupplierId.Add(entityIDBedrijfFlex2GO); #endregion #region Identifier Administratie Nocore = StaffingCustomer indien van Flex2GO naar Nocore // maken van eigen identifier Nocore EntityIdType entityIDAdministratieNocore = new EntityIdType(); // waardeobject EntityIdTypeIdValue entityIdTypeIdAdministratieNocore = new EntityIdTypeIdValue(); // Nocore gebruikt integers, administratienummer entityIdTypeIdAdministratieNocore.Value = "1"; // toevoegen waarde object aan entityId object entityIDAdministratieNocore.IdValue.Add(entityIdTypeIdAdministratieNocore); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Nocore humanResource.ReferenceInformation.StaffingCustomerId.Add(entityIDAdministratieNocore); #endregion #region PersonName structuur // nieuw HR-XML naam object PersonNameType name = new PersonNameType(); // zet de naam op het HR-XML object in subroutine SetName(name, "de", "Vries", "Jan de Vries", "Jan"); // stop de personname op de resourceInformation humanResource.ResourceInformation.PersonName = name; #endregion #region ContactInfo // nieuw HR-XML contactInfo object EntityContactInfoType entityContactInfo = new EntityContactInfoType(); // gelijk aan formattedname bij ons entityContactInfo.EntityName = "Jan de Vries"; // zet contactinformatie en voeg die toe aan contactInfo object ContactMethodType contactInfo = new ContactMethodType(); contactInfo.Mobile = CreateMobileNumber("0612332230", TelcomItemsChoiceType.FormattedNumber); contactInfo.Telephone = CreateNumber("0306561563", TelcomItemsChoiceType.FormattedNumber); contactInfo.InternetEmailAddress = "*****@*****.**"; entityContactInfo.ContactMethod.Add(contactInfo); humanResource.ResourceInformation.EntityContactInfo = entityContactInfo; #endregion #region Adres // nieuw HR-XML adres object PostalAddressType postalAddress = new PostalAddressType(); // landcode van Nederland in ISO2 postalAddress.CountryCode = "NL"; // nieuw HR-XML PostalAddressTypeDeliveryAddress object PostalAddressTypeDeliveryAddress deliveryAddress = new PostalAddressTypeDeliveryAddress(); // eigenschappen op object plakken deliveryAddress.StreetName = "Groeneweg"; deliveryAddress.BuildingNumber = "21"; deliveryAddress.Unit = "Z"; deliveryAddress.AddressLine.Add("Groeneweg 21Z"); postalAddress.DeliveryAddress = deliveryAddress; postalAddress.PostalCode = "3981 CK"; // type = streetAddress = Huisadres postalAddress.type = PostalAddressTypeType.streetAddress; postalAddress.typeSpecified = true; // zet adres op ResourceInformation object humanResource.ResourceInformation.PostalAddress = postalAddress; #endregion #region Profile // reisafstand in kilometers HumanResourceTypePreferencesCommute commute = new HumanResourceTypePreferencesCommute(); commute.DistanceMax = "100"; humanResource.Preferences.Commute = commute; #endregion #region HumanResourceAdditionalNL HumanResourceAdditionalNLType humanResourceAdditionalNL = new HumanResourceAdditionalNLType(); //geslacht humanResourceAdditionalNL.Sex = SexType.male; humanResourceAdditionalNL.SexSpecified = true; // geboortedatum humanResourceAdditionalNL.BirthDate = new DateTime(1981, 07, 24); humanResourceAdditionalNL.BirthDateSpecified = true; // aanmaken idDocument en vervaldatum IdentificationDocumentType idDocument = new IdentificationDocumentType(); EffectiveDateType effictiveDate = new EffectiveDateType(); // vervaldatum effictiveDate.ValidTo = new DateTime(2015, 01, 10); effictiveDate.ValidToSpecified = true; idDocument.EffectiveDate = effictiveDate; // formaat en nummer idDocument.Format = "Paspoort"; idDocument.Id = "123456789"; humanResourceAdditionalNL.IdentificationDocument = idDocument; // toewijzen humanresourceAdditionalNL deel aan de humanResource humanResource.UserArea.HumanResourceAdditionalNL = humanResourceAdditionalNL; humanResource.UserArea.HumanResourceAdditionalNLSpecified = true; #endregion #region Nocore specifieke data NocoreHumanResourceType nocoreHumanResource = new NocoreHumanResourceType(); // intercedent nocoreHumanResource.AccountManager = "Piet Intercedent"; nocoreHumanResource.BankAccountInfo = new BankAccountInfoType(); nocoreHumanResource.BankAccountInfo.BankAccountForeign = "569759943"; nocoreHumanResource.Status = "Uit dienst"; // twee fase periodes, fase 1 en fase 2A FasePeriodType periode1 = new FasePeriodType(); periode1.Fase = "1"; periode1.From = new DateTime(2008, 01, 01); periode1.To = new DateTime(2008, 06, 30); periode1.ToSpecified = true; nocoreHumanResource.FaseHistorie.Add(periode1); FasePeriodType periode2 = new FasePeriodType(); periode2.Fase = "2A"; periode2.From = new DateTime(2008, 07, 01); periode2.ToSpecified = false; nocoreHumanResource.FaseHistorie.Add(periode2); // initialen, met puntjes ertussen nocoreHumanResource.Initials = "J."; // nocore vestiging nocoreHumanResource.Location = new NocoreLocationType(); nocoreHumanResource.Location.Code = "1"; nocoreHumanResource.Location.Name = "Hoofdvestiging"; // samenwonend nocoreHumanResource.MaritalStatus = "Gehuwd"; // nationaliteit nocoreHumanResource.Nationality = new NationalityType(); nocoreHumanResource.Nationality.GBACode = "1"; nocoreHumanResource.Nationality.Name = "Nederlandse"; // mutatiedatum nocoreHumanResource.Modified = DateTime.Now; humanResource.UserArea.NocoreHumanResource = nocoreHumanResource; humanResource.UserArea.NocoreHumanResourceSpecified = true; #endregion // serializen, valideren, en opslaan in bestand. Zie EntityBase voor meer informatie van de basisklasse humanResource.SaveToFile("HumanResource.xml"); // En weer laden uit bestand. HumanResourceType loadedHumanResource = EntityBase <HumanResourceType> .LoadFromFile("HumanResource.xml"); // druk naam af in de console. Console.WriteLine(loadedHumanResource.ResourceInformation.PersonName.FormattedName); }
/// <summary> /// Recycles an entity ID of the given type. /// </summary> /// <param name="lowerEntityId">the lower entity id</param> /// <param name="entityIdType">the type of the entity id</param> public static bool RecycleLowerEntityId(uint lowerEntityId, EntityIdType idType) { if (DoesIdExist(lowerEntityId, idType)) { // TODO: What should we do if it already exists? This is are a serious bug. s_log.Debug(Resources.AlreadyRecycledEntityId, lowerEntityId, idType.ToString()); return false; } RecycledEntityId eid = new RecycledEntityId(); eid.RecycledEntityIdGuid = Guid.NewGuid(); eid.EntityId = (long)lowerEntityId; eid.EntityType = (int)idType; AddRecycledId(eid); return true; }
/// <summary> /// Checks if the recycled ID already exists in the database. /// </summary> /// <param name="lowerId">the ID to check for</param> /// <param name="type">the entity ID type to check for</param> /// <returns>true if the ID has already been recycled; false if not</returns> public static bool DoesIdExist(uint lowerId, EntityIdType type) { using (var db = RealmServerDataContext.GetContext()) { return RecycledIdByLowerAndType(db, (int)lowerId, (int)type).Count() > 0; } }
/// <summary> /// Gets the first available ID of the given type. /// </summary> /// <param name="type">the type of entity ID to get</param> /// <returns>a <see cref="RecycledEntityId" /> object representing the ID; null if no ID was available</returns> public static RecycledEntityId GetFirstRecycledId(EntityIdType type) { using (var db = RealmServerDataContext.GetContext()) { IQueryable<RecycledEntityId> ids = RecycledIdsByType(db, (int)type); return ids.FirstOrDefault(); } }
private static void DoStaffingOrganization() { StaffingOrganizationType staffingOrganization = new StaffingOrganizationType(); // type organisatie, pattern extensie dus vrij, maar Customer, Intermediary en Supplier zijn gedefinieerd. staffingOrganization.typeOfOrganization = "Customer"; #region Organization // nieuwe organisatie, toevoegen. Maar één per bericht, dat is wat setu aanbeveelt. var organization = new Organization(); staffingOrganization.Organization.Add(organization); // nieuw referenceIDType var referenceIDType = new StaffingReferenceIdType(); staffingOrganization.ReferenceIdInfo.Add(referenceIDType); #region Identifier van StaffingOrganization in Flex2GO // maken van eigen identifier Flex2GO var entityIDFlex2GO = new EntityIdType(); // wij zijn eigenaar entityIDFlex2GO.idOwner = "Flex2GO"; // waardeobject var entityIdTypeIdFlex2GO = new EntityIdTypeIdValue(); // Flex2GO gebruikt guids entityIdTypeIdFlex2GO.Value = "F020D955-A2A8-4371-A57F-BB9E5012CEDD"; // toevoegen waarde object aan entityId object entityIDFlex2GO.IdValue.Add(entityIdTypeIdFlex2GO); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Flex2GO organization.OrganizationId.Add(entityIDFlex2GO); #endregion #region Identifier van StaffingOrganization in Nocore // maken van eigen identifier Nocore var entityIDNocore = new EntityIdType(); // wij zijn eigenaar entityIDNocore.idOwner = "SEDIS"; // waardeobject var entityIdTypeIdNocore = new EntityIdTypeIdValue(); // Nocore gebruikt integers, personeelsnummer entityIdTypeIdNocore.Value = "12345"; // toevoegen waarde object aan entityId object entityIDNocore.IdValue.Add(entityIdTypeIdNocore); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Nocore organization.OrganizationId.Add(entityIDNocore); #endregion // naam organisatie organization.OrganizationName = "Birdseyeview B.V."; // omschrijving organisatie organization.Description = "Makers van Flex2GO, internetplatform voor de uitzend- en payrollbranche"; // kvk var dunsNumber = new DunsNumberDataType(); dunsNumber.dunsNumberType = DunsNumberDataTypeDunsNumberType.standardDuns; dunsNumber.Value = "039087461"; organization.DunsNumber.Add(dunsNumber); // SBI-code 2008 voor VPO marktmonitor var industryCode = new IndustryCodeType(); industryCode.Value = "62.01"; organization.IndustryCode.Add(industryCode); var internetAdres = new InternetDomainNameType(); internetAdres.Value = "http://www.birdseyeview.nl/"; organization.InternetDomainName.Add(internetAdres); #endregion #region contactpersonen var organizationContactInfo = new OrganizationContactType(); // id van de contactpersoon in Flex2GO en/of NoCore #region Identifier van OrganizationContactType in Flex2GO // maken van eigen identifier Flex2GO EntityIdType entityIDContactFlex2GO = new EntityIdType(); // wij zijn eigenaar entityIDContactFlex2GO.idOwner = "Flex2GO"; // waardeobject EntityIdTypeIdValue entityIdContactTypeIdFlex2GO = new EntityIdTypeIdValue(); // Flex2GO gebruikt guids entityIdContactTypeIdFlex2GO.Value = "F020D955-A2A8-4371-A57F-BB9E5012CEDD"; // toevoegen waarde object aan entityId object entityIDContactFlex2GO.IdValue.Add(entityIdTypeIdFlex2GO); // toevoegen van EntityId object aan de lijst met HumanResourceId's, dit is die van Flex2GO organizationContactInfo.ContactId = entityIDContactFlex2GO; #endregion // Soort contactpersoon, met x: zelf te definieren, of één van de standaardwaarden organizationContactInfo.purpose = "x:Ontwikkelaar"; // Naam var personName = new PersonNameType(); SetName(personName, "", "Jansen", "Jan", "Jan"); organizationContactInfo.ContactName = personName; // ContactMethodes ContactMethodType contactInfo = new ContactMethodType(); contactInfo.Mobile = CreateMobileNumber("0612341234", TelcomItemsChoiceType.FormattedNumber); contactInfo.Telephone = CreateNumber("0306561563", TelcomItemsChoiceType.FormattedNumber); contactInfo.InternetEmailAddress = "*****@*****.**"; organizationContactInfo.ContactMethod = contactInfo; organization.ContactInfo.Add(organizationContactInfo); #endregion #region Adres var workSite = new WorkSiteType(); // nieuw HR-XML adres object PostalAddressType postalAddress = new PostalAddressType(); // landcode van Nederland in ISO2 postalAddress.CountryCode = "NL"; // nieuw HR-XML PostalAddressTypeDeliveryAddress object PostalAddressTypeDeliveryAddress deliveryAddress = new PostalAddressTypeDeliveryAddress(); // eigenschappen op object plakken deliveryAddress.StreetName = "Groeneweg"; deliveryAddress.BuildingNumber = "21"; deliveryAddress.Unit = "G"; deliveryAddress.AddressLine.Add("Groeneweg 21G"); postalAddress.DeliveryAddress = deliveryAddress; postalAddress.PostalCode = "3981 CK"; // type = streetAddress = Huisadres postalAddress.type = PostalAddressTypeType.streetAddress; postalAddress.typeSpecified = true; // zet adres op ResourceInformation object workSite.PostalAddress = postalAddress; organization.WorkSite.Add(workSite); #endregion #region NocoreSpecific staffingOrganization.UserArea = new UserAreaType(); var nocoreStaffingOrganization = new NocoreStaffingOrganizationType(); var cla = new CLAReferenceType(); cla.CLAId = "1045"; cla.Description = "THUISZORG"; nocoreStaffingOrganization.CLA = cla; nocoreStaffingOrganization.AccountManager = "Gert Dingemans"; nocoreStaffingOrganization.Location = new NocoreLocationType(); nocoreStaffingOrganization.Location.Code = "1"; nocoreStaffingOrganization.Location.Name = "Hoofdvestiging"; nocoreStaffingOrganization.Status = "Actief"; nocoreStaffingOrganization.Modified = DateTime.Now; staffingOrganization.UserArea.NocoreStaffingOrganization = nocoreStaffingOrganization; staffingOrganization.UserArea.NocoreStaffingOrganizationSpecified = true; #endregion var paymentInfo = new PaymentInfoType(); paymentInfo.BankAccountInfo = new BankAccountInfoType(); paymentInfo.BankAccountInfo.BankAccountForeign = "592177424"; paymentInfo.PaymentCondition = new PaymentInfoTypePaymentCondition(); paymentInfo.PaymentCondition.Description = "14 dagen"; // 19 voor 19%, 0 VOOR btw Verlegd paymentInfo.VATRate = 19; paymentInfo.VATRateSpecified = true; staffingOrganization.PaymentInfo.Add(paymentInfo); staffingOrganization.SaveToFile("StaffingOrganization.xml"); // Laad weer uit bestand StaffingOrganizationType loadedStaffingOrganization = EntityBase <StaffingOrganizationType> .LoadFromFile("StaffingOrganization.xml"); // druk naam af. Console.WriteLine(loadedStaffingOrganization.Organization[0].OrganizationName); }