عرض مشاركة واحدة
قديم 28-Nov-2011, 10:22 PM   #28
humam
مشرف منتدى المطورين
افتراضي

شفرة الزر Submit

هنا ان الشفرة لاتختلف كثيرا الشفرة التي اوردناها في المثال الاول لذا لن اتوسع في شرحها سوف ابين فقط نقطة الاختلاف عن الشفرة السابقة حيث ان هذه الشفرة سوف ترتكزعلى استخدام الطريقة eConnect_EntryPoint والتي تستخدم الى ارسال الوثائق الى الجريت بلينز وكما نعلم ان هذه الطريقة سوف تحتاج الى برامتر من نوع XML Document في الشفرة السابقة قمنا بأدخال الكائن بشكل يدوي عبر كائن النص ثم امراره الى الطريقة هنا سوف نستدعي الاجراء الذي صممناه SerializeSOPObject لتكوين وثيقة XML برمجيا ثم تحويلها الى ملف ومن ثم نقراء وثيقة XML من هذا الملف بدل القراءة من مربع النص اما مربع النص الموجود هنا فهو فقط لاظهار تاثير مرئي للمستخدم لملاحظة وثيقة XML التي سوف يتم ارسالها ويمكن نسخ هذه الوثية وتنسيقها بشكل جيد ضمن اطار العمل .NET وبهذا ينتهي المثال الخاص بالمكتبة Serialization
كود:
Dim SOPInvoiceDocument As String
        Dim ConnectionString As String
        'Add referance to System.EnterpriseServices
        Dim eConnectObject As New eConnectMethods
        Dim Result As Boolean
        Dim xmldoc As New Xml.XmlDocument
        Try
            'Call the SerializeSOPObject subroutine and specify
            'a file name Create eConnect XML Document
            SerializeSOPObject("SOPInvoice.xml")
            'Create an XML document object and load it with the XML     
            from the
            'file that the SerializeSOPObject subroutine created
            xmldoc.Load("SOPInvoice.xml")
            'Convert the XML to a string
            SOPInvoiceDocument = xmldoc.OuterXml
            XML.Text = xmldoc.OuterXml
            XML.ScrollBars = ScrollBars.Both
            'Set the connection string
            'This connection string uses integrated security to connect   
            to the 
            'TWO database on the local computer
            ConnectionString = "Data Source=ISYS-MYNET\GP10;Integrated 
            Security=SSPI;" _
            & "Persist Security Info=False;Initial Catalog=TWO;"
            'Send XML document to GP
          Result = eConnectObject.eConnect_EntryPoint(ConnectionString,  
          EnumTypes.ConnectionStringType.SqlClient, _
            SOPInvoiceDocument, EnumTypes.SchemaValidationType.None)
        Catch ex As eConnectException
            MsgBox(" XML error " + ex.Message)
        Catch ex As SystemException
            MsgBox("Error:" + ex.Message)
        End Try
__________________
GP Techno-Functional Consultant
humam غير متواجد حالياً   رد مع اقتباس