コード例 #1
0
        public override global::System.Data.DataSet Clone()
        {
            PandaDS cln = ((PandaDS)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
コード例 #2
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            PandaDS ds = new PandaDS();

            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);
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: jpheary/Argix08
        private void OnInputChanged(object sender, EventArgs e)
        {
            //Event handler for change in an input
            TextBox txt = (TextBox)sender;

            //Set next input
            if (txt.Text.EndsWith("@"))
            {
                if (txt.Name != "txtInput6")
                {
                    setNextInput(txt);
                }
            }
            if (this.txtInput1.Enabled && this.txtInput1.Text.EndsWith("@") &&
                (!this.txtInput2.Enabled || (this.txtInput2.Enabled && this.txtInput2.Text.EndsWith("@"))) &&
                (!this.txtInput3.Enabled || (this.txtInput3.Enabled && this.txtInput3.Text.EndsWith("@"))) &&
                (!this.txtInput4.Enabled || (this.txtInput4.Enabled && this.txtInput4.Text.EndsWith("@"))) &&
                (!this.txtInput5.Enabled || (this.txtInput5.Enabled && this.txtInput5.Text.EndsWith("@"))) &&
                (!this.txtInput6.Enabled || (this.txtInput6.Enabled && this.txtInput6.Text.EndsWith("@"))))
            {
                //Capture
                decimal  weight = Convert.ToDecimal(this.txtWeight.Text);
                string[] inputs = new string[] { this.txtInput1.Text, this.txtInput2.Text, this.txtInput3.Text, this.txtInput4.Text, this.txtInput5.Text, this.txtInput6.Text };
                PandaDS  ds     = ProcessLabelDataRequest(inputs, weight);
                if (ds.PandaTable[0].StatusCode == STATUS_CARTON_OK)
                {
                    //Success
                    this.mOperator.Station.Printer.Print(ds.PandaTable[0].LabelData);
                    string code = ProcessVerifyLabelRequest(ds.PandaTable[0].CartonID, VERIFY_PASS);
                    if (code == VERIFY_YES)
                    {
                        MessageBox.Show("PASS");
                    }
                }
                else
                {
                    //Failure
                    MessageBox.Show("FAIL");
                }
                reset();
            }
        }
コード例 #4
0
        /// <summary>Returns this object as a PandaDS dataset.</summary>
        public DataSet ToDataSet()
        {
            PandaDS ds = null;

            try {
                ds = new PandaDS();
                ds.PacketTable.AddPacketTableRow(this.mReceived,
                                                 this.mMessageLength,
                                                 this.mMessageCode,
                                                 this.mMessageNumber,
                                                 this.mOriginalMessageCode,
                                                 this.mMessageFlags,
                                                 this.mRecordIterator,
                                                 this.mMessageBody,
                                                 this.mValid,
                                                 (this.mException != null?this.mException.ToString():""),
                                                 this.mProcessingTime,
                                                 this.mClientID);
                ds.AcceptChanges();
            }
            catch (Exception ex) { Debug.Write(ex.ToString() + "\n"); }
            return(ds);
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: jpheary/Argix08
        public PandaDS ProcessLabelDataRequest(string[] inputs, decimal weight)
        {
            //Create a new carton
            string cartonID = "", zpl = "";
            int    statusCode        = STATUS_NONE;
            ApplicationException aex = null;
            PandaDS ds = new PandaDS();

            //Validate for non-carton requests (scanner tripped)
            bool   hasInputData = false;
            string _inputs      = "";

            for (int i = 0; i < inputs.Length; i++)
            {
                if (inputs[i].Trim().Length > 0)
                {
                    hasInputData = true;
                }
                _inputs += (i + 1).ToString() + "=" + inputs[i] + "; ";
            }
            ArgixTrace.WriteLine(new TraceMessage("LABEL DATA REQUEST: " + _inputs + "weight=" + weight.ToString(), App.EventLogName, LogLevel.Information, "PandaSvc"));
            if (!hasInputData && weight == 0)
            {
                ArgixTrace.WriteLine(new TraceMessage("LABEL DATA RESPONSE: no inputs; no weight; processing aborted...", App.EventLogName, LogLevel.Information, "PandaSvc"));
                return(ds);
            }
            try {
                //Begin processing a new message request
                //if(this.LabelDataRequest != null) this.LabelDataRequest(null,EventArgs.Empty);
                try {
                    //Create a default carton identifier
                    DateTime dt  = DateTime.Now;
                    int      sec = ((3600 * dt.Hour) + (60 * dt.Minute) + dt.Second);
                    cartonID = dt.ToString("yyyy").Substring(3, 1) + dt.ToString("MM") + dt.ToString("dd") + sec.ToString("00000") + "0000";

                    //Get an outbound label for this carton
                    SortedItem sortedItem = this.mOperator.ProcessInputs(inputs, weight);
                    if (sortedItem != null)
                    {
                        try {
                            cartonID = sortedItem.LabelNumber;
                            zpl      = sortedItem.LabelFormat;
                            sortedItem.ThrowException();
                            statusCode = STATUS_CARTON_OK;
                            ArgixTrace.WriteLine(new TraceMessage("Carton processing successful [label data]...", App.EventLogName, LogLevel.Debug, "PandaSvc"));
                        }
                        catch (Tsort.InboundLabelException ex) {
                            //Test for various inbound label exceptions
                            bool allInvalid = true;
                            for (int i = 0; i < inputs.Length; i++)
                            {
                                if (inputs[i].Trim().Length > 0)
                                {
                                    allInvalid = false; break;
                                }
                            }
                            if (allInvalid)
                            {
                                statusCode = STATUS_SCANERROR_NODATA;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [no data from scanner]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                            allInvalid = true;
                            for (int i = 0; i < inputs.Length; i++)
                            {
                                if (inputs[i].Replace("?", "").Trim().Length > 0)
                                {
                                    allInvalid = false; break;
                                }
                            }
                            if (allInvalid && statusCode == STATUS_NONE)
                            {
                                statusCode = STATUS_SCANERROR_NOREAD;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [no read: ?]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                            allInvalid = true;
                            for (int i = 0; i < inputs.Length; i++)
                            {
                                if (inputs[i].Replace("#", "").Trim().Length > 0)
                                {
                                    allInvalid = false; break;
                                }
                            }
                            if (allInvalid && statusCode == STATUS_NONE)
                            {
                                statusCode = STATUS_SCANERROR_CONFLICT;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [label conflict: #]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                            if (statusCode == STATUS_NONE)
                            {
                                statusCode = STATUS_SCANERROR_LABELFAILED;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [inbound label exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                        }
                        catch (Tsort.ZeroWeightException ex) {
                            statusCode = STATUS_SCANERROR_WEIGHTBAD;
                            ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [zero weight exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        catch (Tsort.OverWeightException ex) {
                            statusCode = STATUS_SCANERROR_WEIGHTBAD;
                            ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [over weight exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        catch (Tsort.DestinationRoutingException ex) {
                            statusCode = STATUS_SCANERROR_LABELFAILED;
                            ArgixTrace.WriteLine(new TraceMessage("Sorted item processing failed [destination/routing exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        catch (Exception ex) {
                            statusCode = STATUS_SCANERROR_LABELFAILED;
                            ArgixTrace.WriteLine(new TraceMessage("Sorted item processing failed [unexpected exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        zpl = zpl.Replace(Tsort.Labels.TokenLibrary.STATUSCODE, statusCode.ToString());
                    }
                    else
                    {
                        aex        = new ApplicationException("Carton processing failed [no sorted item]...");
                        statusCode = STATUS_SCANERROR_LABELFAILED;
                        zpl        = createErrorLabelFormat(STATUS_SCANERROR_LABELFAILED, aex);
                        ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Warning, "PandaSvc"));
                    }
                }
                catch (Exception ex) {
                    aex        = new ApplicationException("Carton processing failed [sorted item processing threw an exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", ex);
                    statusCode = STATUS_SCANERROR_LABELFAILED;
                    zpl        = createErrorLabelFormat(STATUS_SCANERROR_LABELFAILED, ex);
                    ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Warning, "PandaSvc"));
                }
                ds.PandaTable.AddPandaTableRow(cartonID, statusCode, zpl);
                ds.AcceptChanges();
            }
            catch (Exception ex) {
                aex        = new ApplicationException("Carton processing failed [unexpected exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", ex);
                statusCode = STATUS_ERROR_UNKNOWN;
                zpl        = createErrorLabelFormat(STATUS_ERROR_UNKNOWN, ex);
                ds.PandaTable.AddPandaTableRow(cartonID, statusCode, zpl);
                ds.AcceptChanges();
                ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Warning, "PandaSvc"));
            }
            finally {
                ArgixTrace.WriteLine(new TraceMessage("LABEL DATA RESPONSE: " + cartonID + "; " + statusCode.ToString(), App.EventLogName, LogLevel.Information, "PandaSvc"));
                //    if(this.LabelDataRequestComplete != null) {
                //        PandaDS _ds = new PandaDS();
                //        _ds.CartonTable.AddCartonTableRow(cartonID,(inputs.Length>0?inputs[0]:""),(inputs.Length>1?inputs[1]:""),(inputs.Length>2?inputs[2]:""),(inputs.Length>3?inputs[3]:""),(inputs.Length>4?inputs[4]:""),(inputs.Length>5?inputs[5]:""),weight,statusCode,zpl,"",(aex!=null?aex.Message:""),"");
                //        this.LabelDataRequestComplete(this,new PandaLabelDataEventArgs(_ds.CartonTable[0]));
                //    }
            }
            return(ds);
        }
コード例 #6
0
ファイル: pandaui.cs プロジェクト: jpheary/Argix08
        private void OnMenuClick(object sender, System.EventArgs e)
        {
            //Event hanlder for menu click events
            try {
                MenuItem mnu = (MenuItem)sender;
                switch (mnu.Text)
                {
                case "Open":
                    switch (this.tabMain.SelectedTab.Name)
                    {
                    case "tabCtns":         break;

                    case "tabMsgs":
                        OpenFileDialog dlgOpen = new OpenFileDialog();
                        dlgOpen.Filter      = "Text Files (*.xml) | *.xml";
                        dlgOpen.FilterIndex = 0;
                        if (dlgOpen.ShowDialog(this) == DialogResult.OK)
                        {
                            PandaDS packets = new PandaDS();
                            packets.ReadXml(dlgOpen.FileName, XmlReadMode.ReadSchema);
                            if (packets.PacketTable.Rows.Count == 0)
                            {
                                MessageBox.Show(this, "No PandA packets found in file " + dlgOpen.FileName + ".", "Open PandA Packets", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                for (int i = 0; i < packets.PacketTable.Rows.Count; i++)
                                {
                                    PandaDS.PacketTableRow packet = packets.PacketTable[i];
                                    this.lsvMsgs.Items.Add(new ListViewItem(new string[] { packet.ClientID, packet.Received.ToString("MM-dd-yyyy HH:mm:ss.fff"), packet.ProcessingTime.ToString(), packet.MessageLength.ToString(), packet.MessageCode.ToString(), packet.MessageNumber.ToString(), packet.OriginalMessageCode.ToString(), packet.MessageFlags.ToString(), packet.RecordIterator.ToString(), packet.MessageBody, packet.Valid.ToString(), packet.Exception }));
                                }
                            }
                        }
                        break;

                    case "tabTrace":        break;
                    }
                    break;

                case "Clear":
                    switch (this.tabMain.SelectedTab.Name)
                    {
                    case "tabCtns":         this.lsvCtns.Items.Clear(); break;

                    case "tabMsgs":         this.lsvMsgs.Items.Clear(); break;

                    case "tabTrace":        this.txtTrace.Clear(); break;
                    }
                    break;

                case "Save":
                    #region Save a view to file
                    SaveFileDialog dlgSave = new SaveFileDialog();
                    dlgSave.AddExtension    = true;
                    dlgSave.FilterIndex     = 0;
                    dlgSave.OverwritePrompt = true;
                    switch (this.tabMain.SelectedTab.Name)
                    {
                    case "tabCtns":
                        dlgSave.Filter   = "Text Files (*.xml) | *.xml";
                        dlgSave.Title    = "Save Cartons As...";
                        dlgSave.FileName = "cartons_" + DateTime.Today.ToString("yyyyMMdd") + ".xml";
                        if (dlgSave.ShowDialog(this) == DialogResult.OK)
                        {
                            PandaDS cartons = new PandaDS();
                            #region Populate dataset with all cartons that are in lsvCtns
                            for (int i = 0; i < this.lsvCtns.Items.Count; i++)
                            {
                                PandaDS.CartonTableRow carton = cartons.CartonTable.NewCartonTableRow();
                                carton.CartonID       = this.lsvCtns.Items[i].SubItems[0].Text;
                                carton.StatusCode     = int.Parse(this.lsvCtns.Items[i].SubItems[1].Text);
                                carton.LabelFormat    = this.lsvCtns.Items[i].SubItems[2].Text;
                                carton.LabelException = this.lsvCtns.Items[i].SubItems[3].Text;
                                carton.Verify         = this.lsvCtns.Items[i].SubItems[4].Text;
                                carton.SaveException  = this.lsvCtns.Items[i].SubItems[5].Text;
                                carton.Barcode1       = this.lsvCtns.Items[i].SubItems[6].Text;
                                carton.Barcode2       = this.lsvCtns.Items[i].SubItems[7].Text;
                                carton.Barcode3       = this.lsvCtns.Items[i].SubItems[8].Text;
                                carton.Barcode4       = this.lsvCtns.Items[i].SubItems[9].Text;
                                carton.Barcode5       = this.lsvCtns.Items[i].SubItems[10].Text;
                                carton.Barcode6       = this.lsvCtns.Items[i].SubItems[11].Text;
                                carton.ItemWeight     = decimal.Parse(this.lsvCtns.Items[i].SubItems[12].Text);
                                cartons.CartonTable.AddCartonTableRow(carton);
                            }
                            #endregion
                            cartons.WriteXml(dlgSave.FileName, XmlWriteMode.WriteSchema);
                        }
                        break;

                    case "tabMsgs":
                        dlgSave.Filter   = "Text Files (*.xml) | *.xml";
                        dlgSave.Title    = "Save Packets As...";
                        dlgSave.FileName = "packets_" + DateTime.Today.ToString("yyyyMMdd") + ".xml";
                        if (dlgSave.ShowDialog(this) == DialogResult.OK)
                        {
                            PandaDS packets = new PandaDS();
                            #region Populate dataset with all packets that are in lsvMsgs
                            for (int i = 0; i < this.lsvMsgs.Items.Count; i++)
                            {
                                PandaDS.PacketTableRow packet = packets.PacketTable.NewPacketTableRow();
                                packet.ClientID            = this.lsvMsgs.Items[i].SubItems[0].Text;
                                packet.Received            = DateTime.Parse(this.lsvMsgs.Items[i].SubItems[1].Text);
                                packet.ProcessingTime      = float.Parse(this.lsvMsgs.Items[i].SubItems[2].Text);
                                packet.MessageLength       = int.Parse(this.lsvMsgs.Items[i].SubItems[3].Text);
                                packet.MessageCode         = int.Parse(this.lsvMsgs.Items[i].SubItems[4].Text);
                                packet.MessageNumber       = int.Parse(this.lsvMsgs.Items[i].SubItems[5].Text);
                                packet.OriginalMessageCode = int.Parse(this.lsvMsgs.Items[i].SubItems[6].Text);
                                packet.MessageFlags        = int.Parse(this.lsvMsgs.Items[i].SubItems[7].Text);
                                packet.RecordIterator      = int.Parse(this.lsvMsgs.Items[i].SubItems[8].Text);
                                packet.MessageBody         = this.lsvMsgs.Items[i].SubItems[9].Text;
                                packet.Valid     = bool.Parse(this.lsvMsgs.Items[i].SubItems[10].Text);
                                packet.Exception = this.lsvMsgs.Items[i].SubItems[11].Text;
                                packets.PacketTable.AddPacketTableRow(packet);
                            }
                            #endregion
                            packets.WriteXml(dlgSave.FileName, XmlWriteMode.WriteSchema);
                        }
                        break;

                    case "tabTrace":
                        dlgSave.Filter   = "Text Files (*.txt) | *.txt";
                        dlgSave.Title    = "Save Trace Log As...";
                        dlgSave.FileName = "tracelog_" + DateTime.Today.ToString("yyyyMMdd") + ".txt";
                        if (dlgSave.ShowDialog(this) == DialogResult.OK)
                        {
                            this.txtTrace.SaveFile(dlgSave.FileName, RichTextBoxStreamType.PlainText);
                        }
                        break;
                    }
                    #endregion
                    break;

                case "Run":
                    switch (this.tabMain.SelectedTab.Name)
                    {
                    case "tabCtns":         break;

                    case "tabMsgs":
                        #region Populate datarow with all fields that are in lsvMsgs selected item
                        PandaDS packets = new PandaDS();
                        PandaDS.PacketTableRow packet = packets.PacketTable.NewPacketTableRow();
                        packet.ClientID            = this.lsvMsgs.SelectedItems[0].SubItems[0].Text;
                        packet.Received            = DateTime.Parse(this.lsvMsgs.SelectedItems[0].SubItems[1].Text);
                        packet.ProcessingTime      = float.Parse(this.lsvMsgs.SelectedItems[0].SubItems[2].Text);
                        packet.MessageLength       = int.Parse(this.lsvMsgs.SelectedItems[0].SubItems[3].Text);
                        packet.MessageCode         = int.Parse(this.lsvMsgs.SelectedItems[0].SubItems[4].Text);
                        packet.MessageNumber       = int.Parse(this.lsvMsgs.SelectedItems[0].SubItems[5].Text);
                        packet.OriginalMessageCode = int.Parse(this.lsvMsgs.SelectedItems[0].SubItems[6].Text);
                        packet.MessageFlags        = int.Parse(this.lsvMsgs.SelectedItems[0].SubItems[7].Text);
                        packet.RecordIterator      = int.Parse(this.lsvMsgs.SelectedItems[0].SubItems[8].Text);
                        packet.MessageBody         = this.lsvMsgs.SelectedItems[0].SubItems[9].Text;
                        packet.Valid     = bool.Parse(this.lsvMsgs.SelectedItems[0].SubItems[10].Text);
                        packet.Exception = this.lsvMsgs.SelectedItems[0].SubItems[11].Text;
                        #endregion
                        PandaPacket request = new PandaPacket(packet);
                        this.mPandaSvc.ProcessPandARequest("", request);
                        break;

                    case "tabTrace":        break;
                    }
                    break;
                }
            }
            catch (Exception ex) { reportError(ex); }
        }
コード例 #7
0
            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();
                PandaDS ds = new PandaDS();

                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 = "PandaTableDataTable";
                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);
            }