public override global::System.Data.DataSet Clone() { EventsDataSet cln = ((EventsDataSet)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { EventsDataSet ds = new EventsDataSet(); 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); }
protected override DataSet CreateDataSet(DataProvider dataProvider) { var filter = GetFilter<EventsReportFilter>(); var dataSet = new EventsDataSet(); var archiveFilter = new JournalFilter(); archiveFilter.StartDate = filter.DateTimeFrom; archiveFilter.EndDate = filter.DateTimeTo; if (filter.JournalEventNameTypes != null && filter.JournalEventNameTypes.Count > 0) { archiveFilter.JournalEventNameTypes = filter.JournalEventNameTypes; } if (filter.JournalObjectTypes != null && filter.JournalObjectTypes.Count > 0) { archiveFilter.JournalObjectTypes = filter.JournalObjectTypes; } if (filter.JournalEventSubsystemTypes != null && filter.JournalEventSubsystemTypes.Count > 0) { archiveFilter.JournalSubsystemTypes = filter.JournalEventSubsystemTypes; } if (filter.JournalObjectTypes != null && filter.JournalObjectTypes.Count > 0) { archiveFilter.JournalObjectTypes = filter.JournalObjectTypes; } if (filter.ObjectUIDs != null && filter.ObjectUIDs.Count > 0) { archiveFilter.ObjectUIDs = filter.ObjectUIDs; } if (filter.Employees != null && filter.Employees.Count > 0) { archiveFilter.EmployeeUIDs = filter.Employees; } if (!filter.Users.IsEmpty()) archiveFilter.Users = filter.Users; var journalItemsResult = dataProvider.DbService.JournalTranslator.GetFilteredArchiveItems(archiveFilter); if (journalItemsResult.Result != null) { foreach (var journalItem in journalItemsResult.Result) { var dataRow = dataSet.Data.NewDataRow(); dataRow.SystemDateTime = journalItem.SystemDateTime; if (journalItem.DeviceDateTime.HasValue) { dataRow.DeviceDateTime = journalItem.DeviceDateTime.Value; } if (journalItem.JournalEventNameType != JournalEventNameType.NULL) { dataRow.Name = EventDescriptionAttributeHelper.ToName(journalItem.JournalEventNameType); } if (journalItem.JournalEventDescriptionType != JournalEventDescriptionType.NULL) { dataRow.Description = EventDescriptionAttributeHelper.ToName(journalItem.JournalEventDescriptionType); if (!string.IsNullOrEmpty(journalItem.DescriptionText)) dataRow.Description += " " + journalItem.DescriptionText; } else { dataRow.Description = journalItem.DescriptionText; } switch (journalItem.JournalObjectType) { case JournalObjectType.GKDevice: var device = GKManager.Devices.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (device != null) { dataRow.Object = device.PresentationName; } break; case JournalObjectType.GKZone: var zone = GKManager.Zones.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (zone != null) { dataRow.Object = zone.PresentationName; } break; case JournalObjectType.GKSKDZone: var SKDzone = GKManager.Zones.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (SKDzone != null) { dataRow.Object = SKDzone.PresentationName; } break; case JournalObjectType.GKDirection: var direction = GKManager.Directions.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (direction != null) { dataRow.Object = direction.PresentationName; } break; case JournalObjectType.GKPumpStation: var pumpStation = GKManager.PumpStations.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (pumpStation != null) { var objectName = pumpStation.PresentationName; } break; case JournalObjectType.GKMPT: var mpt = GKManager.MPTs.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (mpt != null) { dataRow.Object = mpt.PresentationName; } break; case JournalObjectType.GKDelay: var delay = GKManager.Delays.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (delay != null) { dataRow.Object = delay.PresentationName; } break; case JournalObjectType.GKGuardZone: var guardZone = GKManager.GuardZones.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (guardZone != null) { dataRow.Object = guardZone.PresentationName; } break; case JournalObjectType.GKDoor: var gkDoor = GKManager.Doors.FirstOrDefault(x => x.UID == journalItem.ObjectUID); if (gkDoor != null) { dataRow.Object = gkDoor.PresentationName; } break; case JournalObjectType.Camera: //var camera = RubezhManager.SystemConfiguration.Cameras.FirstOrDefault(x => x.UID == journalItem.ObjectUID); //if (camera != null) //{ // dataRow.Object = camera.Name; //} break; case JournalObjectType.None: case JournalObjectType.GKUser: dataRow.Object = journalItem.ObjectName != null ? journalItem.ObjectName : ""; break; } if (dataRow.IsObjectNull()) { dataRow.Object = journalItem.ObjectName; } if (dataRow.IsObjectNull()) dataRow.Object = "<Нет в конфигурации>"; dataRow.System = journalItem.JournalSubsystemType.ToDescription(); dataRow.User = journalItem.UserName; dataSet.Data.Rows.Add(dataRow); } } else { if (journalItemsResult.HasError) ThrowException(journalItemsResult.Error); else ThrowException("Exception was trown in EventsReport.CreateDataSet()"); } return dataSet; }
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(); EventsDataSet ds = new EventsDataSet(); 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 = "EventDataTable"; 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); }