API for parse Posting XML

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Xml

Partial Class api01get
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim api_key As String = Request.QueryString("key")
        Dim app_key As String = Request.QueryString("app")
        '#
        Dim date_from As DateTime = System.DateTime.Now.AddHours(-148)
        Dim date_to As DateTime = System.DateTime.Now
        '#
        Dim df As String = Request.QueryString("df")
        If df <> "" And IsDate(df) = True Then
            date_from = CDate(df)
        End If
        '#
        Dim dt As String = Request.QueryString("dt")
        If df <> "" And IsDate(dt) = True Then
            date_to = CDate(dt)
        End If
        '#
        Dim message As String = ""
        Dim success As Integer = 1       
        'Return xml data
        Dim xml_data As String = ""
        If success = 1 Then
            Try
                Dim auth As New senddr.api01.auth
                Dim result As Integer = 0
                result = auth.get_auth(Request, api_key, app_key)
                If result = 1 Then
                    Dim companyID As Integer = auth.getCompany()
                    Dim company_userID As Integer = auth.getCompanyUser()
                    'xml_data = getdata(companyID, company_userID, date_from, date_to)
                ElseIf result = 2 Then
                    xml_data = "<response><code>3</code><message>Login Failed</message></response>"
                ElseIf result = 3 Then
                    xml_data = "<response><code>4</code><message>Too Many Requests. Please wait and retry</message></response>"
                ElseIf result = 4 Then
                    xml_data = "<response><code>7</code><message>Unauthorized Application</message></response>"
                Else
                    xml_data = "<response><code>5</code><message>Not Processed</message></response>"
                End If
            Catch ex As Exception
                success = 0
                xml_data = "<response><code>6</code><message>Processing Error: " + ex.Message + "</message></response>"
            End Try
            Response.ClearContent()
            Response.ContentType = "text/xml"
            Response.StatusCode = 200
            Response.StatusDescription = "OK"
            Response.ContentEncoding = Encoding.UTF8
            Response.Write(xml_data)
        Else
            Response.ContentType = "text/plain"
            Response.StatusCode = 200
            Response.StatusDescription = "Request XML not in correct format"
            Response.Write("<response><code>2</code><message>Request XML not in correct format: " + message + "</message></response>")
        End If
       
    End Sub


    Function parseInvoice(ByVal doc As XmlDocument, ByVal customer_public_key As String, ByVal customer_secret_key As String, _
             ByVal username As String) As String
        Dim xml_data As String = ""
        Dim counter As Integer = 0
        Try
            Dim now As DateTime = System.DateTime.Now
            Dim invoice_uid As String = ""
            Dim invoice_typeID As Integer = 0
            Dim contact_uid As String = parseContact(doc, customer_public_key, customer_secret_key, username)
            xml_data += "<response><code>0</code><message>contact_uid: " + contact_uid + "</message></response>"

            Dim currencyID As Integer = 0
            Dim currency_code As String = ""
            Dim invoice_number As String = ""
            Dim invoice_date As String = ""
            Dim dinvoice_date As DateTime = System.DateTime.Now()
            Dim invoice_due_date As String = ""
            Dim dinvoice_due_date As DateTime = System.DateTime.Now()
            Dim dinvoice_expected_payment_date As DateTime = System.DateTime.Now()
            Dim purchase_order_number As String = ""
            Dim invoice_desc As String = ""
            Dim invoice_internal_notes As String = ""
            Dim flag_tax_included As Integer = 0
            Dim invoice_tax_amount As Decimal = 0
            Dim invoice_net_amount As Decimal = 0
            Dim invoice_amount As Decimal = 0
            Dim approvalID As Integer = 2
            Dim category_uid As String = 0
            Dim tags As String = ""
            Dim assigned_customer_user_uid As String = 0
            '#
            Dim oNode As XmlNode = doc.DocumentElement
            Dim oNodeList As XmlNodeList = oNode.SelectNodes("invoice")
            Dim node As XmlNode
            For Each node In oNodeList
                counter += 1
                Try
                    'invoice_uid = node("invoice_uid").InnerText
                    invoice_typeID = CInt(node("invoice_typeID").InnerText)
                    'contact_uid = node("contact_uid").InnerText
                    currencyID = CInt(node("currencyID").InnerText)
                    currency_code = node("currency_code").InnerText
                    invoice_number = node("invoice_number").InnerText
                    invoice_date = node("invoice_date").InnerText
                    invoice_due_date = node("invoice_due_date").InnerText
                    purchase_order_number = node("purchase_order_number").InnerText
                    invoice_desc = node("invoice_desc").InnerText
                    'invoice_internal_notes = node("invoice_internal_notes").InnerText
                    'flag_tax_included = CInt(node("flag_tax_included").InnerText)
                    invoice_tax_amount = CDec(node("invoice_tax_amount").InnerText)
                    invoice_net_amount = CDec(node("invoice_net_amount").InnerText)
                    invoice_amount = CDec(node("invoice_amount").InnerText)
                    'approvalID = CInt(node("approvalID").InnerText)
                    'category_uid = node("category_uid").InnerText
                    'tags = node("tags").InnerText
                    'assigned_customer_user_uid = node("assigned_customer_user_uid").InnerText
                Catch ex As Exception
                    xml_data += "<response><code>24</code><message>Invoice XML Field Error: " + ex.Message + "</message></response>"
                End Try
                xml_data += "<response><code>24</code><message>invoice_number: " + invoice_number + "</message></response>"
                Try
                    dinvoice_date = Convert.ToDateTime(invoice_date)
                    dinvoice_due_date = Convert.ToDateTime(invoice_due_date)
                    dinvoice_expected_payment_date = dinvoice_due_date
                Catch ex As Exception
                    xml_data += "<response><code>25</code><message>Invoice XML Date Error: " + ex.Message + "  " + invoice_date + "</message></response>"
                End Try
                'Save the data

                Dim return_invoiceID As Integer = 0
                Dim return_uid As String = ""
                '#
                return_invoiceID = saveInvoice(customer_public_key, customer_secret_key, username, _
                     invoice_uid, invoice_typeID, contact_uid, currencyID, _
                                           invoice_number, dinvoice_date, dinvoice_due_date, dinvoice_expected_payment_date, _
                                           purchase_order_number, invoice_desc, invoice_internal_notes, flag_tax_included, _
                                           invoice_tax_amount, invoice_net_amount, invoice_amount, approvalID, _
                                           category_uid, tags, assigned_customer_user_uid)
                xml_data += "<response><code>25</code><message>Invoice ID: " + CStr(return_invoiceID) + "</message></response>"
                '------------------------------------------------------
                'loop through line items for this invoice
                Dim invoice_itemID As Integer = 0
                Dim price_listID As Integer = 0
                Dim invoice_item_typeID As Integer = 0
                Dim invoice_item_desc As String = ""
                Dim invoice_item_tax_amount As Decimal = 0
                Dim invoice_item_net_amount As Decimal = 0
                Dim invoice_item_amount As Decimal = 0
                Dim item_qty As Integer = 0
                Dim item_unit_price As Decimal = 0
                Dim tax_rate As Decimal = 0
                Dim item_approvalID As Integer = 1
                Dim tax_uid As String = ""
                Dim account_uid As String = ""
                Dim ItemNodeList As XmlNodeList = node.SelectNodes("/invoices/invoice/invoice_item")
                Dim item_node As XmlNode
                For Each item_node In ItemNodeList
                    counter += 1
                    Try
                        'invoice_itemID = CInt(item_node("invoice_itemID").InnerText)
                        'price_listID = CInt(item_node("price_listID").InnerText)
                        'invoice_item_typeID = CInt(item_node("invoice_item_typeID").InnerText)
                        invoice_item_desc = item_node("invoice_item_desc").InnerText
                        invoice_item_tax_amount = CDec(item_node("invoice_item_tax_amount").InnerText)
                        invoice_item_net_amount = CDec(item_node("invoice_item_net_amount").InnerText)
                        invoice_item_amount = CDec(item_node("invoice_item_amount").InnerText)
                        item_qty = CInt(item_node("item_qty").InnerText)
                        item_unit_price = CDec(item_node("item_unit_price").InnerText)
                        tax_rate = CDec(item_node("tax_rate").InnerText)
                        'item_approvalID = CInt(item_node("approvalID").InnerText)
                        'tax_uid = item_node("tax_uid").InnerText
                        'account_uid = item_node("account_uid").InnerText
                    Catch ex As Exception
                        xml_data += "<response><code>24</code><message>Invoice Item XML Field Error: " + ex.Message + "</message><type>invoice</type></response>"
                    End Try
                    'xml_data += "II Saved " + CStr(invoice_itemID) + "#" + CStr(return_invoiceID) + "#"
                    saveInvoiceItem(customer_public_key, customer_secret_key, username, _
                                    invoice_itemID, return_invoiceID, tax_uid, account_uid, _
                                    price_listID, invoice_item_typeID, invoice_item_desc, _
                                    invoice_item_tax_amount, invoice_item_net_amount, invoice_item_amount, _
                                    item_qty, item_unit_price, tax_rate, item_approvalID)
                Next
                '------------------------------------------------------
                'Invoice Balances
                updateInvoiceBalances(return_invoiceID, customer_public_key, customer_secret_key, username)
                '------------------------------------------------------
                'Response
                If return_invoiceID > 0 Then
                    xml_data += "<response><code>20</code><message>Invoice Added</message><type>invoice</type><uid>" + return_uid + "</uid></response>"
                Else
                    xml_data += "<response><code>22</code><message>Incorrect Credentials</message><type>invoice</type></response>"
                End If
            Next
        Catch ex As Exception
            xml_data += "Error Parsing XML: " + ex.Message
        End Try
        '-----------------------------------------------------------------------
        If counter = 0 Then
            xml_data += "<response><code>23</code><message>No Invoice Data Saved</message><type>invoice</type></response>"
        End If
        Return xml_data
    End Function

    Function saveInvoice(ByVal customer_public_key As String, ByVal customer_secret_key As String, ByVal username As String, _
                 ByVal invoice_uid As String, ByVal invoice_typeID As Integer, _
                 ByVal contact_uid As String, ByVal currencyID As Integer, ByVal invoice_number As String, _
                 ByVal dinvoice_date As DateTime, ByVal dinvoice_due_date As DateTime, _
                 ByVal dinvoice_expected_payment_date As DateTime, ByVal purchase_order_number As String, _
                 ByVal invoice_desc As String, ByVal invoice_internal_notes As String, _
                 ByVal flag_tax_included As Integer, ByVal invoice_tax_amount As Decimal, _
                 ByVal invoice_net_amount As Decimal, ByVal invoice_amount As Decimal, _
                 ByVal approvalID As Integer, _
                 ByVal category_uid As String, ByVal tags As String, ByVal assigned_customer_user_uid As String) As Integer

        Dim return_invoiceID As Integer = 0
        Dim return_uid As String = ""
        Dim con As New Global.yendo.connection()
        Dim myCommand As SqlCommand
        myCommand = New SqlCommand()
        Dim myDataReader As SqlDataReader
        myCommand.Connection = con.initDB()
        myCommand.CommandText = "st_api_invoice"
        myCommand.CommandType = CommandType.StoredProcedure
        myCommand.Parameters.Add(New SqlParameter("@customer_public_key", customer_public_key))
        myCommand.Parameters.Add(New SqlParameter("@customer_secret_key", customer_secret_key))
        myCommand.Parameters.Add(New SqlParameter("@username", username))
        myCommand.Parameters.Add(New SqlParameter("@invoice_uid", invoice_uid))
        myCommand.Parameters.Add(New SqlParameter("@invoice_typeID", invoice_typeID))
        myCommand.Parameters.Add(New SqlParameter("@contact_uid", contact_uid))
        myCommand.Parameters.Add(New SqlParameter("@currencyID", currencyID))
        myCommand.Parameters.Add(New SqlParameter("@invoice_number", invoice_number))
        myCommand.Parameters.Add(New SqlParameter("@invoice_date", dinvoice_date))
        myCommand.Parameters.Add(New SqlParameter("@invoice_due_date", dinvoice_due_date))
        myCommand.Parameters.Add(New SqlParameter("@invoice_expected_payment_date", dinvoice_expected_payment_date))
        myCommand.Parameters.Add(New SqlParameter("@purchase_order_number", purchase_order_number))
        myCommand.Parameters.Add(New SqlParameter("@invoice_desc", invoice_desc))
        myCommand.Parameters.Add(New SqlParameter("@invoice_internal_notes", invoice_internal_notes))
        myCommand.Parameters.Add(New SqlParameter("@flag_tax_included", flag_tax_included))
        myCommand.Parameters.Add(New SqlParameter("@invoice_tax_amount", invoice_tax_amount))
        myCommand.Parameters.Add(New SqlParameter("@invoice_net_amount", invoice_net_amount))
        myCommand.Parameters.Add(New SqlParameter("@invoice_amount", invoice_amount))
        myCommand.Parameters.Add(New SqlParameter("@approvalID", approvalID))
        myCommand.Parameters.Add(New SqlParameter("@category_uid", category_uid))
        myCommand.Parameters.Add(New SqlParameter("@tags", tags))
        myCommand.Parameters.Add(New SqlParameter("@assigned_customer_user_uid", assigned_customer_user_uid))
        myDataReader = myCommand.ExecuteReader()
        Do While myDataReader.Read()
            return_uid = myDataReader("return_uid").ToString()
            return_invoiceID = myDataReader.GetInt32(myDataReader.GetOrdinal("invoiceID"))
        Loop
        myDataReader.Close()
        myCommand.Connection.Close()
        Return return_invoiceID
    End Function

    Function saveInvoiceItem(ByVal customer_public_key As String, ByVal customer_secret_key As String, ByVal username As String, _
                         ByVal invoice_itemID As Integer, ByVal invoiceID As Integer, ByVal tax_uid As String, _
                        ByVal account_uid As String, ByVal price_listID As Integer, ByVal invoice_item_typeID As Integer, _
                        ByVal invoice_item_desc As String, ByVal invoice_item_tax_amount As Decimal, _
                        ByVal invoice_item_net_amount As Decimal, ByVal invoice_item_amount As Decimal, _
                        ByVal item_qty As Integer, ByVal item_unit_price As Decimal, ByVal tax_rate As Decimal, _
                        ByVal approvalID As Integer) As Integer
        Dim con As New Global.yendo.connection()
        Dim myCommand As SqlCommand
        myCommand = New SqlCommand()
        myCommand.Connection = con.initDB()
        myCommand.CommandText = "st_api_invoice_item"
        myCommand.CommandType = CommandType.StoredProcedure
        myCommand.Parameters.Add(New SqlParameter("@customer_public_key", customer_public_key))
        myCommand.Parameters.Add(New SqlParameter("@customer_secret_key", customer_secret_key))
        myCommand.Parameters.Add(New SqlParameter("@username", username))
        myCommand.Parameters.Add(New SqlParameter("@invoice_itemID", invoice_itemID))
        myCommand.Parameters.Add(New SqlParameter("@invoiceID", invoiceID))
        myCommand.Parameters.Add(New SqlParameter("@tax_uid", tax_uid))
        myCommand.Parameters.Add(New SqlParameter("@account_uid", account_uid))
        myCommand.Parameters.Add(New SqlParameter("@price_listID", price_listID))
        myCommand.Parameters.Add(New SqlParameter("@invoice_item_typeID", invoice_item_typeID))
        myCommand.Parameters.Add(New SqlParameter("@invoice_item_desc", invoice_item_desc))
        myCommand.Parameters.Add(New SqlParameter("@invoice_item_tax_amount", invoice_item_tax_amount))
        myCommand.Parameters.Add(New SqlParameter("@invoice_item_net_amount", invoice_item_net_amount))
        myCommand.Parameters.Add(New SqlParameter("@invoice_item_amount", invoice_item_amount))
        myCommand.Parameters.Add(New SqlParameter("@item_qty", item_qty))
        myCommand.Parameters.Add(New SqlParameter("@item_unit_price", item_unit_price))
        myCommand.Parameters.Add(New SqlParameter("@tax_rate", tax_rate))
        myCommand.Parameters.Add(New SqlParameter("@approvalID", approvalID))
        myCommand.ExecuteNonQuery()
        myCommand.Connection.Close()
        Return 1
    End Function

    Sub updateInvoiceBalances(ByVal invoiceID As Integer, ByVal customer_public_key As String, ByVal customer_secret_key As String, ByVal username As String)
        Dim con As New Global.yendo.connection()
        Dim myCommand As SqlCommand
        myCommand = New SqlCommand()
        myCommand.Connection = con.initDB()
        myCommand.CommandText = "st_api_invoice_balances"
        myCommand.CommandType = CommandType.StoredProcedure
        myCommand.Parameters.Add(New SqlParameter("@invoiceID", invoiceID))
        myCommand.Parameters.Add(New SqlParameter("@customer_public_key", customer_public_key))
        myCommand.Parameters.Add(New SqlParameter("@customer_secret_key", customer_secret_key))
        myCommand.Parameters.Add(New SqlParameter("@username", username))
        myCommand.ExecuteNonQuery()
        myCommand.Connection.Close()
    End Sub


    Function parseContact(ByVal doc As XmlDocument, ByVal customer_public_key As String, ByVal customer_secret_key As String, _
             ByVal username As String) As String
        Dim xml_data As String = ""

        Dim return_uid As String = ""
        Dim counter As Integer = 0
        Try
            Dim contact_uid As String = ""
            Dim contact_typeID As Integer = 1
            Dim contact_name As String = ""
            Dim contact_company_name As String = ""
            Dim contact_email As String = ""
            Dim address1 As String = ""
            Dim address2 As String = ""
            Dim address3 As String = ""
            Dim address4 As String = ""
            Dim country_code As String = ""
            Dim countryID As Integer = 103
            Dim contact_telephone As String = ""
            Dim contact_fax As String = ""
            Dim contact_mobile As String = ""
            Dim contact_notes As String = ""
            Dim receivable_taxID As Integer = 0
            Dim payable_taxID As Integer = 0
            Dim tax_reference As String = ""
            Dim company_reference As String = ""
            Dim bank_sort As String = ""
            Dim bank_number As String = ""
            Dim bank_iban As String = ""
            Dim contact_ref As String = ""
            Dim approvalID As Integer = 1
            Dim basecamp_id As Integer = 0
            '#
            Dim oNode As XmlNode = doc.DocumentElement
            Dim oNodeList As XmlNodeList = oNode.SelectNodes("/invoices/invoice/contact")
            Dim node As XmlNode
            For Each node In oNodeList
                counter += 1
                Try
                    'contact_uid = node("contact_uid").InnerText
                    'contact_typeID = CInt(node("contact_typeID").InnerText)
                    contact_name = node("contact_name").InnerText
                    'contact_company_name = node("contact_company_name").InnerText
                    contact_email = node("contact_email").InnerText
                    address1 = node("address1").InnerText
                    address2 = node("address2").InnerText
                    address3 = node("address3").InnerText
                    address4 = node("address4").InnerText
                    country_code = node("country_code").InnerText
                    'countryID = node("countryID").InnerText
                    contact_telephone = node("contact_telephone").InnerText
                    contact_fax = node("contact_fax").InnerText
                    contact_mobile = node("contact_mobile").InnerText
                    contact_notes = node("contact_notes").InnerText
                    'receivable_taxID = node("receivable_taxID").InnerText
                    'payable_taxID = node("payable_taxID").InnerText
                    tax_reference = node("tax_reference").InnerText
                    company_reference = node("company_reference").InnerText
                    'bank_sort = node("bank_sort").InnerText
                    'bank_number = node("bank_number").InnerText
                    'bank_iban = node("bank_iban").InnerText
                    contact_ref = node("contact_ref").InnerText
                    'approvalID = CInt(node("approvalID").InnerText)
                Catch ex As Exception
                    xml_data += "<response><code>24</code><message>Contact XML Field Error: " + ex.Message + "</message><type>contact</type></response>"
                End Try
                xml_data += "<response><code>0</code><message>contact_name: " + contact_name + "</message></response>"

                'basecamp_id = node("basecamp_id").InnerText
                'Save the data
                return_uid = saveContact(customer_public_key, customer_secret_key, username, _
                     contact_uid, contact_typeID, contact_name, contact_company_name, contact_email, address1, _
                     address2, address3, address4, country_code, contact_telephone, contact_fax, _
                     contact_mobile, contact_notes, receivable_taxID, payable_taxID, tax_reference, company_reference, _
                     bank_sort, bank_number, bank_iban, contact_ref, approvalID, basecamp_id)
                If return_uid <> "" Then
                    If contact_uid <> "" Then
                        xml_data += "<response><code>20</code><message>Contact Updated</message><type>contact</type><uid>" + return_uid + "</uid></response>"
                    Else
                        xml_data += "<response><code>20</code><message>Contact Added</message><type>contact</type><uid>" + return_uid + "</uid></response>"
                    End If
                Else
                    xml_data += "<response><code>22</code><message>Incorrect Contact Credentials</message><type>contact</type></response>"
                End If
            Next
        Catch ex As Exception
            xml_data += "Error Parsing XML: " + ex.Message
        End Try
        '-----------------------------------------------------------------------
        If counter = 0 Then
            xml_data += "<response><code>23</code><message>No Contact Data Saved</message><type>contact</type></response>"
        End If
        Return return_uid
    End Function


    Function saveContact(ByVal customer_public_key As String, ByVal customer_secret_key As String, ByVal username As String, _
                 ByVal contact_uid As String, ByVal contact_typeID As Integer, _
                 ByVal contact_name As String, ByVal contact_company_name As String, ByVal contact_email As String, ByVal address1 As String, _
                 ByVal address2 As String, ByVal address3 As String, ByVal address4 As String, _
                 ByVal country_code As String, ByVal contact_telephone As String, ByVal contact_fax As String, _
                 ByVal contact_mobile As String, ByVal contact_notes As String, ByVal receivable_taxID As Integer, _
                 ByVal payable_taxID As Integer, ByVal tax_reference As String, ByVal company_reference As String, _
                 ByVal bank_sort As String, ByVal bank_number As String, ByVal bank_iban As String, _
                 ByVal contact_ref As String, ByVal approvalID As Integer, ByVal basecamp_id As Integer) As String

        Dim return_uid As String = ""
        Dim passphrase As String = System.Configuration.ConfigurationManager.AppSettings("passphrase")
        Dim return_contactID As Integer = 0
        Dim con As New yendo.connection()
        Dim myCommand As SqlCommand
        myCommand = New SqlCommand()
        Dim myDataReader As SqlDataReader
        myCommand.Connection = con.initDB()
        myCommand.CommandText = "st_api_contact"
        myCommand.CommandType = CommandType.StoredProcedure
        myCommand.Parameters.Add(New SqlParameter("@customer_public_key", customer_public_key))
        myCommand.Parameters.Add(New SqlParameter("@customer_secret_key", customer_secret_key))
        myCommand.Parameters.Add(New SqlParameter("@username", username))
        myCommand.Parameters.Add(New SqlParameter("@contact_uid", contact_uid))
        myCommand.Parameters.Add(New SqlParameter("@contact_typeID", contact_typeID))
        myCommand.Parameters.Add(New SqlParameter("@contact_name", contact_name))
        myCommand.Parameters.Add(New SqlParameter("@contact_company_name", contact_company_name))
        myCommand.Parameters.Add(New SqlParameter("@contact_email", contact_email))
        myCommand.Parameters.Add(New SqlParameter("@address1", address1))
        myCommand.Parameters.Add(New SqlParameter("@address2", address2))
        myCommand.Parameters.Add(New SqlParameter("@address3", address3))
        myCommand.Parameters.Add(New SqlParameter("@address4", address4))
        myCommand.Parameters.Add(New SqlParameter("@country_code", country_code))
        myCommand.Parameters.Add(New SqlParameter("@contact_telephone", contact_telephone))
        myCommand.Parameters.Add(New SqlParameter("@contact_fax", contact_fax))
        myCommand.Parameters.Add(New SqlParameter("@contact_mobile", contact_mobile))
        myCommand.Parameters.Add(New SqlParameter("@contact_notes", contact_notes))
        myCommand.Parameters.Add(New SqlParameter("@receivable_taxID", receivable_taxID))
        myCommand.Parameters.Add(New SqlParameter("@payable_taxID", payable_taxID))
        myCommand.Parameters.Add(New SqlParameter("@tax_reference", tax_reference))
        myCommand.Parameters.Add(New SqlParameter("@company_reference", company_reference))
        myCommand.Parameters.Add(New SqlParameter("@bank_sort", bank_sort))
        myCommand.Parameters.Add(New SqlParameter("@bank_number", bank_number))
        myCommand.Parameters.Add(New SqlParameter("@bank_iban", bank_iban))
        myCommand.Parameters.Add(New SqlParameter("@approvalID", approvalID))
        myCommand.Parameters.Add(New SqlParameter("@basecamp_id", basecamp_id))
        myCommand.Parameters.Add(New SqlParameter("@contact_ref", contact_ref))
        myCommand.Parameters.Add(New SqlParameter("@passphrase", passphrase))
        myDataReader = myCommand.ExecuteReader()
        Do While myDataReader.Read()
            return_uid = myDataReader("return_uid").ToString()
        Loop
        myDataReader.Close()
        myCommand.Connection.Close()
        Return return_uid
    End Function



