Example #1
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            ThreadFeelDHT.Start(this);

            foreach (IPAddress ipaddress in Dns.GetHostByName(Dns.GetHostName()).AddressList)
            {
                cbTCP.Items.Add(ipaddress.ToString());  // Заполнение списка cbTCP адресами локального хоста.
            }
            cbTCP.SelectedIndex = 0;
            //Загрузка конфигурации из директории программы.
            bool isServerStart = false;

            System.Data.DataSet ds = new System.Data.DataSet();
            try
            {
                ds.ReadXmlSchema(Application.StartupPath + "\\UARTDHT.cfg");
                cbTCP.Text     = (string)ds.ExtendedProperties["tcp"];
                numPort.Value  = decimal.Parse((string)ds.ExtendedProperties["tcpPort"]);
                isServerStart  = Convert.ToBoolean(ds.ExtendedProperties["isServerStart"]);
                numTCrit.Value = decimal.Parse((string)ds.ExtendedProperties["tCrit"]);
                numHCrit.Value = decimal.Parse((string)ds.ExtendedProperties["hCrit"]);
            }
            catch { }
            if (isServerStart)
            {
                BlockStartServer();
                ThreadServer.Start(this, cbTCP.Text, (int)numPort.Value);
            }
        }
 protected DataSet1(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Categories"] != null)) {
             base.Tables.Add(new CategoriesDataTable(ds.Tables["Categories"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
 protected EmployeeDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["employee"] != null)) {
             base.Tables.Add(new employeeDataTable(ds.Tables["employee"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
Example #4
0
 protected FullDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Product"] != null)) {
             base.Tables.Add(new ProductDataTable(ds.Tables["Product"]));
         }
         if ((ds.Tables["Country"] != null)) {
             base.Tables.Add(new CountryDataTable(ds.Tables["Country"]));
         }
         if ((ds.Tables["FarmGroup"] != null)) {
             base.Tables.Add(new FarmGroupDataTable(ds.Tables["FarmGroup"]));
         }
         if ((ds.Tables["FarmGroupLevel2"] != null)) {
             base.Tables.Add(new FarmGroupLevel2DataTable(ds.Tables["FarmGroupLevel2"]));
         }
         if ((ds.Tables["Manufacturer"] != null)) {
             base.Tables.Add(new ManufacturerDataTable(ds.Tables["Manufacturer"]));
         }
         if ((ds.Tables["Packing"] != null)) {
             base.Tables.Add(new PackingDataTable(ds.Tables["Packing"]));
         }
         if ((ds.Tables["StorageCondition"] != null)) {
             base.Tables.Add(new StorageConditionDataTable(ds.Tables["StorageCondition"]));
         }
         if ((ds.Tables["Unit"] != null)) {
             base.Tables.Add(new UnitDataTable(ds.Tables["Unit"]));
         }
         if ((ds.Tables["Substance"] != null)) {
             base.Tables.Add(new SubstanceDataTable(ds.Tables["Substance"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         this.InitExpressions();
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
 protected NorthwindDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((strSchema != null)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Products"] != null)) {
             base.Tables.Add(new ProductsDataTable(ds.Tables["Products"]));
         }
         if ((ds.Tables["Orders"] != null)) {
             base.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
         }
         if ((ds.Tables["Suppliers"] != null)) {
             base.Tables.Add(new SuppliersDataTable(ds.Tables["Suppliers"]));
         }
         if ((ds.Tables["Shippers"] != null)) {
             base.Tables.Add(new ShippersDataTable(ds.Tables["Shippers"]));
         }
         if ((ds.Tables["Customers"] != null)) {
             base.Tables.Add(new CustomersDataTable(ds.Tables["Customers"]));
         }
         if ((ds.Tables["Categories"] != null)) {
             base.Tables.Add(new CategoriesDataTable(ds.Tables["Categories"]));
         }
         if ((ds.Tables["Order Details"] != null)) {
             base.Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
         }
         if ((ds.Tables["Employees"] != null)) {
             base.Tables.Add(new EmployeesDataTable(ds.Tables["Employees"]));
         }
         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.BeginInit();
         this.InitClass();
         this.EndInit();
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
        public Window1()
        {
            StiOptions.Wpf.CurrentTheme = StiOptions.Wpf.Themes.Office2013Theme;
            Stimulsoft.Report.Wpf.StiThemesHelper.LoadTheme(this);
            InitializeComponent();

            dataSet1.ReadXmlSchema("..\\..\\Data\\Demo.xsd");
            dataSet1.ReadXml("..\\..\\Data\\Demo.xml");

            dataSet1.DataSetName = "Demo";
        }
        public static System.Data.DataSet CreateDataset(string datasetName)
        {
            try
            {
                System.Data.DataSet ds = Feng.Utils.ReflectionHelper.CreateInstanceFromName(datasetName) as System.Data.DataSet;
                if (ds != null)
                {
                    return(ds);
                }
            }
            catch (Exception)
            {
            }

            ResourceContent dataSetXmlSchema = ResourceInfoHelper.ResolveResource(datasetName, ResourceType.Dataset);

            if (dataSetXmlSchema != null)
            {
                switch (dataSetXmlSchema.Type)
                {
                case ResourceContentType.File:
                {
                    System.Data.DataSet ds = new System.Data.DataSet();
                    using (System.IO.StreamReader sr = new System.IO.StreamReader(dataSetXmlSchema.Content.ToString()))
                    {
                        ds.ReadXmlSchema(sr);
                    }
                    return(ds);
                }

                case ResourceContentType.String:
                {
                    System.Data.DataSet ds = new System.Data.DataSet();
                    using (System.IO.StringReader sr = new System.IO.StringReader(dataSetXmlSchema.Content.ToString()))
                    {
                        ds.ReadXmlSchema(sr);
                    }
                    return(ds);
                }

                default:
                    throw new ArgumentException("Invalid Resource Content Type!");
                }
            }
            else
            {
                throw new ArgumentException(string.Format("Can't find resouce of {0}!", datasetName));
            }
        }
        public Window1()
        {
            // How to Activate
            //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO...";
            //Stimulsoft.Base.StiLicense.LoadFromFile("license.key");
            //Stimulsoft.Base.StiLicense.LoadFromStream(stream);

            StiOptions.Wpf.CurrentTheme = StiOptions.Wpf.Themes.Office2013Theme;
            Stimulsoft.Report.Wpf.StiThemesHelper.LoadTheme(this);
            InitializeComponent();

            dataSet1.ReadXmlSchema("..\\Data\\Demo.xsd");
            dataSet1.ReadXml("..\\Data\\Demo.xml");
            dataSet1.DataSetName = "Demo";
        }
        public static System.Data.DataSet CreateDataset(string datasetName)
        {
            try
            {
                 System.Data.DataSet ds = Feng.Utils.ReflectionHelper.CreateInstanceFromName(datasetName) as System.Data.DataSet;
                 if (ds != null)
                     return ds;
            }
            catch (Exception)
            {
            }

            ResourceContent dataSetXmlSchema = ResourceInfoHelper.ResolveResource(datasetName, ResourceType.Dataset);
            if (dataSetXmlSchema != null)
            {
                switch (dataSetXmlSchema.Type)
                {
                    case ResourceContentType.File:
                        {
                            System.Data.DataSet ds = new System.Data.DataSet();
                            using (System.IO.StreamReader sr = new System.IO.StreamReader(dataSetXmlSchema.Content.ToString()))
                            {
                                ds.ReadXmlSchema(sr);
                            }
                            return ds;
                        }
                    case ResourceContentType.String:
                        {
                            System.Data.DataSet ds = new System.Data.DataSet();
                            using (System.IO.StringReader sr = new System.IO.StringReader(dataSetXmlSchema.Content.ToString()))
                            {
                                ds.ReadXmlSchema(sr);
                            }
                            return ds;
                        }
                    default:
                        throw new ArgumentException("Invalid Resource Content Type!");
                }

            }
            else
            {
                throw new ArgumentException(string.Format("Can't find resouce of {0}!", datasetName));
            }
        }
Example #10
0
        private void Form1_Shown(object sender, EventArgs e)
        { //Загрузка конфигурации из директории программы.
            bool isConnect = false;

            System.Data.DataSet ds = new System.Data.DataSet();
            try
            {
                ds.ReadXmlSchema(Application.StartupPath + "\\UARTDHT-Client.cfg");
                mskTCP.Text   = (string)ds.ExtendedProperties["tcp"];
                numPort.Value = decimal.Parse((string)ds.ExtendedProperties["tcpPort"]);
                isConnect     = Convert.ToBoolean(ds.ExtendedProperties["isConnect"]);
            }
            catch { }
            if (isConnect)
            {
                btnConnect.PerformClick();
            }
        }
Example #11
0
        private void btGenerate_Click(object sender, System.EventArgs e)
        {
            try
            {
                System.Data.DataSet ds = new System.Data.DataSet();

                using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                {
                    System.IO.StreamWriter writer = new System.IO.StreamWriter(stream, System.Text.Encoding.Unicode);
                    writer.Write(txtDatasetDefinition.Text);
                    writer.Flush();
                    stream.Seek(0, System.IO.SeekOrigin.Begin);
                    ds.ReadXmlSchema(stream);
                    writer.Close();
                }


                System.Text.StringBuilder outText = new System.Text.StringBuilder();
                outText.Append("--SQL Command builder\r\n");
                foreach (System.Data.DataTable table in ds.Tables)
                {
                    outText.Append("-- Table : " + table.TableName + "\r\n");

                    DevAge.Data.SqlClient.SqlCommandBuilder cmdBuilder = new DevAge.Data.SqlClient.SqlCommandBuilder(table);

                    outText.AppendLine(cmdBuilder.GetDeleteCommand().CommandText);
                    outText.AppendLine(cmdBuilder.GetUpdateCommand().CommandText);
                    outText.AppendLine(cmdBuilder.GetInsertCommand().CommandText);

                    outText.Append("-- ############################################################\r\n");
                }

                txtSqlOutput.Text = outText.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
        }
        private void btGenerate_Click(object sender, System.EventArgs e)
        {
            try
            {
                System.Data.DataSet ds = new System.Data.DataSet();

                using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
                {
                    System.IO.StreamWriter writer = new System.IO.StreamWriter(stream, System.Text.Encoding.Unicode);
                    writer.Write(txtDatasetDefinition.Text);
                    writer.Flush();
                    stream.Seek(0, System.IO.SeekOrigin.Begin);
                    ds.ReadXmlSchema(stream);
                    writer.Close();
                }

                System.Text.StringBuilder outText = new System.Text.StringBuilder();
                outText.Append("--SQL Command builder\r\n");
                foreach (System.Data.DataTable table in ds.Tables)
                {
                    outText.Append("-- Table : " + table.TableName + "\r\n");

                    DevAge.Data.SqlClient.SqlCommandBuilder cmdBuilder = new DevAge.Data.SqlClient.SqlCommandBuilder(table);

                    outText.AppendLine(cmdBuilder.GetDeleteCommand().CommandText);
                    outText.AppendLine(cmdBuilder.GetUpdateCommand().CommandText);
                    outText.AppendLine(cmdBuilder.GetInsertCommand().CommandText);

                    outText.Append("-- ############################################################\r\n");
                }

                txtSqlOutput.Text = outText.ToString();
            }
            catch(Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
        }
Example #13
0
    private void ExecuteQuery(/*bool ShowWindow*/)
    {
      if (dsData != null)
      {
        dsData = null;
      }

      dsData = new System.Data.DataSet();
      dsData.ReadXmlSchema("c:\\data.xsd");
      dsData.ReadXml("c:\\data.xml");

      if (_reporte != null)
      {
        //        _reporte.SQL = SQL;
        //        _reporte.ReloadData();
        _reporte.ReloadData(dsData);
      }

      if (_reporteRegadores != null)
      {
        ReporteRegadoresDataset rep = new ReporteRegadoresDataset();
        rep.Process(dsData);
        _reporteRegadores.ReloadData(rep.DataSet);
      }

      if (_rawDataForm != null)
      {
        _rawDataForm.DataSource = dsData;
      }
    }
 internal void DeserializeDataTable(SerializationInfo info, StreamingContext context, bool isSingleTable, SerializationFormat remotingFormat)
 {
     if (remotingFormat != SerializationFormat.Xml)
     {
         this.DeserializeTableSchema(info, context, isSingleTable);
         if (isSingleTable)
         {
             this.DeserializeTableData(info, context, 0);
             this.ResetIndexes();
         }
     }
     else
     {
         string s = (string) info.GetValue("XmlSchema", typeof(string));
         string str = (string) info.GetValue("XmlDiffGram", typeof(string));
         if (s != null)
         {
             System.Data.DataSet set = new System.Data.DataSet();
             set.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
             DataTable table = set.Tables[0];
             table.CloneTo(this, null, false);
             this.Namespace = table.Namespace;
             if (str != null)
             {
                 set.Tables.Remove(set.Tables[0]);
                 set.Tables.Add(this);
                 set.ReadXml(new XmlTextReader(new StringReader(str)), XmlReadMode.DiffGram);
                 set.Tables.Remove(this);
             }
         }
     }
 }
        private static void BinReadDataSetFromStream(System.IO.Stream stream, System.Data.DataSet ds, bool mergeSchema)
        {
            //Version
            int version;

            version = IO.StreamPersistence.ReadInt32(stream);

            if (version != c_BinaryVersion)
            {
                throw new BinaryDataSetVersionException();
            }

            //Schema byte[]
            System.Data.DataSet schemaDS;             //Questo dataset viene usato solo per leggere lo schema
            byte[] byteSchema = IO.StreamPersistence.ReadByteArray(stream);
            using (System.IO.MemoryStream schemaStream = new System.IO.MemoryStream(byteSchema))
            {
                if (mergeSchema)
                {
                    ds.ReadXmlSchema(schemaStream);
                    schemaDS = ds;
                }
                else
                {
                    schemaDS = new System.Data.DataSet();
                    schemaDS.ReadXmlSchema(schemaStream);
                }
            }

            //Tables
            for (int iTable = 0; iTable < schemaDS.Tables.Count; iTable++)
            {
                System.Data.DataTable schemaTable = schemaDS.Tables[iTable];
                //Table exist on the destination
                if (ds.Tables.Contains(schemaTable.TableName))
                {
                    System.Data.DataTable destinationTable = ds.Tables[schemaTable.TableName];

                    int rowsCount = IO.StreamPersistence.ReadInt32(stream);
                    //Rows
                    for (int r = 0; r < rowsCount; r++)
                    {
                        System.Data.DataRow row = destinationTable.NewRow();
                        //Columns
                        for (int c = 0; c < schemaTable.Columns.Count; c++)
                        {
                            string colName = schemaTable.Columns[c].ColumnName;
                            object val     = BinReadFieldFromStream(stream, schemaTable.Columns[c].DataType);                         //Il valore viene comunque letto per far avanzare lo stream

                            if (destinationTable.Columns.Contains(colName))
                            {
                                row[colName] = val;
                            }
                        }

                        destinationTable.Rows.Add(row);
                    }
                }
                else //Note: if the table not exist I will read anyway the columns and rows to correctly position the stream on the next table
                {
                    int rowsCount = IO.StreamPersistence.ReadInt32(stream);
                    //Rows
                    for (int r = 0; r < rowsCount; r++)
                    {
                        //Columns
                        for (int c = 0; c < schemaTable.Columns.Count; c++)
                        {
                            BinReadFieldFromStream(stream, schemaTable.Columns[c].DataType); //Il valore viene comunque letto per far avanzare lo stream
                        }
                    }
                }
            }

            ds.AcceptChanges();
        }
Example #16
0
 protected MDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Cash"] != null)) {
             base.Tables.Add(new CashDataTable(ds.Tables["Cash"]));
         }
         if ((ds.Tables["DocumentType"] != null)) {
             base.Tables.Add(new DocumentTypeDataTable(ds.Tables["DocumentType"]));
         }
         if ((ds.Tables["InvoiceMaster"] != null)) {
             base.Tables.Add(new InvoiceMasterDataTable(ds.Tables["InvoiceMaster"]));
         }
         if ((ds.Tables["InvoiceDetail"] != null)) {
             base.Tables.Add(new InvoiceDetailDataTable(ds.Tables["InvoiceDetail"]));
         }
         if ((ds.Tables["Periods"] != null)) {
             base.Tables.Add(new PeriodsDataTable(ds.Tables["Periods"]));
         }
         if ((ds.Tables["ReceiptDetail"] != null)) {
             base.Tables.Add(new ReceiptDetailDataTable(ds.Tables["ReceiptDetail"]));
         }
         if ((ds.Tables["ReceiptMaster"] != null)) {
             base.Tables.Add(new ReceiptMasterDataTable(ds.Tables["ReceiptMaster"]));
         }
         if ((ds.Tables["ReceiptRemains"] != null)) {
             base.Tables.Add(new ReceiptRemainsDataTable(ds.Tables["ReceiptRemains"]));
         }
         if ((ds.Tables["Product"] != null)) {
             base.Tables.Add(new ProductDataTable(ds.Tables["Product"]));
         }
         if ((ds.Tables["Remains"] != null)) {
             base.Tables.Add(new RemainsDataTable(ds.Tables["Remains"]));
         }
         if ((ds.Tables["Stock"] != null)) {
             base.Tables.Add(new StockDataTable(ds.Tables["Stock"]));
         }
         if ((ds.Tables["LocalSetting"] != null)) {
             base.Tables.Add(new LocalSettingDataTable(ds.Tables["LocalSetting"]));
         }
         if ((ds.Tables["Orders"] != null)) {
             base.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
         }
         if ((ds.Tables["inventoryMaster"] != null)) {
             base.Tables.Add(new inventoryMasterDataTable(ds.Tables["inventoryMaster"]));
         }
         if ((ds.Tables["inventoryDetails"] != null)) {
             base.Tables.Add(new inventoryDetailsDataTable(ds.Tables["inventoryDetails"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         this.InitExpressions();
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
 internal void ReadXmlSchema(XmlReader reader, bool denyResolving)
 {
     IntPtr ptr;
     Bid.ScopeEnter(out ptr, "<ds.DataTable.ReadXmlSchema|INFO> %d#, denyResolving=%d{bool}\n", this.ObjectID, denyResolving);
     try
     {
         System.Data.DataSet set = new System.Data.DataSet();
         SerializationFormat remotingFormat = this.RemotingFormat;
         set.ReadXmlSchema(reader, denyResolving);
         string mainTableName = set.MainTableName;
         if (!ADP.IsEmpty(this.tableName) || !ADP.IsEmpty(mainTableName))
         {
             DataTable currentTable = null;
             if (!ADP.IsEmpty(this.tableName))
             {
                 if (!ADP.IsEmpty(this.Namespace))
                 {
                     currentTable = set.Tables[this.tableName, this.Namespace];
                 }
                 else
                 {
                     int num3 = set.Tables.InternalIndexOf(this.tableName);
                     if (num3 > -1)
                     {
                         currentTable = set.Tables[num3];
                     }
                 }
             }
             else
             {
                 string str3 = "";
                 int index = mainTableName.IndexOf(':');
                 if (index > -1)
                 {
                     str3 = mainTableName.Substring(0, index);
                 }
                 string str4 = mainTableName.Substring(index + 1, (mainTableName.Length - index) - 1);
                 currentTable = set.Tables[str4, str3];
             }
             if (currentTable == null)
             {
                 string tableName = string.Empty;
                 if (!ADP.IsEmpty(this.tableName))
                 {
                     tableName = (this.Namespace.Length > 0) ? (this.Namespace + ":" + this.tableName) : this.tableName;
                 }
                 else
                 {
                     tableName = mainTableName;
                 }
                 throw ExceptionBuilder.TableNotFound(tableName);
             }
             currentTable._remotingFormat = remotingFormat;
             List<DataTable> tableList = new List<DataTable> {
                 currentTable
             };
             this.CreateTableList(currentTable, tableList);
             List<DataRelation> relationList = new List<DataRelation>();
             this.CreateRelationList(tableList, relationList);
             if (relationList.Count == 0)
             {
                 if (this.Columns.Count == 0)
                 {
                     DataTable table5 = currentTable;
                     if (table5 != null)
                     {
                         table5.CloneTo(this, null, false);
                     }
                     if ((this.DataSet == null) && (this.tableNamespace == null))
                     {
                         this.tableNamespace = table5.Namespace;
                     }
                 }
             }
             else
             {
                 if (ADP.IsEmpty(this.TableName))
                 {
                     this.TableName = currentTable.TableName;
                     if (!ADP.IsEmpty(currentTable.Namespace))
                     {
                         this.Namespace = currentTable.Namespace;
                     }
                 }
                 if (this.DataSet == null)
                 {
                     System.Data.DataSet set2 = new System.Data.DataSet(set.DataSetName);
                     set2.SetLocaleValue(set.Locale, set.ShouldSerializeLocale());
                     set2.CaseSensitive = set.CaseSensitive;
                     set2.Namespace = set.Namespace;
                     set2.mainTableName = set.mainTableName;
                     set2.RemotingFormat = set.RemotingFormat;
                     set2.Tables.Add(this);
                 }
                 this.CloneHierarchy(currentTable, this.DataSet, null);
                 foreach (DataTable table2 in tableList)
                 {
                     DataTable table4 = this.DataSet.Tables[table2.tableName, table2.Namespace];
                     DataTable table6 = set.Tables[table2.tableName, table2.Namespace];
                     foreach (Constraint constraint3 in table6.Constraints)
                     {
                         ForeignKeyConstraint constraint = constraint3 as ForeignKeyConstraint;
                         if (((constraint != null) && (constraint.Table != constraint.RelatedTable)) && (tableList.Contains(constraint.Table) && tableList.Contains(constraint.RelatedTable)))
                         {
                             ForeignKeyConstraint constraint2 = (ForeignKeyConstraint) constraint.Clone(table4.DataSet);
                             if (!table4.Constraints.Contains(constraint2.ConstraintName))
                             {
                                 table4.Constraints.Add(constraint2);
                             }
                         }
                     }
                 }
                 foreach (DataRelation relation in relationList)
                 {
                     if (!this.DataSet.Relations.Contains(relation.RelationName))
                     {
                         this.DataSet.Relations.Add(relation.Clone(this.DataSet));
                     }
                 }
                 bool flag = false;
                 foreach (DataTable table3 in tableList)
                 {
                     foreach (DataColumn column in table3.Columns)
                     {
                         flag = false;
                         if (column.Expression.Length != 0)
                         {
                             DataColumn[] dependency = column.DataExpression.GetDependency();
                             for (int i = 0; i < dependency.Length; i++)
                             {
                                 if (!tableList.Contains(dependency[i].Table))
                                 {
                                     flag = true;
                                     break;
                                 }
                             }
                         }
                         if (!flag)
                         {
                             this.DataSet.Tables[table3.TableName, table3.Namespace].Columns[column.ColumnName].Expression = column.Expression;
                         }
                     }
                     flag = false;
                 }
             }
         }
     }
     finally
     {
         Bid.ScopeLeave(ref ptr);
     }
 }
Example #18
0
 protected c00_ds(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["tbl_TaniBlg"] != null)) {
             base.Tables.Add(new tbl_TaniBlgDataTable(ds.Tables["tbl_TaniBlg"]));
         }
         if ((ds.Tables["tblKonsultasyonBilgisi"] != null)) {
             base.Tables.Add(new tblKonsultasyonBilgisiDataTable(ds.Tables["tblKonsultasyonBilgisi"]));
         }
         if ((ds.Tables["tbkBranj"] != null)) {
             base.Tables.Add(new tbkBranjDataTable(ds.Tables["tbkBranj"]));
         }
         if ((ds.Tables["tbkHastaYatisBilgisi"] != null)) {
             base.Tables.Add(new tbkHastaYatisBilgisiDataTable(ds.Tables["tbkHastaYatisBilgisi"]));
         }
         if ((ds.Tables["tblDisBilgisi"] != null)) {
             base.Tables.Add(new tblDisBilgisiDataTable(ds.Tables["tblDisBilgisi"]));
         }
         if ((ds.Tables["tblAmeliyatveGirisimBilgisi"] != null)) {
             base.Tables.Add(new tblAmeliyatveGirisimBilgisiDataTable(ds.Tables["tblAmeliyatveGirisimBilgisi"]));
         }
         if ((ds.Tables["tblTetkikveRadyolojiBilgisi"] != null)) {
             base.Tables.Add(new tblTetkikveRadyolojiBilgisiDataTable(ds.Tables["tblTetkikveRadyolojiBilgisi"]));
         }
         if ((ds.Tables["tbkTahlilBilgisi"] != null)) {
             base.Tables.Add(new tbkTahlilBilgisiDataTable(ds.Tables["tbkTahlilBilgisi"]));
         }
         if ((ds.Tables["tblDigerIslemBilgileri"] != null)) {
             base.Tables.Add(new tblDigerIslemBilgileriDataTable(ds.Tables["tblDigerIslemBilgileri"]));
         }
         if ((ds.Tables["tblIlacBilgisi"] != null)) {
             base.Tables.Add(new tblIlacBilgisiDataTable(ds.Tables["tblIlacBilgisi"]));
         }
         if ((ds.Tables["tblMalzemeBilgileri"] != null)) {
             base.Tables.Add(new tblMalzemeBilgileriDataTable(ds.Tables["tblMalzemeBilgileri"]));
         }
         if ((ds.Tables["tblRaporBilgileri"] != null)) {
             base.Tables.Add(new tblRaporBilgileriDataTable(ds.Tables["tblRaporBilgileri"]));
         }
         if ((ds.Tables["tblOdemeSorguHataBilgisi"] != null)) {
             base.Tables.Add(new tblOdemeSorguHataBilgisiDataTable(ds.Tables["tblOdemeSorguHataBilgisi"]));
         }
         if ((ds.Tables["tblIslemFiyatBilgisi"] != null)) {
             base.Tables.Add(new tblIslemFiyatBilgisiDataTable(ds.Tables["tblIslemFiyatBilgisi"]));
         }
         if ((ds.Tables["tblHastaTakipList"] != null)) {
             base.Tables.Add(new tblHastaTakipListDataTable(ds.Tables["tblHastaTakipList"]));
         }
         if ((ds.Tables["tblFaturaBilgisi"] != null)) {
             base.Tables.Add(new tblFaturaBilgisiDataTable(ds.Tables["tblFaturaBilgisi"]));
         }
         if ((ds.Tables["tblFaturaHataliKayit"] != null)) {
             base.Tables.Add(new tblFaturaHataliKayitDataTable(ds.Tables["tblFaturaHataliKayit"]));
         }
         if ((ds.Tables["tblFaturaBasariliKayit"] != null)) {
             base.Tables.Add(new tblFaturaBasariliKayitDataTable(ds.Tables["tblFaturaBasariliKayit"]));
         }
         if ((ds.Tables["tblTakipNumaralari"] != null)) {
             base.Tables.Add(new tblTakipNumaralariDataTable(ds.Tables["tblTakipNumaralari"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
 protected NorthwindDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["Categories"] != null)) {
             base.Tables.Add(new CategoriesDataTable(ds.Tables["Categories"]));
         }
         if ((ds.Tables["CustomerCustomerDemo"] != null)) {
             base.Tables.Add(new CustomerCustomerDemoDataTable(ds.Tables["CustomerCustomerDemo"]));
         }
         if ((ds.Tables["CustomerDemographics"] != null)) {
             base.Tables.Add(new CustomerDemographicsDataTable(ds.Tables["CustomerDemographics"]));
         }
         if ((ds.Tables["Customers"] != null)) {
             base.Tables.Add(new CustomersDataTable(ds.Tables["Customers"]));
         }
         if ((ds.Tables["Employees"] != null)) {
             base.Tables.Add(new EmployeesDataTable(ds.Tables["Employees"]));
         }
         if ((ds.Tables["EmployeeTerritories"] != null)) {
             base.Tables.Add(new EmployeeTerritoriesDataTable(ds.Tables["EmployeeTerritories"]));
         }
         if ((ds.Tables["Order Details"] != null)) {
             base.Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
         }
         if ((ds.Tables["Orders"] != null)) {
             base.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
         }
         if ((ds.Tables["Products"] != null)) {
             base.Tables.Add(new ProductsDataTable(ds.Tables["Products"]));
         }
         if ((ds.Tables["Region"] != null)) {
             base.Tables.Add(new RegionDataTable(ds.Tables["Region"]));
         }
         if ((ds.Tables["Shippers"] != null)) {
             base.Tables.Add(new ShippersDataTable(ds.Tables["Shippers"]));
         }
         if ((ds.Tables["Suppliers"] != null)) {
             base.Tables.Add(new SuppliersDataTable(ds.Tables["Suppliers"]));
         }
         if ((ds.Tables["Territories"] != null)) {
             base.Tables.Add(new TerritoriesDataTable(ds.Tables["Territories"]));
         }
         if ((ds.Tables["Alphabetical list of products"] != null)) {
             base.Tables.Add(new Alphabetical_list_of_productsDataTable(ds.Tables["Alphabetical list of products"]));
         }
         if ((ds.Tables["Category Sales for 1997"] != null)) {
             base.Tables.Add(new Category_Sales_for_1997DataTable(ds.Tables["Category Sales for 1997"]));
         }
         if ((ds.Tables["Current Product List"] != null)) {
             base.Tables.Add(new Current_Product_ListDataTable(ds.Tables["Current Product List"]));
         }
         if ((ds.Tables["Customer and Suppliers by City"] != null)) {
             base.Tables.Add(new Customer_and_Suppliers_by_CityDataTable(ds.Tables["Customer and Suppliers by City"]));
         }
         if ((ds.Tables["Invoices"] != null)) {
             base.Tables.Add(new InvoicesDataTable(ds.Tables["Invoices"]));
         }
         if ((ds.Tables["Order Details Extended"] != null)) {
             base.Tables.Add(new Order_Details_ExtendedDataTable(ds.Tables["Order Details Extended"]));
         }
         if ((ds.Tables["Order Subtotals"] != null)) {
             base.Tables.Add(new Order_SubtotalsDataTable(ds.Tables["Order Subtotals"]));
         }
         if ((ds.Tables["Orders Qry"] != null)) {
             base.Tables.Add(new Orders_QryDataTable(ds.Tables["Orders Qry"]));
         }
         if ((ds.Tables["Product Sales for 1997"] != null)) {
             base.Tables.Add(new Product_Sales_for_1997DataTable(ds.Tables["Product Sales for 1997"]));
         }
         if ((ds.Tables["Products Above Average Price"] != null)) {
             base.Tables.Add(new Products_Above_Average_PriceDataTable(ds.Tables["Products Above Average Price"]));
         }
         if ((ds.Tables["Products by Category"] != null)) {
             base.Tables.Add(new Products_by_CategoryDataTable(ds.Tables["Products by Category"]));
         }
         if ((ds.Tables["Quarterly Orders"] != null)) {
             base.Tables.Add(new Quarterly_OrdersDataTable(ds.Tables["Quarterly Orders"]));
         }
         if ((ds.Tables["Sales by Category"] != null)) {
             base.Tables.Add(new Sales_by_CategoryDataTable(ds.Tables["Sales by Category"]));
         }
         if ((ds.Tables["Sales Totals by Amount"] != null)) {
             base.Tables.Add(new Sales_Totals_by_AmountDataTable(ds.Tables["Sales Totals by Amount"]));
         }
         if ((ds.Tables["Summary of Sales by Quarter"] != null)) {
             base.Tables.Add(new Summary_of_Sales_by_QuarterDataTable(ds.Tables["Summary of Sales by Quarter"]));
         }
         if ((ds.Tables["Summary of Sales by Year"] != null)) {
             base.Tables.Add(new Summary_of_Sales_by_YearDataTable(ds.Tables["Summary of Sales by Year"]));
         }
         if ((ds.Tables["CustOrderHist"] != null)) {
             base.Tables.Add(new CustOrderHistDataTable(ds.Tables["CustOrderHist"]));
         }
         if ((ds.Tables["CustOrdersDetail"] != null)) {
             base.Tables.Add(new CustOrdersDetailDataTable(ds.Tables["CustOrdersDetail"]));
         }
         if ((ds.Tables["CustOrdersOrders"] != null)) {
             base.Tables.Add(new CustOrdersOrdersDataTable(ds.Tables["CustOrdersOrders"]));
         }
         if ((ds.Tables["Employee Sales by Country"] != null)) {
             base.Tables.Add(new Employee_Sales_by_CountryDataTable(ds.Tables["Employee Sales by Country"]));
         }
         if ((ds.Tables["Sales by Year"] != null)) {
             base.Tables.Add(new Sales_by_YearDataTable(ds.Tables["Sales by Year"]));
         }
         if ((ds.Tables["SalesByCategory"] != null)) {
             base.Tables.Add(new SalesByCategoryDataTable(ds.Tables["SalesByCategory"]));
         }
         if ((ds.Tables["Ten Most Expensive Products"] != null)) {
             base.Tables.Add(new Ten_Most_Expensive_ProductsDataTable(ds.Tables["Ten Most Expensive Products"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
 protected PACKINGLIST(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["PACK_ID"] != null)) {
             base.Tables.Add(new PACK_IDDataTable(ds.Tables["PACK_ID"]));
         }
         if ((ds.Tables["EXPORT_NOTES_HEAD"] != null)) {
             base.Tables.Add(new EXPORT_NOTES_HEADDataTable(ds.Tables["EXPORT_NOTES_HEAD"]));
         }
         if ((ds.Tables["SHIPPING_INSTR_HEAD"] != null)) {
             base.Tables.Add(new SHIPPING_INSTR_HEADDataTable(ds.Tables["SHIPPING_INSTR_HEAD"]));
         }
         if ((ds.Tables["PICKING_INSTR_HEAD"] != null)) {
             base.Tables.Add(new PICKING_INSTR_HEADDataTable(ds.Tables["PICKING_INSTR_HEAD"]));
         }
         if ((ds.Tables["DELIVERY_INSTR_HEAD"] != null)) {
             base.Tables.Add(new DELIVERY_INSTR_HEADDataTable(ds.Tables["DELIVERY_INSTR_HEAD"]));
         }
         if ((ds.Tables["SPECIAL_INSTR_HEAD"] != null)) {
             base.Tables.Add(new SPECIAL_INSTR_HEADDataTable(ds.Tables["SPECIAL_INSTR_HEAD"]));
         }
         if ((ds.Tables["CUSTOMER_INSTR_HEAD"] != null)) {
             base.Tables.Add(new CUSTOMER_INSTR_HEADDataTable(ds.Tables["CUSTOMER_INSTR_HEAD"]));
         }
         if ((ds.Tables["LABEL_INSTR_HEAD"] != null)) {
             base.Tables.Add(new LABEL_INSTR_HEADDataTable(ds.Tables["LABEL_INSTR_HEAD"]));
         }
         if ((ds.Tables["CARRIER_INST_HEAD"] != null)) {
             base.Tables.Add(new CARRIER_INST_HEADDataTable(ds.Tables["CARRIER_INST_HEAD"]));
         }
         if ((ds.Tables["INVOICE_UDF_HEAD"] != null)) {
             base.Tables.Add(new INVOICE_UDF_HEADDataTable(ds.Tables["INVOICE_UDF_HEAD"]));
         }
         if ((ds.Tables["UDF_HEAD"] != null)) {
             base.Tables.Add(new UDF_HEADDataTable(ds.Tables["UDF_HEAD"]));
         }
         if ((ds.Tables["UDF_HEADER"] != null)) {
             base.Tables.Add(new UDF_HEADERDataTable(ds.Tables["UDF_HEADER"]));
         }
         if ((ds.Tables["HANDLING_INSTR_HEAD"] != null)) {
             base.Tables.Add(new HANDLING_INSTR_HEADDataTable(ds.Tables["HANDLING_INSTR_HEAD"]));
         }
         if ((ds.Tables["PACK_ID_LINE_ITEM"] != null)) {
             base.Tables.Add(new PACK_ID_LINE_ITEMDataTable(ds.Tables["PACK_ID_LINE_ITEM"]));
         }
         if ((ds.Tables["EXPORT_NOTES_DETAIL"] != null)) {
             base.Tables.Add(new EXPORT_NOTES_DETAILDataTable(ds.Tables["EXPORT_NOTES_DETAIL"]));
         }
         if ((ds.Tables["SHIPPING_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new SHIPPING_INSTR_DETAILDataTable(ds.Tables["SHIPPING_INSTR_DETAIL"]));
         }
         if ((ds.Tables["PICKING_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new PICKING_INSTR_DETAILDataTable(ds.Tables["PICKING_INSTR_DETAIL"]));
         }
         if ((ds.Tables["DELIVERY_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new DELIVERY_INSTR_DETAILDataTable(ds.Tables["DELIVERY_INSTR_DETAIL"]));
         }
         if ((ds.Tables["SPECIAL_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new SPECIAL_INSTR_DETAILDataTable(ds.Tables["SPECIAL_INSTR_DETAIL"]));
         }
         if ((ds.Tables["CUSTOMER_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new CUSTOMER_INSTR_DETAILDataTable(ds.Tables["CUSTOMER_INSTR_DETAIL"]));
         }
         if ((ds.Tables["HANDLING_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new HANDLING_INSTR_DETAILDataTable(ds.Tables["HANDLING_INSTR_DETAIL"]));
         }
         if ((ds.Tables["UID_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new UID_INSTR_DETAILDataTable(ds.Tables["UID_INSTR_DETAIL"]));
         }
         if ((ds.Tables["CONFIG_INSTR_DETAIL"] != null)) {
             base.Tables.Add(new CONFIG_INSTR_DETAILDataTable(ds.Tables["CONFIG_INSTR_DETAIL"]));
         }
         if ((ds.Tables["MAXKIT_DETAIL"] != null)) {
             base.Tables.Add(new MAXKIT_DETAILDataTable(ds.Tables["MAXKIT_DETAIL"]));
         }
         if ((ds.Tables["UDF_DET"] != null)) {
             base.Tables.Add(new UDF_DETDataTable(ds.Tables["UDF_DET"]));
         }
         if ((ds.Tables["UDF_DETAIL"] != null)) {
             base.Tables.Add(new UDF_DETAILDataTable(ds.Tables["UDF_DETAIL"]));
         }
         if ((ds.Tables["HP_PN_COMPONENTS"] != null)) {
             base.Tables.Add(new HP_PN_COMPONENTSDataTable(ds.Tables["HP_PN_COMPONENTS"]));
         }
         if ((ds.Tables["BOX"] != null)) {
             base.Tables.Add(new BOXDataTable(ds.Tables["BOX"]));
         }
         if ((ds.Tables["SERIAL_NUM"] != null)) {
             base.Tables.Add(new SERIAL_NUMDataTable(ds.Tables["SERIAL_NUM"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
Example #21
0
		private static void BinReadDataSetFromStream(System.IO.Stream stream, System.Data.DataSet ds, bool mergeSchema)
		{
			//Version
			int version;
			version = IO.StreamPersistence.ReadInt32(stream);

			if (version != c_BinaryVersion)
				throw new BinaryDataSetVersionException();

			//Schema byte[]
			System.Data.DataSet schemaDS; //Questo dataset viene usato solo per leggere lo schema
			byte[] byteSchema = IO.StreamPersistence.ReadByteArray(stream);
			using (System.IO.MemoryStream schemaStream = new System.IO.MemoryStream(byteSchema))
			{
				if (mergeSchema)
				{
					ds.ReadXmlSchema(schemaStream);
					schemaDS = ds;
				}
				else
				{
					schemaDS = new System.Data.DataSet();
					schemaDS.ReadXmlSchema(schemaStream);
				}
			}

			//Tables
			for (int iTable = 0; iTable < schemaDS.Tables.Count; iTable++)
			{
				System.Data.DataTable schemaTable = schemaDS.Tables[iTable];
                //Table exist on the destination
				if (ds.Tables.Contains( schemaTable.TableName ) )
				{
					System.Data.DataTable destinationTable = ds.Tables[ schemaTable.TableName ];

					int rowsCount = IO.StreamPersistence.ReadInt32(stream);
					//Rows
					for (int r = 0; r < rowsCount; r++)
					{
						System.Data.DataRow row = destinationTable.NewRow();
						//Columns
						for (int c = 0; c < schemaTable.Columns.Count; c++)
						{
							string colName = schemaTable.Columns[c].ColumnName;
							object val = BinReadFieldFromStream(stream, schemaTable.Columns[c].DataType); //Il valore viene comunque letto per far avanzare lo stream

							if (destinationTable.Columns.Contains(colName))
								row[ colName ] = val;
						}

						destinationTable.Rows.Add(row);
					}
				}
                else //Note: if the table not exist I will read anyway the columns and rows to correctly position the stream on the next table
                {
                    int rowsCount = IO.StreamPersistence.ReadInt32(stream);
                    //Rows
                    for (int r = 0; r < rowsCount; r++)
                    {
                        //Columns
                        for (int c = 0; c < schemaTable.Columns.Count; c++)
                        {
                            BinReadFieldFromStream(stream, schemaTable.Columns[c].DataType); //Il valore viene comunque letto per far avanzare lo stream
                        }
                    }
                }
			}

			ds.AcceptChanges();
		}
 protected logplotDataSet1(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler1 = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)) {
         System.Data.DataSet ds = new System.Data.DataSet();
         ds.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
         if ((ds.Tables["bitmap"] != null)) {
             base.Tables.Add(new bitmapDataTable(ds.Tables["bitmap"]));
         }
         if ((ds.Tables["crossplot"] != null)) {
             base.Tables.Add(new crossplotDataTable(ds.Tables["crossplot"]));
         }
         if ((ds.Tables["curve"] != null)) {
             base.Tables.Add(new curveDataTable(ds.Tables["curve"]));
         }
         if ((ds.Tables["entity"] != null)) {
             base.Tables.Add(new entityDataTable(ds.Tables["entity"]));
         }
         if ((ds.Tables["fill"] != null)) {
             base.Tables.Add(new fillDataTable(ds.Tables["fill"]));
         }
         if ((ds.Tables["fossil"] != null)) {
             base.Tables.Add(new fossilDataTable(ds.Tables["fossil"]));
         }
         if ((ds.Tables["histogram"] != null)) {
             base.Tables.Add(new histogramDataTable(ds.Tables["histogram"]));
         }
         if ((ds.Tables["horizontal"] != null)) {
             base.Tables.Add(new horizontalDataTable(ds.Tables["horizontal"]));
         }
         if ((ds.Tables["lithology"] != null)) {
             base.Tables.Add(new lithologyDataTable(ds.Tables["lithology"]));
         }
         if ((ds.Tables["message"] != null)) {
             base.Tables.Add(new messageDataTable(ds.Tables["message"]));
         }
         if ((ds.Tables["percent"] != null)) {
             base.Tables.Add(new percentDataTable(ds.Tables["percent"]));
         }
         if ((ds.Tables["resource"] != null)) {
             base.Tables.Add(new resourceDataTable(ds.Tables["resource"]));
         }
         if ((ds.Tables["sample"] != null)) {
             base.Tables.Add(new sampleDataTable(ds.Tables["sample"]));
         }
         if ((ds.Tables["symbol"] != null)) {
             base.Tables.Add(new symbolDataTable(ds.Tables["symbol"]));
         }
         if ((ds.Tables["text"] != null)) {
             base.Tables.Add(new textDataTable(ds.Tables["text"]));
         }
         if ((ds.Tables["well"] != null)) {
             base.Tables.Add(new wellDataTable(ds.Tables["well"]));
         }
         if ((ds.Tables["tadpole"] != null)) {
             base.Tables.Add(new tadpoleDataTable(ds.Tables["tadpole"]));
         }
         if ((ds.Tables["sea"] != null)) {
             base.Tables.Add(new seaDataTable(ds.Tables["sea"]));
         }
         if ((ds.Tables["configuration"] != null)) {
             base.Tables.Add(new configurationDataTable(ds.Tables["configuration"]));
         }
         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.ReadXmlSchema(new System.Xml.XmlTextReader(new System.IO.StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }