public async Task <string> UploadFile(string filepath, string path, metadata metadata) { if (string.IsNullOrEmpty(path)) { path = ""; } byte[] bytes = System.IO.File.ReadAllBytes(filepath); string base64 = Convert.ToBase64String(bytes); SaveFileMessage q = new SaveFileMessage(); q.filename = System.IO.Path.Combine(path, System.IO.Path.GetFileName(filepath)); q.mimeType = MimeTypeHelper.GetMimeType(System.IO.Path.GetExtension(filepath)); q.file = base64; q.metadata = metadata; if (q.metadata == null) { q.metadata = new metadata(); } q.metadata.name = System.IO.Path.GetFileName(filepath); q.metadata.filename = q.filename; q.metadata.path = path; q = await q.SendMessage <SaveFileMessage>(this); if (!string.IsNullOrEmpty(q.error)) { throw new Exception(q.error); } return(q.id); }
public bool insertMeteoMetadata(int idDocument, int rowNumber, string reader, enteredData enteredData) { try //SOLO HAY UNO INDEPENDIENTE SI ES DENTRO O FUERA DEL GLACIAR PORQUE EL NÚMERO DE COLUMNAS DE METADATOS ES EL MISMO { if (rowNumber > 3) { if (!reader.Contains("#date")) { string[] aux = null; aux = reader.Split(';').ToArray(); metadata metadata = new metadata(); metadata.variable_code = aux[0]; metadata.variable_name = aux[1]; metadata.sensor_manufacturer = aux[2]; metadata.sensor_model = aux[3]; metadata.unit = aux[4]; metadata.dataQuality = aux[5]; metadata.idEnteredData = idDocument; db.metadatas.Add(metadata); } db.SaveChanges(); } return(true); } catch { return(false); } }
public FrancePhoto(PhotoMetadata metadata, IDecoder <PhotoMetadata> decoder) => Photo = new Photo(metadata, decoder);
public ActionResult Create(Work workToInsert) { try { work dalSubmission = new work { title = workToInsert.title, edition = workToInsert.edition }; // insert new author here var authorsFullName = workToInsert.author_name; var names = authorsFullName.Split(' '); string firstName = names[0]; string lastName = names[1]; if (!dbContext.authors.Any((n => n.first_name.Contains(firstName) || n.last_name.Contains(lastName) || n.first_name.StartsWith(firstName) || n.last_name.StartsWith(lastName)))) { author newAuthor = new author { first_name = firstName, last_name = lastName }; dbContext.authors.InsertOnSubmit(newAuthor); dbContext.SubmitChanges(); dalSubmission.author_id = newAuthor.author_id; // author id } // insert new language if (!dbContext.languages.Any(l => l.language_name.Contains(workToInsert.language))) { language newLang = new language { language_name = workToInsert.language }; dbContext.languages.InsertOnSubmit(newLang); dbContext.SubmitChanges(); dalSubmission.language_id = newLang.language_id; // language id } // insert new translator AND ORGANIZATION // REMEMBER TO INCLUDE ORGANIZATION ON CREATION VIEW! if (!dbContext.translators.Any(t => t.translator_name.Contains(workToInsert.translator_name) || t.translator_name.StartsWith(workToInsert.translator_name))) { if (!dbContext.organizations.Any(o => o.orginization_name.Contains(workToInsert.organization_name) || o.orginization_name.StartsWith(workToInsert.organization_name))) { string orgAbrev = string.Join(string.Empty, workToInsert.organization_name.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s[0])); organization newOrg = new organization { orginization_name = workToInsert.organization_name, orginization_abrev = orgAbrev }; dbContext.organizations.InsertOnSubmit(newOrg); dbContext.SubmitChanges(); translator newTranslator = new translator { translator_name = workToInsert.translator_name, organization_id = newOrg.organization_id }; dbContext.translators.InsertOnSubmit(newTranslator); dbContext.SubmitChanges(); dalSubmission.translator_id = newTranslator.translator_id; // translator id } } // insert user who entered // TODO: get current user var currentUserIDbyEmail = (from u in dbContext.users where u.email.Contains(workToInsert.user_entry_email) select u.user_id).FirstOrDefault(); dalSubmission.user_entry_Id = currentUserIDbyEmail; // user id // insert new metadata stuff metadata newMetaData = new metadata { media_type = workToInsert.media_type, doi = workToInsert.doi, isbn = workToInsert.isbn }; dbContext.metadatas.InsertOnSubmit(newMetaData); dbContext.SubmitChanges(); dalSubmission.metadata_id = newMetaData.metadata_id; // metadata id // insert new record into works dbContext.works.InsertOnSubmit(dalSubmission); dbContext.SubmitChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
metadata = AddServiceModelGrpcMarker(metadata, filterHandlerFactory?.ContractMethodDefinition ?? resolveContractMethodDefinition());
public PolandPhoto(PhotoMetadata metadata, IDecoder <PhotoMetadata> decoder) => Photo = new Photo(metadata, decoder);
(new MetadataValidationException(metadata: metadata, innerException: locInnerException, message: $"Property validation error. Property: '{name}'.{(string.IsNullOrEmpty(locMessage) ? string.Empty : $"{Environment.NewLine}{locMessage}")}"));
ComponentUtility.Abstract <T> .TryConcrete(out var metadata) ? Copy(source, target, metadata, include) :
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); metadata ds = new metadata(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "_puid_listDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { metadata ds = new metadata(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public ItalyPhoto(PhotoMetadata metadata, IDecoder <PhotoMetadata> decoder) => Photo = new Photo(metadata, decoder);
ComponentUtility.Abstract <T> .TryConcrete(out var metadata) ? Clear(metadata, include) :