End Class

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
蛋白质耐热温度分类及预测重要数据表蛋白质是生物体中普遍存在的一类重要生物大分子,由天然氨基酸通过肽键连接而成。它具有复杂的分子结构和特定的生物功能,是表达生物遗传性状的一类主要物质。 蛋白质的结构可分为四级:一级结构是组成蛋白质多肽链的线性氨基酸序列;二级结构是依靠不同氨基酸之间的C=O和N-H基团间的氢键形成的稳定结构,主要为α螺旋和β折叠;三级结构是通过多个二级结构元素在三维空间的排列所形成的一个蛋白质分子的三维结构;四级结构用于描述由不同多肽链(亚基)间相互作用形成具有功能的蛋白质复合物分子。 蛋白质在生物体内具有多种功能,包括提供能量、维持电解质平衡、信息交流、构成人的身体以及免疫等。例如,蛋白质分解可以为人体提供能量,每克蛋白质能产生4千卡的热能;血液里的蛋白质能帮助维持体内的酸碱平衡和血液的渗透压;蛋白质是组成人体器官组织的重要物质,可以修复受损的器官功能,以及维持细胞的生长和更新;蛋白质也是构成多种生理活性的物质,如免疫球蛋白,具有维持机体正常免疫功能的作用。 蛋白质的合成是指生物按照从脱氧核糖核酸(DNA)转录得到的信使核糖核酸(mRNA)上的遗传信息合成蛋白质的过程。这个过程包括氨基酸的活化、多肽链合成的起始、肽链的延长、肽链的终止和释放以及蛋白质合成后的加工修饰等步骤。 蛋白质降解是指食物中的蛋白质经过蛋白质降解酶的作用降解为多肽和氨基酸然后被人体吸收的过程。这个过程在细胞的生理活动中发挥着极其重要的作用,例如将蛋白质降解后成为小分子的氨基酸,并被循环利用;处理错误折叠的蛋白质以及多余组分,使之降解,以防机体产生错误应答。 总的来说,蛋白质是生物体内不可或缺的一类重要物质,对于维持生物体的正常生理功能具有至关重要的作用。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值