private void OutputSchemaList_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Populate type-list with possible tables. Type-list filling is provided by a Space function (not all types are possible because of cycles and maybe other constraints) OutputTables.Clear(); if (SelectedOutputSchema != null) { // Rules/constraints: // - Generating columns (returning tuples) cannot target a primitive type // - Import/export is always generating column so cannot target a primitive type // - Can we have generating column cycles? // - Can we have import/export cycles? // Add primitive tables var primitiveTables = SelectedOutputSchema.SubTables.Where(x => x != SelectedOutputSchema.Root).ToList(); primitiveTables.ForEach(x => OutputTables.Add(x)); // Add non-primitive tables (only possible/meainingful) List <DcTable> outputTables; if (SelectedOutputSchema == Table.Schema) // Intra-schema link { outputTables = MappingModel.GetPossibleGreaterSets(Table); } else // Import-export link - all tables { outputTables = SelectedOutputSchema.Root.SubTables; } outputTables.ForEach(x => OutputTables.Add(x)); } }
public override global::System.Data.DataSet Clone() { OutputTables cln = ((OutputTables)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { OutputTables ds = new OutputTables(); 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); }
/// <summary> /// Writes the wells to a point shape /// Calculates statistics on the observations within the period from start to end /// </summary> /// <param name="FileName"></param> /// <param name="Wells"></param> /// <param name="Start"></param> /// <param name="End"></param> public static void WriteSimpleShape(string FileName, IEnumerable<IIntake> Intakes, DateTime Start, DateTime End) { PointShapeWriter PSW = new PointShapeWriter(FileName); OutputTables NT = new OutputTables(); OutputTables.PejlingerOutputDataTable PDT = new OutputTables.PejlingerOutputDataTable(); foreach (Intake I in Intakes) { List<ObservationEntry> SelectedObs = I.Observations.Where(TSE => InBetween(TSE, Start, End)).ToList<ObservationEntry>(); PSW.WritePointShape(I.well.X, I.well.Y); OutputTables.PejlingerOutputRow PR = PDT.NewPejlingerOutputRow(); PR.NOVANAID = I.ToString(); PR.LOCATION = I.well.Description; PR.XUTM = I.well.X; PR.YUTM = I.well.Y; PR.JUPKOTE = I.well.Terrain; if (I.Screens.Count > 0) { PR.INTAKETOP = I.Screens.Min(var => var.DepthToTop); PR.INTAKEBOT = I.Screens.Max(var => var.DepthToBottom); } PR.NUMBEROFOB = SelectedObs.Count; if (SelectedObs.Count > 0) { PR.STARTDATO = SelectedObs.Min(x => x.Time); PR.ENDDATO = SelectedObs.Max(x => x.Time); PR.MAXOBS = SelectedObs.Max(num => num.Value); PR.MINOBS = SelectedObs.Min(num => num.Value); PR.MEANOBS = SelectedObs.Average(num => num.Value); } PDT.Rows.Add(PR); } PSW.Data.WriteDate(PDT); PSW.Dispose(); }
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(); OutputTables ds = new OutputTables(); 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 = "PejlingerOutputDataTable"; 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); }