//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.573
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

namespace Municipalidad.Utils {
    using System;
    using System.Data;
    using System.Xml;
    using System.Runtime.Serialization;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Diagnostics.DebuggerStepThrough()]
    [System.ComponentModel.ToolboxItem(true)]
    public class DSAuditoria : DataSet {
        
        private AuditoriaDataTable tableAuditoria;
        
        public DSAuditoria() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected DSAuditoria(SerializationInfo info, StreamingContext context) {
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
            if ((strSchema != null)) {
                DataSet ds = new DataSet();
                ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
                if ((ds.Tables["Auditoria"] != null)) {
                    this.Tables.Add(new AuditoriaDataTable(ds.Tables["Auditoria"]));
                }
                this.DataSetName = ds.DataSetName;
                this.Prefix = ds.Prefix;
                this.Namespace = ds.Namespace;
                this.Locale = ds.Locale;
                this.CaseSensitive = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else {
                this.InitClass();
            }
            this.GetSerializationData(info, context);
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public AuditoriaDataTable Auditoria {
            get {
                return this.tableAuditoria;
            }
        }
        
        public override DataSet Clone() {
            DSAuditoria cln = ((DSAuditoria)(base.Clone()));
            cln.InitVars();
            return cln;
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(XmlReader reader) {
            this.Reset();
            DataSet ds = new DataSet();
            ds.ReadXml(reader);
            if ((ds.Tables["Auditoria"] != null)) {
                this.Tables.Add(new AuditoriaDataTable(ds.Tables["Auditoria"]));
            }
            this.DataSetName = ds.DataSetName;
            this.Prefix = ds.Prefix;
            this.Namespace = ds.Namespace;
            this.Locale = ds.Locale;
            this.CaseSensitive = ds.CaseSensitive;
            this.EnforceConstraints = ds.EnforceConstraints;
            this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
            this.InitVars();
        }
        
        protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            this.WriteXmlSchema(new XmlTextWriter(stream, null));
            stream.Position = 0;
            return System.Xml.Schema.XmlSchema.Read(new XmlTextReader(stream), null);
        }
        
        internal void InitVars() {
            this.tableAuditoria = ((AuditoriaDataTable)(this.Tables["Auditoria"]));
            if ((this.tableAuditoria != null)) {
                this.tableAuditoria.InitVars();
            }
        }
        
        private void InitClass() {
            this.DataSetName = "DSAuditoria";
            this.Prefix = "";
            this.Namespace = "http://tempuri.org/DSAuditoria.xsd";
            this.Locale = new System.Globalization.CultureInfo("en-US");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tableAuditoria = new AuditoriaDataTable();
            this.Tables.Add(this.tableAuditoria);
        }
        
        private bool ShouldSerializeAuditoria() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void AuditoriaRowChangeEventHandler(object sender, AuditoriaRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class AuditoriaDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnidAuditoria;
            
            private DataColumn columnidSistema;
            
            private DataColumn columnidUsuario;
            
            private DataColumn columnFecha;
            
            private DataColumn columnidRegistro;
            
            private DataColumn columnDescripcion;
            
            private DataColumn columnAccion;
            
            private DataColumn columnCodigoRegistro;
            
            internal AuditoriaDataTable() : 
                    base("Auditoria") {
                this.InitClass();
            }
            
            internal AuditoriaDataTable(DataTable table) : 
                    base(table.TableName) {
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn idAuditoriaColumn {
                get {
                    return this.columnidAuditoria;
                }
            }
            
            internal DataColumn idSistemaColumn {
                get {
                    return this.columnidSistema;
                }
            }
            
            internal DataColumn idUsuarioColumn {
                get {
                    return this.columnidUsuario;
                }
            }
            
            internal DataColumn FechaColumn {
                get {
                    return this.columnFecha;
                }
            }
            
            internal DataColumn idRegistroColumn {
                get {
                    return this.columnidRegistro;
                }
            }
            
            internal DataColumn DescripcionColumn {
                get {
                    return this.columnDescripcion;
                }
            }
            
            internal DataColumn AccionColumn {
                get {
                    return this.columnAccion;
                }
            }
            
            internal DataColumn CodigoRegistroColumn {
                get {
                    return this.columnCodigoRegistro;
                }
            }
            
            public AuditoriaRow this[int index] {
                get {
                    return ((AuditoriaRow)(this.Rows[index]));
                }
            }
            
            public event AuditoriaRowChangeEventHandler AuditoriaRowChanged;
            
            public event AuditoriaRowChangeEventHandler AuditoriaRowChanging;
            
            public event AuditoriaRowChangeEventHandler AuditoriaRowDeleted;
            
            public event AuditoriaRowChangeEventHandler AuditoriaRowDeleting;
            
            public void AddAuditoriaRow(AuditoriaRow row) {
                this.Rows.Add(row);
            }
            
            public AuditoriaRow AddAuditoriaRow(long idAuditoria, int idSistema, int idUsuario, System.DateTime Fecha, long idRegistro, string Descripcion, string Accion, string CodigoRegistro) {
                AuditoriaRow rowAuditoriaRow = ((AuditoriaRow)(this.NewRow()));
                rowAuditoriaRow.ItemArray = new object[] {
                        idAuditoria,
                        idSistema,
                        idUsuario,
                        Fecha,
                        idRegistro,
                        Descripcion,
                        Accion,
                        CodigoRegistro};
                this.Rows.Add(rowAuditoriaRow);
                return rowAuditoriaRow;
            }
            
            public AuditoriaRow FindByidAuditoria(long idAuditoria) {
                return ((AuditoriaRow)(this.Rows.Find(new object[] {
                            idAuditoria})));
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                AuditoriaDataTable cln = ((AuditoriaDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new AuditoriaDataTable();
            }
            
            internal void InitVars() {
                this.columnidAuditoria = this.Columns["idAuditoria"];
                this.columnidSistema = this.Columns["idSistema"];
                this.columnidUsuario = this.Columns["idUsuario"];
                this.columnFecha = this.Columns["Fecha"];
                this.columnidRegistro = this.Columns["idRegistro"];
                this.columnDescripcion = this.Columns["Descripcion"];
                this.columnAccion = this.Columns["Accion"];
                this.columnCodigoRegistro = this.Columns["CodigoRegistro"];
            }
            
            private void InitClass() {
                this.columnidAuditoria = new DataColumn("idAuditoria", typeof(long), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnidAuditoria);
                this.columnidSistema = new DataColumn("idSistema", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnidSistema);
                this.columnidUsuario = new DataColumn("idUsuario", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnidUsuario);
                this.columnFecha = new DataColumn("Fecha", typeof(System.DateTime), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnFecha);
                this.columnidRegistro = new DataColumn("idRegistro", typeof(long), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnidRegistro);
                this.columnDescripcion = new DataColumn("Descripcion", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnDescripcion);
                this.columnAccion = new DataColumn("Accion", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnAccion);
                this.columnCodigoRegistro = new DataColumn("CodigoRegistro", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnCodigoRegistro);
                this.Constraints.Add(new UniqueConstraint("DSAuditoriaKey1", new DataColumn[] {
                                this.columnidAuditoria}, true));
                this.columnidAuditoria.AllowDBNull = false;
                this.columnidAuditoria.Unique = true;
                this.columnidSistema.AllowDBNull = false;
                this.columnidUsuario.AllowDBNull = false;
                this.columnFecha.AllowDBNull = false;
                this.columnidRegistro.AllowDBNull = false;
                this.columnDescripcion.AllowDBNull = false;
                this.columnAccion.AllowDBNull = false;
            }
            
            public AuditoriaRow NewAuditoriaRow() {
                return ((AuditoriaRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new AuditoriaRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(AuditoriaRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.AuditoriaRowChanged != null)) {
                    this.AuditoriaRowChanged(this, new AuditoriaRowChangeEvent(((AuditoriaRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.AuditoriaRowChanging != null)) {
                    this.AuditoriaRowChanging(this, new AuditoriaRowChangeEvent(((AuditoriaRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.AuditoriaRowDeleted != null)) {
                    this.AuditoriaRowDeleted(this, new AuditoriaRowChangeEvent(((AuditoriaRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.AuditoriaRowDeleting != null)) {
                    this.AuditoriaRowDeleting(this, new AuditoriaRowChangeEvent(((AuditoriaRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveAuditoriaRow(AuditoriaRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class AuditoriaRow : DataRow {
            
            private AuditoriaDataTable tableAuditoria;
            
            internal AuditoriaRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableAuditoria = ((AuditoriaDataTable)(this.Table));
            }
            
            public long idAuditoria {
                get {
                    return ((long)(this[this.tableAuditoria.idAuditoriaColumn]));
                }
                set {
                    this[this.tableAuditoria.idAuditoriaColumn] = value;
                }
            }
            
            public int idSistema {
                get {
                    return ((int)(this[this.tableAuditoria.idSistemaColumn]));
                }
                set {
                    this[this.tableAuditoria.idSistemaColumn] = value;
                }
            }
            
            public int idUsuario {
                get {
                    return ((int)(this[this.tableAuditoria.idUsuarioColumn]));
                }
                set {
                    this[this.tableAuditoria.idUsuarioColumn] = value;
                }
            }
            
            public System.DateTime Fecha {
                get {
                    return ((System.DateTime)(this[this.tableAuditoria.FechaColumn]));
                }
                set {
                    this[this.tableAuditoria.FechaColumn] = value;
                }
            }
            
            public long idRegistro {
                get {
                    return ((long)(this[this.tableAuditoria.idRegistroColumn]));
                }
                set {
                    this[this.tableAuditoria.idRegistroColumn] = value;
                }
            }
            
            public string Descripcion {
                get {
                    return ((string)(this[this.tableAuditoria.DescripcionColumn]));
                }
                set {
                    this[this.tableAuditoria.DescripcionColumn] = value;
                }
            }
            
            public string Accion {
                get {
                    return ((string)(this[this.tableAuditoria.AccionColumn]));
                }
                set {
                    this[this.tableAuditoria.AccionColumn] = value;
                }
            }
            
            public string CodigoRegistro {
                get {
                    try {
                        return ((string)(this[this.tableAuditoria.CodigoRegistroColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableAuditoria.CodigoRegistroColumn] = value;
                }
            }
            
            public bool IsCodigoRegistroNull() {
                return this.IsNull(this.tableAuditoria.CodigoRegistroColumn);
            }
            
            public void SetCodigoRegistroNull() {
                this[this.tableAuditoria.CodigoRegistroColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class AuditoriaRowChangeEvent : EventArgs {
            
            private AuditoriaRow eventRow;
            
            private DataRowAction eventAction;
            
            public AuditoriaRowChangeEvent(AuditoriaRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public AuditoriaRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}
