Public Class clsUnicomCustomers
    ''' <summary>
    ''' 获取单条记录
    ''' </summary>
    ''' <param name="ID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function GetSingle(ByVal ID As Integer) As UnicomCustomers
        Using db As New DB_UnicomCustomersDataContext
            Return (From c In db.UnicomCustomers _
                    Where c.ID = ID _
                    Select c).FirstOrDefault
        End Using
    End Function
    ''' <summary>
    ''' 获取所有记录
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function GetLinq() As IQueryable(Of UnicomCustomers)
        Dim db As New DB_UnicomCustomersDataContext
        Return From c In db.UnicomCustomers _
               Order By c.ID _
               Select c
    End Function
    ''' <summary>
    ''' 删除单个实例
    ''' </summary>
    ''' <param name="ID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function Delete(ByVal ID As Integer) As Boolean
        Using db As New DB_UnicomCustomersDataContext
            Dim Del = (From d In db.UnicomCustomers _
                      Where d.ID = ID _
                      Select d).FirstOrDefault
            If Not IsNothing(Del) Then
                db.UnicomCustomers.DeleteOnSubmit(Del)
                Try
                    db.SubmitChanges()
                    Return True
                Catch ex As Exception
                    Return False
                End Try
            Else
                Return False
            End If
        End Using
    End Function
    ''' <summary>
    ''' 删除多个实例
    ''' </summary>
    ''' <param name="ID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function Delete(ByVal ID() As Integer) As Boolean
        Using db As New DB_UnicomCustomersDataContext
            Dim Del = From d In db.UnicomCustomers _
                      Where ID.Contains(d.ID) _
                      Select d
            For Each d In Del
                db.UnicomCustomers.DeleteOnSubmit(d)
            Next
            Try
                db.SubmitChanges()
                Return True
            Catch ex As Exception
                Return False
            End Try
        End Using
    End Function
    ''' <summary>
    ''' 添加
    ''' </summary>
    ''' <param name="EnjoyNumber"></param>
    ''' <param name="UniPhoneNumber"></param>
    ''' <param name="Uni2GNumber"></param>
    ''' <param name="Uni3GNumber"></param>
    ''' <param name="UniNetNumber"></param>
    ''' <param name="Mob3GNumber"></param>
    ''' <param name="Tel2GNumber"></param>
    ''' <param name="Tel3GNumber"></param>
    ''' <param name="CustomerNumber"></param>
    ''' <param name="Pull2G"></param>
    ''' <param name="Pull3G"></param>
    ''' <param name="UniDataNumber"></param>
    ''' <param name="OtherNumber"></param>
    ''' <param name="AllTotal"></param>
    ''' <param name="ThisTotal"></param>
    ''' <param name="ThatTotal"></param>
    ''' <param name="Mob2GNumber"></param>
    ''' <param name="AgreementDate"></param>
    ''' <param name="UniPhoneIncome"></param>
    ''' <param name="Uni2GIncome"></param>
    ''' <param name="Uni3GIncome"></param>
    ''' <param name="UniNetIncome"></param>
    ''' <param name="UniDataIncome"></param>
    ''' <param name="OtherIncome"></param>
    ''' <param name="Area"></param>
    ''' <param name="Manager"></param>
    ''' <param name="CustName"></param>
    ''' <param name="CustType"></param>
    ''' <param name="Industry"></param>
    ''' <param name="ChiefName"></param>
    ''' <param name="Suggest"></param>
    ''' <param name="CustomerOthers"></param>
    ''' <param name="Used52Type"></param>
    ''' <param name="UsedProducts"></param>
    ''' <param name="Apply52Type"></param>
    ''' <param name="Apply52Products"></param>
    ''' <param name="ApplyOthers"></param>
    ''' <param name="UniIsNet"></param>
    ''' <param name="MobIsNet"></param>
    ''' <param name="TelIsNet"></param>
    ''' <param name="CustomerIndustry"></param>
    ''' <param name="Customer52Type"></param>
    ''' <param name="CustomerProducts"></param>
    ''' <param name="Dealers"></param>
    ''' <param name="OtherName"></param>
    ''' <param name="OtherType"></param>
    ''' <param name="AgreementName"></param>
    ''' <param name="AgreementLimit"></param>
    ''' <param name="AgreementContent"></param>
    ''' <param name="Position"></param>
    ''' <param name="Contact"></param>
    ''' <param name="Character"></param>
    ''' <param name="Hobby"></param>
    ''' <param name="IsEnjoy"></param>
    ''' <param name="Important"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function Insert(ByVal EnjoyNumber As Integer, ByVal UniPhoneNumber As Integer, ByVal Uni2GNumber As Integer, ByVal Uni3GNumber As Integer, ByVal UniNetNumber As Integer, ByVal Mob3GNumber As Integer, ByVal Tel2GNumber As Integer, ByVal Tel3GNumber As Integer, ByVal CustomerNumber As Integer, ByVal Pull2G As Integer, ByVal Pull3G As Integer, ByVal UniDataNumber As Integer, ByVal OtherNumber As Integer, ByVal AllTotal As Integer, ByVal ThisTotal As Integer, ByVal ThatTotal As Integer, ByVal Mob2GNumber As Integer, ByVal AgreementDate As DateTime, ByVal UniPhoneIncome As Double, ByVal Uni2GIncome As Double, ByVal Uni3GIncome As Double, ByVal UniNetIncome As Double, ByVal UniDataIncome As Double, ByVal OtherIncome As Double, ByVal Area As String, ByVal Manager As String, ByVal CustName As String, ByVal CustType As String, ByVal Industry As String, ByVal ChiefName As String, ByVal Suggest As String, ByVal CustomerOthers As String, ByVal Used52Type As String, ByVal UsedProducts As String, ByVal Apply52Type As String, ByVal Apply52Products As String, ByVal ApplyOthers As String, ByVal UniIsNet As String, ByVal MobIsNet As String, ByVal TelIsNet As String, ByVal CustomerIndustry As String, ByVal Customer52Type As String, ByVal CustomerProducts As String, ByVal Dealers As String, ByVal OtherName As String, ByVal OtherType As String, ByVal AgreementName As String, ByVal AgreementLimit As String, ByVal AgreementContent As String, ByVal Position As String, ByVal Contact As String, ByVal Character As String, ByVal Hobby As String, ByVal IsEnjoy As String, ByVal Important As String) As Integer
        Using db As New DB_UnicomCustomersDataContext
            Dim mNewUnicomCustomers As New UnicomCustomers With {.EnjoyNumber = EnjoyNumber, .UniPhoneNumber = UniPhoneNumber, .Uni2GNumber = Uni2GNumber, .Uni3GNumber = Uni3GNumber, .UniNetNumber = UniNetNumber, .Mob3GNumber = Mob3GNumber, .Tel2GNumber = Tel2GNumber, .Tel3GNumber = Tel3GNumber, .CustomerNumber = CustomerNumber, .Pull2G = Pull2G, .Pull3G = Pull3G, .UniDataNumber = UniDataNumber, .OtherNumber = OtherNumber, .AllTotal = AllTotal, .ThisTotal = ThisTotal, .ThatTotal = ThatTotal, .Mob2GNumber = Mob2GNumber, .AgreementDate = AgreementDate, .UniPhoneIncome = UniPhoneIncome, .Uni2GIncome = Uni2GIncome, .Uni3GIncome = Uni3GIncome, .UniNetIncome = UniNetIncome, .UniDataIncome = UniDataIncome, .OtherIncome = OtherIncome, .Area = Area, .Manager = Manager, .CustName = CustName, .CustType = CustType, .Industry = Industry, .ChiefName = ChiefName, .Suggest = Suggest, .CustomerOthers = CustomerOthers, .Used52Type = Used52Type, .UsedProducts = UsedProducts, .Apply52Type = Apply52Type, .Apply52Products = Apply52Products, .ApplyOthers = ApplyOthers, .UniIsNet = UniIsNet, .MobIsNet = MobIsNet, .TelIsNet = TelIsNet, .CustomerIndustry = CustomerIndustry, .Customer52Type = Customer52Type, .CustomerProducts = CustomerProducts, .Dealers = Dealers, .OtherName = OtherName, .OtherType = OtherType, .AgreementName = AgreementName, .AgreementLimit = AgreementLimit, .AgreementContent = AgreementContent, .Position = Position, .Contact = Contact, .Character = Character, .Hobby = Hobby, .IsEnjoy = IsEnjoy, .Important = Important}
            db.UnicomCustomers.InsertOnSubmit(mNewUnicomCustomers)
            Try
                db.SubmitChanges()
                Return mNewUnicomCustomers.ID
            Catch ex As Exception
                Return 0
            End Try
        End Using
    End Function
    ''' <summary>
    ''' 保存
    ''' </summary>
    ''' <param name="EnjoyNumber"></param>
    ''' <param name="UniPhoneNumber"></param>
    ''' <param name="Uni2GNumber"></param>
    ''' <param name="Uni3GNumber"></param>
    ''' <param name="UniNetNumber"></param>
    ''' <param name="Mob3GNumber"></param>
    ''' <param name="Tel2GNumber"></param>
    ''' <param name="Tel3GNumber"></param>
    ''' <param name="CustomerNumber"></param>
    ''' <param name="Pull2G"></param>
    ''' <param name="Pull3G"></param>
    ''' <param name="UniDataNumber"></param>
    ''' <param name="OtherNumber"></param>
    ''' <param name="AllTotal"></param>
    ''' <param name="ThisTotal"></param>
    ''' <param name="ThatTotal"></param>
    ''' <param name="Mob2GNumber"></param>
    ''' <param name="AgreementDate"></param>
    ''' <param name="UniPhoneIncome"></param>
    ''' <param name="Uni2GIncome"></param>
    ''' <param name="Uni3GIncome"></param>
    ''' <param name="UniNetIncome"></param>
    ''' <param name="UniDataIncome"></param>
    ''' <param name="OtherIncome"></param>
    ''' <param name="Area"></param>
    ''' <param name="Manager"></param>
    ''' <param name="CustName"></param>
    ''' <param name="CustType"></param>
    ''' <param name="Industry"></param>
    ''' <param name="ChiefName"></param>
    ''' <param name="Suggest"></param>
    ''' <param name="CustomerOthers"></param>
    ''' <param name="Used52Type"></param>
    ''' <param name="UsedProducts"></param>
    ''' <param name="Apply52Type"></param>
    ''' <param name="Apply52Products"></param>
    ''' <param name="ApplyOthers"></param>
    ''' <param name="UniIsNet"></param>
    ''' <param name="MobIsNet"></param>
    ''' <param name="TelIsNet"></param>
    ''' <param name="CustomerIndustry"></param>
    ''' <param name="Customer52Type"></param>
    ''' <param name="CustomerProducts"></param>
    ''' <param name="Dealers"></param>
    ''' <param name="OtherName"></param>
    ''' <param name="OtherType"></param>
    ''' <param name="AgreementName"></param>
    ''' <param name="AgreementLimit"></param>
    ''' <param name="AgreementContent"></param>
    ''' <param name="Position"></param>
    ''' <param name="Contact"></param>
    ''' <param name="Character"></param>
    ''' <param name="Hobby"></param>
    ''' <param name="IsEnjoy"></param>
    ''' <param name="Important"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function Save(ByVal ID As Integer, ByVal EnjoyNumber As Integer, ByVal UniPhoneNumber As Integer, ByVal Uni2GNumber As Integer, ByVal Uni3GNumber As Integer, ByVal UniNetNumber As Integer, ByVal Mob3GNumber As Integer, ByVal Tel2GNumber As Integer, ByVal Tel3GNumber As Integer, ByVal CustomerNumber As Integer, ByVal Pull2G As Integer, ByVal Pull3G As Integer, ByVal UniDataNumber As Integer, ByVal OtherNumber As Integer, ByVal AllTotal As Integer, ByVal ThisTotal As Integer, ByVal ThatTotal As Integer, ByVal Mob2GNumber As Integer, ByVal AgreementDate As DateTime, ByVal UniPhoneIncome As Double, ByVal Uni2GIncome As Double, ByVal Uni3GIncome As Double, ByVal UniNetIncome As Double, ByVal UniDataIncome As Double, ByVal OtherIncome As Double, ByVal Area As String, ByVal Manager As String, ByVal CustName As String, ByVal CustType As String, ByVal Industry As String, ByVal ChiefName As String, ByVal Suggest As String, ByVal CustomerOthers As String, ByVal Used52Type As String, ByVal UsedProducts As String, ByVal Apply52Type As String, ByVal Apply52Products As String, ByVal ApplyOthers As String, ByVal UniIsNet As String, ByVal MobIsNet As String, ByVal TelIsNet As String, ByVal CustomerIndustry As String, ByVal Customer52Type As String, ByVal CustomerProducts As String, ByVal Dealers As String, ByVal OtherName As String, ByVal OtherType As String, ByVal AgreementName As String, ByVal AgreementLimit As String, ByVal AgreementContent As String, ByVal Position As String, ByVal Contact As String, ByVal Character As String, ByVal Hobby As String, ByVal IsEnjoy As String, ByVal Important As String) As Integer
        Using db As New DB_UnicomCustomersDataContext
            Dim UpdateUnicomCustomers = (From c In db.UnicomCustomers _
                                       Where c.ID = ID _
                                       Select c).FirstOrDefault
            If Not IsNothing(UpdateUnicomCustomers) Then
                With UpdateUnicomCustomers
                    .EnjoyNumber = EnjoyNumber
                    .UniPhoneNumber = UniPhoneNumber
                    .Uni2GNumber = Uni2GNumber
                    .Uni3GNumber = Uni3GNumber
                    .UniNetNumber = UniNetNumber
                    .Mob3GNumber = Mob3GNumber
                    .Tel2GNumber = Tel2GNumber
                    .Tel3GNumber = Tel3GNumber
                    .CustomerNumber = CustomerNumber
                    .Pull2G = Pull2G
                    .Pull3G = Pull3G
                    .UniDataNumber = UniDataNumber
                    .OtherNumber = OtherNumber
                    .AllTotal = AllTotal
                    .ThisTotal = ThisTotal
                    .ThatTotal = ThatTotal
                    .Mob2GNumber = Mob2GNumber
                    .AgreementDate = AgreementDate
                    .UniPhoneIncome = UniPhoneIncome
                    .Uni2GIncome = Uni2GIncome
                    .Uni3GIncome = Uni3GIncome
                    .UniNetIncome = UniNetIncome
                    .UniDataIncome = UniDataIncome
                    .OtherIncome = OtherIncome
                    .Area = Area
                    .Manager = Manager
                    .CustName = CustName
                    .CustType = CustType
                    .Industry = Industry
                    .ChiefName = ChiefName
                    .Suggest = Suggest
                    .CustomerOthers = CustomerOthers
                    .Used52Type = Used52Type
                    .UsedProducts = UsedProducts
                    .Apply52Type = Apply52Type
                    .Apply52Products = Apply52Products
                    .ApplyOthers = ApplyOthers
                    .UniIsNet = UniIsNet
                    .MobIsNet = MobIsNet
                    .TelIsNet = TelIsNet
                    .CustomerIndustry = CustomerIndustry
                    .Customer52Type = Customer52Type
                    .CustomerProducts = CustomerProducts
                    .Dealers = Dealers
                    .OtherName = OtherName
                    .OtherType = OtherType
                    .AgreementName = AgreementName
                    .AgreementLimit = AgreementLimit
                    .AgreementContent = AgreementContent
                    .Position = Position
                    .Contact = Contact
                    .Character = Character
                    .Hobby = Hobby
                    .IsEnjoy = IsEnjoy
                    .Important = Important

                End With

                Try
                    db.SubmitChanges()
                    Return 1
                Catch ex As Exception
                    Return 0
                End Try
            Else
                Return 0
            End If
        End Using
    End Function
End Class
