//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private static void FromFactorCustom(FabFactor pApi, Factor pDomain) { if (pDomain.DirectorType == null) { pApi.Director = null; } if (pDomain.EventorType == null) { pApi.Eventor = null; } else if (pDomain.EventorDateTime != null) { FromFactorFillEventorDateTime(pApi, (long)pDomain.EventorDateTime); } if (pDomain.IdentorType == null) { pApi.Identor = null; } if (pDomain.LocatorType == null) { pApi.Locator = null; } if (pDomain.VectorType == null) { pApi.Vector = null; } }
/*--------------------------------------------------------------------------------------------*/ private int ExportFactors() { IList <CreateFabFactor> factors = vDelegate.GetNewFactors(); int n = 0; foreach (CreateFabFactor data in factors) { if (vDelegate.StopExporting()) { return(n); } FabFactor factor; if (vDelegate.FakeFabricRequestMode()) { factor = new FabFactor { Id = 1000000 }; } else { factor = Client.Services.Modify.Factors.Post(data).FirstDataItem(); } vDelegate.OnFactorExport(data, factor); ++n; } return(n); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public static FabFactor FromFactor(Factor pDomain) { var api = new FabFactor(); FromFactor(api, pDomain); return(api); }
/*--------------------------------------------------------------------------------------------*/ private static void FromFactorFillEventorDateTime(FabFactor pApi, long pDateTime) { long y; byte?mo, d, h, min, s; DataUtil.EventorLongToTimes(pDateTime, out y, out mo, out d, out h, out min, out s); pApi.Eventor.Year = y; pApi.Eventor.Month = mo; pApi.Eventor.Day = d; pApi.Eventor.Hour = h; pApi.Eventor.Minute = min; pApi.Eventor.Second = s; }
public void Factor() { var obj = new CreateFabFactor(); obj.UsesPrimaryArtifactId = (long)SetupClassId.Blue; obj.UsesRelatedArtifactId = (long)SetupClassId.Beauty; obj.AssertionType = (byte)FactorAssertion.Id.Guess; obj.Descriptor = new CreateFabDescriptor(); obj.Descriptor.Type = (byte)DescriptorType.Id.BelongsTo; BrowserResponse br = PostCreate("mod/factors", obj); FabFactor result = AssertFabResponseData <FabFactor>(br); Assert.AreEqual(obj.AssertionType, result.AssertionType, "Incorrect result."); NewVertexCount = 1; NewEdgeCount = 6; }
/*--------------------------------------------------------------------------------------------*/ public static void FromFactor(FabFactor pApi, Factor pDomain) { FromVertex(pApi, pDomain); pApi.Descriptor = new FabDescriptor(); pApi.Director = new FabDirector(); pApi.Eventor = new FabEventor(); pApi.Identor = new FabIdentor(); pApi.Locator = new FabLocator(); pApi.Vector = new FabVector(); pApi.AssertionType = pDomain.AssertionType; pApi.IsDefining = pDomain.IsDefining; pApi.Note = pDomain.Note; pApi.Descriptor.Type = pDomain.DescriptorType; pApi.Director.Type = pDomain.DirectorType.GetValueOrDefault(); pApi.Director.PrimaryAction = pDomain.DirectorPrimaryAction.GetValueOrDefault(); pApi.Director.RelatedAction = pDomain.DirectorRelatedAction.GetValueOrDefault(); pApi.Eventor.Type = pDomain.EventorType.GetValueOrDefault(); //Custom: Set Api.Year/Momth/etc. using Domain.EventorDateTime. //pApi.Eventor.Year <== pDomain.EventorDateTime (requires custom) //Custom: //pApi.Eventor.Month <== pDomain.EventorDateTime (requires custom) //Custom: //pApi.Eventor.Day <== pDomain.EventorDateTime (requires custom) //Custom: //pApi.Eventor.Hour <== pDomain.EventorDateTime (requires custom) //Custom: //pApi.Eventor.Minute <== pDomain.EventorDateTime (requires custom) //Custom: //pApi.Eventor.Second <== pDomain.EventorDateTime (requires custom) pApi.Identor.Type = pDomain.IdentorType.GetValueOrDefault(); pApi.Identor.Value = pDomain.IdentorValue; pApi.Locator.Type = pDomain.LocatorType.GetValueOrDefault(); pApi.Locator.ValueX = pDomain.LocatorValueX.GetValueOrDefault(); pApi.Locator.ValueY = pDomain.LocatorValueY.GetValueOrDefault(); pApi.Locator.ValueZ = pDomain.LocatorValueZ.GetValueOrDefault(); pApi.Vector.Type = pDomain.VectorType.GetValueOrDefault(); pApi.Vector.Unit = pDomain.VectorUnit.GetValueOrDefault(); pApi.Vector.UnitPrefix = pDomain.VectorUnitPrefix.GetValueOrDefault(); pApi.Vector.Value = pDomain.VectorValue.GetValueOrDefault(); FromFactorCustom(pApi, pDomain); }