public MiniAssembly(String peFileName) : base(peFileName) { _dependencyDirs = new List<String>(); _dependencyDirs.Add(Path.GetDirectoryName(peFileName)); Assembly = this; _representation = Representation.PEFileReader; }
public RestSnapshot(ActionResultContextSurface actionResultContext, HttpRequestMessage req, RestControlFlags flags) : this(actionResultContext, req, true) { populator = () => { representation = ActionResultRepresentation.Create(req, actionResultContext, flags); SetHeaders(); }; }
public MiniAssembly(System.Reflection.Assembly assembly) { System.Diagnostics.Contracts.Contract.Requires(assembly != null); _reflectionAssembly = assembly; _representation = Representation.ReflectionAssembly; }
private static void delReservation(Representation rep) { /* * choisir le spectacle dans la liste */ Console.Write("Saisir le n° de la réservation : "); int numSaisi = int.Parse(Console.ReadLine()); //la réservation existe-t-elle ? if (numSaisi > 0 && numSaisi <= rep.reservations.Count) { try { //supprimer la réservation rep.annulerReservation(rep.reservations.ElementAt(numSaisi - 1).client); } catch (Exception ex) { Console.WriteLine(ex.Message + "\nAppuyez sur une touche pour revoir la liste."); Console.ReadKey(); } } else { Console.WriteLine("Cette réservation n'existe pas ! Appuyez sur une touche pour revoir la liste."); Console.ReadKey(); } }
public RestSnapshot(IOidStrategy oidStrategy, ActionResultContextFacade actionResultContext, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,actionResultContext, req, true) { populator = () => { representation = ActionResultRepresentation.Create(oidStrategy ,req, actionResultContext, flags); SetHeaders(); }; }
protected override void Append(Representation.RepresentationSystem.EnumeratedRepresentation definedRepresentation, StringBuilder stringBuilder) { foreach (var enumerationMember in definedRepresentation.EnumerationMembers) { stringBuilder.AppendFormat(DefinedTypeInstanceListPattern, enumerationMember.DomainId, enumerationMember.DomainTag); stringBuilder.Append("\n\n"); } }
public RestSnapshot(IOidStrategy oidStrategy, PropertyContextFacade propertyContext, ListContextFacade listContext, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,req, true) { logger.DebugFormat("RestSnapshot:propertyprompt"); populator = () => { representation = PromptRepresentation.Create(oidStrategy ,propertyContext, listContext, req, flags); SetHeaders(); }; }
public RestSnapshot(IOidStrategy oidStrategy, ObjectContextFacade objectContext, HttpRequestMessage req, RestControlFlags flags, HttpStatusCode httpStatusCode = HttpStatusCode.OK) : this(oidStrategy,objectContext, req, true) { populator = () => { this.httpStatusCode = httpStatusCode; representation = ObjectRepresentation.Create(oidStrategy, objectContext, req, flags); SetHeaders(); }; }
public RestSnapshot(ListContextSurface listContext, HttpRequestMessage req, RestControlFlags flags) : this(req, true) { logger.DebugFormat("RestSnapshot:ServicesList"); populator = () => { representation = ListRepresentation.Create(listContext, req, flags); SetHeaders(); }; }
protected void AddSelfLink(Representation resource) { resource.Links.Insert(0, new Link { Rel = "self", Href = resource.Href, Title = resource.LinkTitle }); }
public Dictionary<Pair, float> Generate(Representation.Note[] notes) { Dictionary<Pair, float> dic = new Dictionary<Pair, float>(); float time = 0; foreach(Note n in notes) { dic[new Pair(time)] = n.Duration; time += n.Duration; } return dic; }
internal string Get(Representation request = Representation.Raw) { Debug.Assert(representation == request); switch (request) { default: return storage.UnsecureRepresentation(); //case Representation.Encrypted: // return DPAPI.Encrypt(DPAPI.KeyType.UserKey, storage.UnsecureRepresentation(), password_entropy, representation.ToString()); } }
public bool ElementHasChild(string name, Representation representation) { Element element = Element.Children.FirstOrDefault(c => c.Name == name); if (element != null) { return(element.Representation == representation); } else { return(false); } }
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue(AssemblyFieldName, _assembly); info.AddValue(ModuleFieldName, _module); info.AddValue(MDTokenFieldName, _mdToken); info.AddValue(TypeNameFieldName, _typeName); info.AddValue(NameSpaceFieldName, _nameSpace); info.AddValue(AssemblyQualifiedFieldName, _assemblyQualifiedName); Representation r = _representation & ~Representation.ReflectionType; info.AddValue(RepresentationFieldName, r); info.AddValue(IsGenericFieldName, _isGeneric); }
private void Append(Representation.RepresentationSystem.Representation representation, StringBuilder stringBuilder) { string representationName = representation.DomainId.Replace("\r", "") .Replace("[", "") .Replace("]", "") .Replace("(", "") .Replace(")", "") .Replace("-", "") .Replace("–", "") .Replace(" ", ""); stringBuilder.AppendFormat(RepresentationTagListPattern, representationName, representation.DomainTag); stringBuilder.Append("\n\n"); }
/// <summary> /// A pass-through constructor to set the id, name, and transform. /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="transform"></param> /// <param name="material"></param> /// <param name="representation"></param> /// <param name="isElementDefinition">Is this an element definition?</param> protected Wall(Transform transform, Material material, Representation representation, bool isElementDefinition = false, Guid id = default(Guid), string name = null) : base(transform, material, representation, isElementDefinition, id == default(Guid) ? Guid.NewGuid() : id, name) { }
public Task <List <Match> > GetMatchesForCountry(Representation representation) { return(Task.Run(() => { var restClient = new RestClient($"https://worldcup.sfg.io/matches/country?fifa_code={representation.FifaCode}"); var response = restClient.Execute <List <Match> >(new RestRequest()); List <Match> allMatches = JsonConvert.DeserializeObject <List <Match> >(response.Content); return allMatches; })); }
public async Task <RepresentationAttribute> CreateId(Representation representation) { if (representation == null) { throw new ArgumentNullException(nameof(representation)); } var commonAttrs = await _schemaStore.GetCommonAttributes(); var idAttr = commonAttrs.First(n => n.Name == Common.Constants.IdentifiedScimResourceNames.Id); return(new SingularRepresentationAttribute <string>(idAttr, representation.Id)); }
internal TypeInfo(MetadataToken typeDef, MiniAssembly assembly, String typeName, String nameSpace) { System.Diagnostics.Contracts.Contract.Requires(assembly != null); System.Diagnostics.Contracts.Contract.Requires(!String.IsNullOrEmpty(typeName)); System.Diagnostics.Contracts.Contract.Requires(typeDef.Table == MDTables.Tables.TypeDef); _mdToken = typeDef; _assembly = assembly; _typeName = typeName; _nameSpace = nameSpace; _assemblyQualifiedName = FullTypeName + ", " + assembly.FullName; _representation = Representation.Token | Representation.Name | Representation.AssemblyQualifiedName; }
private static TimeSpan TimeBufferDepthStatic(DocumentParameters docParams, Representation repStream) { var duration = repStream.Segments.Duration; if (!duration.HasValue) { return(timeBufferDepthDefault); } var segments = repStream.Segments.Count; if (0 == segments) { return(timeBufferDepthDefault); } if (docParams == null) { throw new ArgumentNullException("currentStreams.GetDocumentParameters() returns null"); } var manifestMinBufferDepth = docParams.MinBufferTime ?? TimeSpan.FromSeconds(10); //Get average segment duration = Total Duration / number of segments. var avgSegmentDuration = TimeSpan.FromSeconds( duration.Value.TotalSeconds / segments); var portionOfSegmentDuration = TimeSpan.FromSeconds(avgSegmentDuration.TotalSeconds * 0.15); var safeTimeBufferDepth = TimeSpan.FromTicks(avgSegmentDuration.Ticks * 3) + portionOfSegmentDuration; TimeSpan timeBufferDepth; if (safeTimeBufferDepth >= manifestMinBufferDepth) { timeBufferDepth = safeTimeBufferDepth; } else { timeBufferDepth = manifestMinBufferDepth; var bufferLeft = manifestMinBufferDepth - portionOfSegmentDuration; if (bufferLeft < portionOfSegmentDuration) { timeBufferDepth += portionOfSegmentDuration; } } Logger.Info( $"Average Segment Duration: {avgSegmentDuration} Manifest Min. Buffer Time: {manifestMinBufferDepth}"); return(timeBufferDepth); }
public override Representation Process(Representation representation) { RepresentationMesh result = new RepresentationMesh(); RepresentationMesh repre = representation as RepresentationMesh; if (repre == null) { return(result); } if (repre.isStructural()) { structured = true; } result.dimension = 3; result.type = "mesh"; result.gameObject = new GameObject(repre.gameObject.name); if (objectSize.x != 0) { if (objectSize.x < (repre.size.x * 0.5f)) { scaleX = objectSize.x / repre.size.x; } else { scaleX = 0.5f; } } if (objectSize.z != 0) { if (objectSize.z < (repre.size.z * 0.5f)) { scaleZ = objectSize.z / repre.size.z; } else { scaleY = 0.5f; } } transform(result.gameObject, result.goList, repre.goList); result.structure = copyStructure(null, repre.structure as LSystemGraph, repre.gameObject); result.offset = new Vector3(-(maxX + minX) / 2, 0, -(maxZ + minZ) / 2); return(result); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$"); parameters.Add(ObjectPlacement != null ? ObjectPlacement.ToStepValue() : "$"); parameters.Add(Representation != null ? Representation.ToStepValue() : "$"); return(string.Join(", ", parameters.ToArray())); }
/// <summary> /// The SiteBySketch function. /// </summary> /// <param name="inputModels">The input models.</param> /// <param name="input">The arguments to the execution.</param> /// <returns>A SiteBySketchOutputs instance containing computed results and the model with any new elements.</returns> public static SiteBySketchOutputs Execute(Dictionary <string, Model> inputModels, SiteBySketchInputs input) { var lamina = new Elements.Geometry.Solids.Lamina(input.Perimeter, false); var geomRep = new Representation(new List <Elements.Geometry.Solids.SolidOperation>() { lamina }); var sitMatl = new Material("site", Palette.Emerald, 0.0f, 0.0f); var output = new SiteBySketchOutputs(Math.Abs(input.Perimeter.Area())); var site = new Site(input.Perimeter, Math.Abs(input.Perimeter.Area()), null, sitMatl, geomRep, false, Guid.NewGuid(), ""); output.Model.AddElement(site); return(output); }
public void CryptDecryptWord() { var reader = new VReader(Consts.VOCAB_PATH); reader.UploadBinary(); var w = reader.Vocab.GetRepresentationFor("Hello"); var ww = new Representation(w.NumericVector); var www = reader.Vocab.Distance(ww, 1).FirstOrDefault()?.Representation.WordOrNull; Trace.WriteLine(www); }
// Returns at most eliteCount best UNIQUE members from oldGeneration private List <Representation> UniqueEliteSelection(int eliteCount) { List <Representation> orderedOldGeneration = oldGeneration.OrderByDescending(item => item.Fitness).ToList(); List <Representation> uniqueElite = new List <Representation>(); for (int i = 0; i < eliteCount; i++) { Representation currentBest = orderedOldGeneration[0]; orderedOldGeneration.RemoveAll(item => item.Values.SequenceEqual(currentBest.Values)); uniqueElite.Add(currentBest); } return(uniqueElite); }
public static SpaceBoundary Make(Profile profile, string displayName, Transform xform, double height, Vector3?parentCentroid = null, Vector3?individualCentroid = null) { MaterialDict.TryGetValue(displayName ?? "unspecified", out var material); var representation = new Representation(new[] { new Extrude(profile, height, Vector3.ZAxis, false) }); var name = Requirements.TryGetValue(displayName, out var fullReq) ? fullReq.HyparSpaceType : displayName; var sb = new SpaceBoundary(profile, new List <Polygon> { profile.Perimeter }, xform, material ?? MaterialDict["unrecognized"], representation, false, Guid.NewGuid(), name); sb.ProgramName = displayName; sb.AdditionalProperties.Add("ParentCentroid", parentCentroid ?? xform.OfPoint(profile.Perimeter.Centroid())); sb.AdditionalProperties.Add("IndividualCentroid", individualCentroid ?? xform.OfPoint(profile.Perimeter.Centroid())); return(sb); }
internal override void SetXML(XmlElement xml, BaseClassIfc host, HashSet <int> processed) { XmlElement placement = (mPlacement > 0 ? Placement.GetXML(xml.OwnerDocument, "Placement", this, processed) : null); base.SetXML(xml, host, processed); if (placement != null) { xml.AppendChild(placement); } if (mRepresentation > 0) { xml.AppendChild(Representation.GetXML(xml.OwnerDocument, "Representation", this, processed)); } }
public static string GetFileName(Representation representation, bool pathCompleted = true) { string result = "neo4j"; if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { result = "neo4j.bat"; } if (pathCompleted) { result = Enviroment.GetBinFolderServer(representation) + result; } return(result); }
private static WallPanel CreateSimpleWallPanel(Line wallLine, double thickness, double height, Material mat) { var wallProfile = new Profile(Polygon.Rectangle(Vector3.Origin, new Vector3(wallLine.Length(), height))); var d = wallLine.Direction(); var z = d.Cross(Vector3.ZAxis); var wallTransform = new Transform(wallLine.Start, d, z); var extrude = new Extrude(wallProfile, thickness, Vector3.ZAxis, false); var geomRep = new Representation(new[] { extrude }); var identifier = $"{Math.Round(wallLine.Length(), 2)} x {Math.Round(height, 2)}"; var wallpanel = new WallPanel(identifier, wallProfile, true, thickness, wallTransform, mat, geomRep, false, Guid.NewGuid(), ""); return(wallpanel); }
private static Envelope CreateFoundation(Polygon perimeter, double depth) { var extrude = new Elements.Geometry.Solids.Extrude(perimeter, depth, Vector3.ZAxis, false); var geomRep = new Representation(new List <Elements.Geometry.Solids.SolidOperation>() { extrude }); var material = BuiltInMaterials.Concrete; return(new Envelope(perimeter, depth * -1, depth, Vector3.ZAxis, 0.0, new Transform(0.0, 0.0, depth * -1), material, geomRep, false, Guid.NewGuid(), "")); }
public IViewComponentResult Invoke(string videoFor, int videoForId) { int rating = -1; if (videoFor == "Representation") { Representation representation = repository.Representations .FirstOrDefault(r => r.RepresentationId == videoForId); return(View(representation.Rating)); } return(View(rating)); }
protected override FilterExpression Transform(FilterArrayExpression ax) { // This should probably go depth-first. if (ax.Elements.All(el => el is FilterConstantExpression)) { return(new FilterConstantExpression( new SequenceValue(ax.Elements .Cast <FilterConstantExpression>() .Select(ce => Representation.Recapture(ce.ConstantValue))))); } return(base.Transform(ax)); }
/// <summary> /// Получает представление по идентификатору /// </summary> /// <param name="name">имя представления</param> /// <returns>представление или null если не найдено</returns> private Representation GetByName(string name) { if (string.IsNullOrWhiteSpace(name)) { return(null); } Representation result = Adapter.ReadByContext(c => { IQueryable <Representation> representationsQuery = (from r in c.Representation where r.Title == name && r.LanguageId == _languageId select r); return(representationsQuery.FirstOrDefault()); }); return(result); }
public Task <bool> AddRepresentation(Representation representation) { var record = new Model.Representation { Id = representation.Id, Created = representation.Created, LastModified = representation.LastModified, ResourceType = representation.ResourceType, Version = representation.Version, Attributes = GetRepresentationAttributes(representation) }; _representations.Add(record); return(Task.FromResult(true)); }
public static string GetBinFolderServer(Representation representation) { string result = representation.ToString() + "-" + Enviroment._neo4jVersion; if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { result += "-windows"; } else { result += "-linux-mac"; } result = Enviroment._rootServerLocation + result + "/bin/"; return(result); }
/// <summary> /// Create a panel. /// </summary> /// <param name="perimeter">The perimeter of the panel.</param> /// <param name="material">The panel's material</param> /// <param name="transform">The panel's transform.</param> /// <param name="representation">The panel's representation.</param> /// <param name="isElementDefinition">Is this an element definition?</param> /// <param name="id">The id of the panel.</param> /// <param name="name">The name of the panel.</param> /// <exception>Thrown when the provided perimeter points are not coplanar.</exception> public Panel(Polygon perimeter, Material material = null, Transform transform = null, Representation representation = null, bool isElementDefinition = false, Guid id = default(Guid), string name = null) : base(transform != null ? transform : new Transform(), material != null ? material : BuiltInMaterials.Concrete, representation != null ? representation : new Representation(new List <SolidOperation>()), isElementDefinition, id != default(Guid) ? id : Guid.NewGuid(), name) { this.Perimeter = perimeter; }
/// <summary> /// The LevelBySketch function. /// </summary> /// <param name="model">The input model.</param> /// <param name="input">The arguments to the execution.</param> /// <returns>A LevelBySketchOutputs instance containing computed results and the model with any new elements.</returns> public static LevelBySketchOutputs Execute(Dictionary <string, Model> inputModels, LevelBySketchInputs input) { var lamina = new Elements.Geometry.Solids.Lamina(input.Perimeter, false); var geomRep = new Representation(new List <Elements.Geometry.Solids.SolidOperation>() { lamina }); var lvlMatl = new Material("level", Palette.White, 0.0f, 0.0f); var output = new LevelBySketchOutputs(input.Perimeter.Area()); output.model.AddElement(new Level(0.0, Guid.NewGuid(), "")); output.model.AddElement(new LevelPerimeter(0.0, input.Perimeter, Guid.NewGuid(), "")); output.model.AddElement(new Panel(input.Perimeter, lvlMatl, null, geomRep, false, Guid.NewGuid(), "")); return(output); }
public Opening(Profile profile, double depth, Transform transform = null, Representation representation = null, bool isElementDefinition = false, Guid id = default(Guid), string name = null) : base(transform != null ? transform : new Transform(), BuiltInMaterials.Void, representation != null ? representation : new Representation(new List <SolidOperation>()), isElementDefinition, id != default(Guid) ? id : Guid.NewGuid(), name) { this.Profile = profile; // Don't re-transform the profile. }
public Complex(double m, double n, Representation rep, int precision = 10) { if (rep == Representation.Cartesian) { this.Real = m; this.Imaginary = n; } else { this.Real = m * System.Math.Cos(n); this.Imaginary = m * System.Math.Sin(n); } this.Precision = precision; }
public Complex(double m, double n, Representation rep, int precision = 10) { if (rep == Representation.Cartesian) { this.Real = m; this.Imaginary = n; } else { this.Real = m * System.Math.Cos(n); this.Imaginary = m * System.Math.Sin(n); } this.Precision = precision; }
private void ValidateOutgoingAttachmentMediaType() { var contentType = Representation.GetContentType(); var headers = requestMessage.GetTypedHeaders(); var incomingMediaTypes = headers.Accept.Select(a => a.MediaType).ToList(); var outgoingMediaType = contentType?.MediaType ?? ""; if (!incomingMediaTypes.Contains(outgoingMediaType)) { var msg = DebugFilter(() => $"Failed outgoing attachment MT validation ic: {string.Join(',', incomingMediaTypes.ToArray())} og: {outgoingMediaType}"); throw new ValidationException((int)HttpStatusCode.NotAcceptable, msg); } }
public ActionResult SearchRepresentationsPartial(string userId, string keyWord, int currentPage) { AppUser currentUser = userManager.Users.FirstOrDefault(u => u.Id == userId); List <SearchRepresentation> representations = new List <SearchRepresentation>(); foreach (Course course in repository.Courses.Where(c => c.Status == "Public" && (c.CreatedBy.CompanyName == currentUser.CompanyName || c.CreatedBy.CompanyName == null))) { foreach (Presentation presentation in course.Presentations) { foreach (Representation representation in presentation.Representations) { Representation repTmp = repository.Representations .FirstOrDefault(r => r.RepresentationId == representation.RepresentationId); if (SearchWordExists(representation.Title, keyWord)) { SearchRepresentation searchRepresentation = new SearchRepresentation { Representation = repTmp, PresentationTitle = presentation.Title, Course = course, Video = repository.Videos.FirstOrDefault(v => v.Id == repTmp.VideoId), CreatedBy = userManager.Users.FirstOrDefault(u => u.Id == repTmp.CreatedBy.Id) }; representations.Add(searchRepresentation); } } } } SearchAllRepresentation allRepresentations = new SearchAllRepresentation { AllRepresentation = representations.AsQueryable() .OrderBy(r => r.Representation.Title) .Skip((currentPage - 1) * MaxSearchPageRepresentation) .Take(MaxSearchPageRepresentation), RepresentationPageInfo = new SearchRepresentationPageInfo { CurrentPage = currentPage, TotalRepresentation = representations.Count(), RepresentationPerPage = MaxSearchPageRepresentation } }; return(PartialView("SearchRepresentationsPartial", allRepresentations)); }
/// <summary> /// Create a floor. /// </summary> /// <param name="profile">The perimeter of the floor.</param> /// <param name="thickness">The thickness of the floor.</param> /// <param name="transform">The floor's transform. Create a transform with a Z coordinate for the origin, to define the elevation of the floor.</param> /// <param name="material">The floor's material.</param> /// <param name="representation">The floor's representation.</param> /// <param name="isElementDefinition">Is this an element definition?</param> /// <param name="id">The floor's id.</param> /// <param name="name">The floor's name.</param> public Floor(Profile profile, double thickness, Transform transform = null, Material material = null, Representation representation = null, bool isElementDefinition = false, Guid id = default(Guid), string name = null) : base(transform != null ? transform : new Transform(), material != null ? material : BuiltInMaterials.Concrete, representation != null ? representation : new Representation(new List <SolidOperation>()), isElementDefinition, id != default(Guid) ? id : Guid.NewGuid(), name) { SetProperties(profile, thickness); }
/// <summary> /// Create a model curve. /// </summary> /// <param name="curve">The curve.</param> /// <param name="material">The material. Specular and glossiness components will be ignored.</param> /// <param name="transform">The model curve's transform.</param> /// <param name="representation">The curve's representation.</param> /// <param name="isElementDefinition">Is this an element definition?</param> /// <param name="id">The id of the model curve.</param> /// <param name="name">The name of the model curve.</param> public ModelCurve(Curve curve, Material material = null, Transform transform = null, Representation representation = null, bool isElementDefinition = false, Guid id = default(Guid), string name = null) : base(transform != null ? transform : new Transform(), material != null ? material : BuiltInMaterials.Concrete, null, isElementDefinition, id != default(Guid) ? id : Guid.NewGuid(), name) { this.Curve = curve; this.Material = material != null ? material : BuiltInMaterials.Edges; }
/// <summary> /// Creates a new angle representation. /// </summary> /// <param name="angle">Numeric value.</param> /// <param name="representation">Representation.</param> public Angle(double angle, Representation representation = Representation.Radians) { switch (representation) { case Representation.Radians: this.angleInRadians = angle; break; case Representation.Degree: this.angleInRadians = angle * Math.PI / 180; break; default: throw new NotImplementedException(String.Format("The representation '{0}' is not supported", representation)); } this.angleInDegrees = this.angleInRadians * 180 / Math.PI; }
public SecurePassword(string input, bool encrypted = false) { //if (encrypted) //{ // string rep; // input = DPAPI.Decrypt(input, password_entropy, out rep); // Enum.TryParse(rep, out representation); //} //else { representation = Representation.Raw; } foreach (char c in input) storage.AppendChar(c); storage.MakeReadOnly(); }
private static void WriteJsonTyped(Type resourceType, Representation resourceValue, JsonWriter writer, JsonSerializer serializer) { var resourceProperties = resourceType.GetProperties(); var modelValue = resourceProperties.First(p => p.IsModelProperty()).GetValue(resourceValue, null); var modelJson = JObject.FromObject(modelValue, serializer); var resourceJson = JObject.FromObject(resourceValue, serializer); //merge these guys foreach (var jProperty in resourceJson.Properties()) { var propertyName = jProperty.Name; modelJson.Add(propertyName, resourceJson[propertyName]); } serializer.Serialize(writer, modelJson); }
private static char enterReservation(Representation rep) { char choix = '\u0000'; //unicode de null Client _client = null; string _places = null; do { Console.Clear(); Console.WriteLine("--- {0} ---", rep.ToString()); Console.WriteLine(Environment.NewLine); Console.WriteLine("--- Nouvelle réservation ---"); Console.WriteLine(Environment.NewLine); /* * saisir les informations */ bool cliOK = true; do { Console.Clear(); Console.WriteLine("--- Choisissez un client dans la liste ---"); Console.WriteLine(Environment.NewLine); /* * afficher les clients */ int num = 0; foreach (Client client in fc.clients) { num++; Console.WriteLine("{0} - {1}", num, client.ToString()); } /* * choisir le client dans la liste */ Console.Write("Saisir le n° du client : "); int numSaisi = int.Parse(Console.ReadLine()); //le client existe-t-il ? if (numSaisi > 0 && numSaisi <= fc.clients.Count) { cliOK = true; //conserver la référence du client choisi _client = fc.clients.ElementAt(numSaisi - 1); } else { cliOK = false; Console.WriteLine("Ce client n'existe pas ! Appuyez sur une touche pour revoir la liste."); Console.ReadKey(); } } while (!cliOK); Console.Clear(); Console.WriteLine("--- {0} ---", rep.ToString()); Console.WriteLine(Environment.NewLine); Console.WriteLine("--- Nouvelle réservation ---"); Console.WriteLine(Environment.NewLine); Console.WriteLine("Client : {0}", _client.ToString()); Console.Write("Nb places souhaitées ({0} disponibles) : ",rep.placesDispo); _places = Console.ReadLine(); Console.WriteLine("Montant : {0}", rep.tarif * int.Parse(_places)); Console.WriteLine(Environment.NewLine); Console.WriteLine("V. valider - P. Retour menu principal"); choix = Console.ReadKey().KeyChar; switch (choix) { case 'v': case 'V': try { /* * ajouter la reservation à la représentation */ rep.ajouterReservation(_client,int.Parse(_places)); } catch (Exception) { Console.WriteLine("Erreur lors de la création de la représentation."); } break; } } while (choix != 'p' && choix != 'P' && choix != 'v' && choix != 'V'); return choix; }
/// <summary> /// charger les spectacles de la saison en mémoire /// </summary> private static void recupSpectacles() { Random aleat = new Random(); string repertoireApplication = Environment.CurrentDirectory + @"\Data\spectacles.csv"; s.lireFichier(repertoireApplication); foreach (Spectacle sp in s.spectacles) { /* * construction dynamique d'une représentation par spectacle */ Representation rp; rp = new Representation(); rp.placesDispo = (int)(300 * aleat.NextDouble()); rp.tarif = 25 * aleat.NextDouble(); rp.date = DateTime.Now; rp.date = rp.date.AddDays(30 * aleat.NextDouble()); /* * ajouter la représentation au spectacle */ sp.ajouterRepresentation(rp); } }
/// <summary> /// Construct and fill in value as a double. /// </summary> /// <param name="value"> in double format </param> /// <param name="size"></param> public PrimitiveValue(double value, int size) { _representation = Representation.Double; _longValue = 0; _doubleValue = value; _byteArrayValue = null; _characterEncoding = null; _size = size; }
public RestSnapshot(IOidStrategy oidStrategy, ITypeFacade spec, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,req, true) { logger.DebugFormat("RestSnapshot:DomainType"); populator = () => { representation = DomainTypeRepresentation.Create(oidStrategy ,req, spec, flags); SetHeaders(); }; }
public RestSnapshot(IOidStrategy oidStrategy, PropertyContextFacade propertyContext, HttpRequestMessage req, RestControlFlags flags, bool value = false) : this(oidStrategy,propertyContext, req, false) { FilterBlobsAndClobs(propertyContext, flags); populator = () => { if (value) { representation = CollectionValueRepresentation.Create(oidStrategy ,propertyContext, req, flags); } else { representation = RequestingAttachment() ? AttachmentRepresentation.Create(oidStrategy ,req, propertyContext, flags) : MemberAbstractRepresentation.Create(oidStrategy ,req, propertyContext, flags); } SetHeaders(); }; }
public RestSnapshot(IOidStrategy oidStrategy, PropertyTypeContextFacade propertyTypeContext, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,req, true) { logger.DebugFormat("RestSnapshot:{0}", propertyTypeContext.GetType().FullName); populator = () => { representation = MemberTypeRepresentation.Create(oidStrategy ,req, propertyTypeContext, flags); SetHeaders(); }; }
public RestSnapshot(IOidStrategy oidStrategy, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,req, true) { logger.DebugFormat("RestSnapshot:Home"); populator = () => { representation = HomePageRepresentation.Create(oidStrategy, req, flags); SetHeaders(); }; }
public RestSnapshot(IOidStrategy oidStrategy, IDictionary<string, string> capabilities, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,req, true) { logger.DebugFormat("RestSnapshot:Version"); populator = () => { representation = VersionRepresentation.Create(oidStrategy, req, capabilities, flags); SetHeaders(); }; }
private void MapToRepresentation(Exception e, HttpRequestMessage req) { if (e is WithContextNOSException) { ArgumentsRepresentation.Format format = e is BadPersistArgumentsException ? ArgumentsRepresentation.Format.Full : ArgumentsRepresentation.Format.MembersOnly; RestControlFlags flags = e is BadPersistArgumentsException ? ((BadPersistArgumentsException) e).Flags : RestControlFlags.DefaultFlags(); var contextNosException = e as WithContextNOSException; if (contextNosException.Contexts.Any(c => c.ErrorCause == Cause.Disabled || c.ErrorCause == Cause.Immutable)) { representation = NullRepresentation.Create(); } else if (contextNosException.ContextFacade != null) { representation = ArgumentsRepresentation.Create(oidStrategy , req, contextNosException.ContextFacade, format, flags, UriMtHelper.GetJsonMediaType(RepresentationTypes.BadArguments)); } else if (contextNosException.Contexts.Any()) { representation = ArgumentsRepresentation.Create(oidStrategy, req, contextNosException.Contexts, format, flags, UriMtHelper.GetJsonMediaType(RepresentationTypes.BadArguments)); } else { representation = NullRepresentation.Create(); } } else if (e is ResourceNotFoundNOSException || e is NotAllowedNOSException || e is PreconditionFailedNOSException || e is PreconditionHeaderMissingNOSException || e is NoContentNOSException) { representation = NullRepresentation.Create(); } else { representation = ErrorRepresentation.Create(oidStrategy, e); } }
public RestSnapshot(IOidStrategy oidStrategy, FilterFromInvokeContext filterFromInvokeContext, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy, req, true) { logger.DebugFormat("RestSnapshot:{0}", filterFromInvokeContext.GetType().FullName); populator = () => { representation = FilterFromInvokeRepresentation.Create(oidStrategy, req, filterFromInvokeContext, flags); SetHeaders(); }; }
/// <summary> /// Construct and fill in value as a byte array. /// </summary> /// <param name="value"> as a byte array </param> /// <param name="characterEncoding"></param> /// <param name="size"></param> public PrimitiveValue(byte[] value, string characterEncoding, int size) { _representation = Representation.ByteArray; _longValue = 0; _doubleValue = 0.0; _byteArrayValue = value; _characterEncoding = characterEncoding; _size = size; }
public bool ElementHasChild(string name, Representation representation) { Element element = Element.Children.FirstOrDefault(c => c.Name == name); if (element != null) { return (element.Representation == representation); } else { return false; } }
public RestSnapshot(IOidStrategy oidStrategy, IPrincipal user, HttpRequestMessage req, RestControlFlags flags) : this(oidStrategy,req, true) { logger.DebugFormat("RestSnapshot:User"); populator = () => { representation = UserRepresentation.Create(oidStrategy, req, user, flags); SetHeaders(); }; }